Holger's
Java API

com.antelmann.timeregister
Class PunchStation

java.lang.Object
  extended by com.antelmann.timeregister.PunchStation

public class PunchStation
extends Object

PunchStation represents a location where employees can punch their times.

Author:
Holger Antelmann

Constructor Summary
PunchStation(PunchDB db, String location, TimeSystem ts)
           
PunchStation(PunchDB db, String location, TimeSystem ts, Logger logger)
           
PunchStation(PunchDB db, String location, TimeSystem ts, Logger logger, String activity)
           
 
Method Summary
 String getActivity()
          returns the value that all punches registered will be marked with (null by default) unless explicitly stated otherwise.
 String getLocation()
           
 Logger getLogger()
           
 PunchDB getPunchDB()
           
 TimeSystem getTimeSystem()
           
 PunchData punch(User user)
          punches the given user in/out depending on whether he/she was checked out/in before.
 PunchData punch(User user, boolean checkIn)
          uses the current activity setting of this instance
 PunchData punch(User user, boolean checkIn, String activity)
          stores the PunchData after checking some basic consistency w/ existing data.
 PunchData punch(User user, String activity)
          punches the given user in/out depending on whether he/she was checked out/in before.
 void setActivity(String activity)
          setting the activity means that all punches registered through this station will be marked with this activity (unless explicitly stated otherwise).
 void setLocation(String location)
           
 void setLogger(Logger logger)
           
 void setPunchDB(PunchDB db)
           
 void setTimeSystem(TimeSystem ts)
          sets a time system to be used; if null, the system time is used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PunchStation

public PunchStation(PunchDB db,
                    String location,
                    TimeSystem ts)
             throws DatabaseException
Throws:
DatabaseException

PunchStation

public PunchStation(PunchDB db,
                    String location,
                    TimeSystem ts,
                    Logger logger)
             throws DatabaseException
Throws:
DatabaseException

PunchStation

public PunchStation(PunchDB db,
                    String location,
                    TimeSystem ts,
                    Logger logger,
                    String activity)
             throws DatabaseException
Throws:
DatabaseException
Method Detail

getTimeSystem

public TimeSystem getTimeSystem()

setTimeSystem

public void setTimeSystem(TimeSystem ts)
sets a time system to be used; if null, the system time is used.


getLogger

public Logger getLogger()

setLogger

public void setLogger(Logger logger)

setActivity

public void setActivity(String activity)
setting the activity means that all punches registered through this station will be marked with this activity (unless explicitly stated otherwise).


getActivity

public String getActivity()
returns the value that all punches registered will be marked with (null by default) unless explicitly stated otherwise.


punch

public PunchData punch(User user)
                throws DatabaseException
punches the given user in/out depending on whether he/she was checked out/in before.

Throws:
DatabaseException
See Also:
punch(User, String)

punch

public PunchData punch(User user,
                       String activity)
                throws DatabaseException
punches the given user in/out depending on whether he/she was checked out/in before. The method may still fail with a nested FormatException in the unlikely event that the same user is punching at a different location simultaneously or has punched 'in the future'.

Throws:
DatabaseException

punch

public PunchData punch(User user,
                       boolean checkIn)
                throws DatabaseException,
                       FormatException
uses the current activity setting of this instance

Throws:
DatabaseException
FormatException

punch

public PunchData punch(User user,
                       boolean checkIn,
                       String activity)
                throws DatabaseException,
                       FormatException
stores the PunchData after checking some basic consistency w/ existing data. If the punch results in a checkOut, the activity parameter is pretty much irrelevant.

Returns:
the successfully stored PunchData object.
Throws:
DatabaseException
FormatException
See Also:
PunchDB.punch(PunchData)

getLocation

public String getLocation()

setLocation

public void setLocation(String location)

getPunchDB

public PunchDB getPunchDB()

setPunchDB

public void setPunchDB(PunchDB db)


(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads