Holger's
Java API

com.antelmann.timeregister
Interface PunchDB

All Known Subinterfaces:
PunchAdminDB
All Known Implementing Classes:
AbstractPunchDB, FilePunchDB, OdbcPunchDB, PunchDataAnalyzer, PunchDBClient, RemotePunchDBClient, SQLPunchDB

public interface PunchDB

represents a database for holding PunchData objects.

Author:
Holger Antelmann
See Also:
PunchData, PunchDataAnalyzer

Method Summary
 void addPunchListener(PunchListener listener)
          registers a listener for calls of punch(PunchData)
 PunchData getFirstPunch(User user)
          if user is null, the first punch of all is returned.
 PunchData getLastPunch(User user)
          if user is null, the last punch of all is returned.
 PunchDataAnalyzer getPunchData(User user, Date from, Date until, String location, String activity)
          retrieves the relevant set of Punchdata objects in a PunchDataAnalyzer
 Map<Object,TimeUser> getUsers()
          returns an unmodifiable view of the users, mapping the id to a TimeUser
 void punch(PunchData entry)
          performs consistency check before adding the entry.
 void updatePassword(User user)
          updates the permanent storage with the password that is now present in the user
 

Method Detail

addPunchListener

void addPunchListener(PunchListener listener)
registers a listener for calls of punch(PunchData)

See Also:
punch(PunchData)

punch

void punch(PunchData entry)
           throws DatabaseException,
                  FormatException
performs consistency check before adding the entry. This is the method that should be generally used for adding data to a database. If the database was in a consistent state before this entry was added, the database will be constistent for the user in the entry after calling this method that stores the entry into the database.

Throws:
FormatException - if the employee is already checked in/out, or if there is a punch that occured thereafter, or if the first punch for the user is a checkout.
DatabaseException
See Also:
addPunchListener(PunchListener), PunchDataAnalyzer.verifyPunch(PunchDB, PunchData)

getPunchData

PunchDataAnalyzer getPunchData(User user,
                               Date from,
                               Date until,
                               String location,
                               String activity)
                               throws DatabaseException
retrieves the relevant set of Punchdata objects in a PunchDataAnalyzer

Parameters:
user - limits retrieval by employee; if null, this limit does not apply
from - limits retrieval by begin date; if null, this limit does not apply
until - limits retrieval by end date; if null, this limit does not apply
Returns:
a set of PunchData objects
Throws:
DatabaseException
See Also:
PunchData

getLastPunch

PunchData getLastPunch(User user)
                       throws DatabaseException
if user is null, the last punch of all is returned. If no punch data is available, null is returned.

Throws:
DatabaseException

getFirstPunch

PunchData getFirstPunch(User user)
                        throws DatabaseException
if user is null, the first punch of all is returned. If no punch data is available, null is returned.

Throws:
DatabaseException

getUsers

Map<Object,TimeUser> getUsers()
                              throws DatabaseException
returns an unmodifiable view of the users, mapping the id to a TimeUser

Throws:
DatabaseException

updatePassword

void updatePassword(User user)
                    throws DatabaseException
updates the permanent storage with the password that is now present in the user

Throws:
DatabaseException
See Also:
UserImpl.setPassword(char[]), UserImpl.getPasswordHash()


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