|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.timeregister.AbstractPunchDB
com.antelmann.timeregister.SQLPunchDB
public class SQLPunchDB
implements a PunchDB based on a JDBC connection
| Fields inherited from class com.antelmann.timeregister.AbstractPunchDB |
|---|
listeners |
| Constructor Summary | |
|---|---|
SQLPunchDB(Connection connection,
Properties properties)
|
|
| Method Summary | |
|---|---|
void |
close()
|
void |
delete(Holiday h)
|
void |
delete(PunchData entry)
deletes the given entry from the database without any consistency checking. |
void |
delete(WorkUnit unit)
|
void |
delete(WorkUnitValidator wv)
|
void |
deleteUser(User user)
use with caution: this also deletes all associated records of the given user |
protected List<WorkUnit> |
extractUnits(ResultSet rs,
Map<Object,TimeUser> users,
Filter<WorkUnit> filter)
|
protected TimeUser |
extractUser(ResultSet rs)
|
protected Map<String,WorkUnitValidator> |
extractValidators(ResultSet rs,
Filter<WorkUnitValidator> filter)
|
String[] |
getActivities()
returns a list of activities contained in the database |
Connection |
getConnection()
|
PunchData |
getFirstPunch(User user)
if user is null, the first punch of all is returned. |
HolidayCalendar |
getHolidays()
|
PunchData |
getLastPunch(User user)
if user is null, the last punch of all is returned. |
String |
getPassword(String employee)
|
protected PunchData |
getPunch(User user,
boolean first)
|
PunchDataAnalyzer |
getPunchData(User user,
Date from,
Date until,
String location,
String activity)
retrieves the relevant set of Punchdata objects in a PunchDataAnalyzer |
User |
getUser(String id)
|
Map<Object,TimeUser> |
getUsers()
uses TimeUser objects |
List<WorkUnit> |
getWorkUnits(Filter<WorkUnit> filter)
|
List<WorkUnit> |
getWorkUnits(User user,
WorkUnit.Type type,
Date beginAfter,
Date beginBefore,
String activity)
retrieves the relevant set of WorkUnit objects |
List<WorkUnit> |
getWorkUnitsFor(User user,
Date date)
returns all work units that enclose the given time based on the given user (or all users if user is null). |
WorkUnitValidator |
getWorkUnitValidator(String name)
may return null if the given name was not found |
Map<String,WorkUnitValidator> |
getWorkUnitValidators(Filter<WorkUnitValidator> filter)
filter may be null, in which case no restrictions apply and all validators found will be returned |
void |
insert(Holiday h)
|
void |
insert(WorkUnit unit)
inserts the given unit into the database |
void |
insertUser(User user)
|
boolean |
isInUse(WorkUnitValidator wv)
checks whether any user uses this validator |
void |
save(WorkUnitValidator wv)
if the validator exists, it will be updated; otherwise the entry will be created |
void |
store(PunchData entry)
used by the final punch(PunchData) method to delegate the database storing. |
protected void |
storeUser(ResultSet rs,
User user)
|
void |
updatePassword(User user)
updates the permanent storage with the password that is now present in the user |
void |
updateUser(User user)
|
protected void |
updateWorkUnitValidator(ResultSet rs,
WorkUnitValidator wv,
boolean insert)
|
void |
verifyConsistency()
|
| Methods inherited from class com.antelmann.timeregister.AbstractPunchDB |
|---|
addPunchListener, getPunchListeners, punch, removeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.antelmann.timeregister.PunchDB |
|---|
addPunchListener, punch |
| Field Detail |
|---|
public static final String CHECK_IN
public static final String CHECK_OUT
protected String employeeTableName
protected String employeeNameField
protected String employeePasswordField
protected String employeeCommentField
protected String employeeIdField
protected String employeeEnabledField
protected String employeeReadField
protected String employeeReadAllField
protected String employeeAdminField
protected String employeeScheduleField
protected String employeeBarcodeField
protected String punchTableName
protected String punchEmployeeField
protected String punchTimeField
protected String punchCheckField
protected String punchLocationField
protected String punchActivityField
protected String punchCommentField
protected String unitTableName
protected String unitBeginField
protected String unitEndField
protected String unitEmployeeField
protected String unitTypeField
protected String unitActivityField
protected String unitCommentField
protected String unitApprovedField
protected String unitBreakField
protected String scheduleTableName
protected String scheduleNameField
protected String scheduleDayBeginField
protected String scheduleMaxTimeField
protected String scheduleMinTimeField
protected String scheduleMonField
protected String scheduleTueField
protected String scheduleWedField
protected String scheduleThuField
protected String scheduleFriField
protected String scheduleSatField
protected String scheduleSunField
protected String scheduleMonBreakField
protected String scheduleTueBreakField
protected String scheduleWedBreakField
protected String scheduleThuBreakField
protected String scheduleFriBreakField
protected String scheduleSatBreakField
protected String scheduleSunBreakField
protected String scheduleIntervalTableName
protected String scheduleIntervalNameField
protected String scheduleIntervalBeginField
protected String scheduleIntervalEndField
protected String scheduleIntervalCheckinField
protected String holidayTableName
protected String holidayDateField
protected String holidayNameField
| Constructor Detail |
|---|
public SQLPunchDB(Connection connection,
Properties properties)
throws SQLException
SQLException| Method Detail |
|---|
public Connection getConnection()
public void close()
throws IOException
IOException
public Map<Object,TimeUser> getUsers()
throws DatabaseException
getUsers in interface PunchDBDatabaseExceptionTimeUser
public User getUser(String id)
throws DatabaseException
DatabaseException
protected TimeUser extractUser(ResultSet rs)
throws SQLException,
DatabaseException
SQLException
DatabaseException
public String getPassword(String employee)
throws DatabaseException,
IllegalArgumentException
DatabaseException
IllegalArgumentException
public void verifyConsistency()
throws DatabaseException,
FormatException
DatabaseException
FormatException
public void store(PunchData entry)
throws DatabaseException
AbstractPunchDBpunch(PunchData) method to delegate the database storing.
(Note that a PunchAdminDB makes this method public)
store in interface PunchAdminDBstore in class AbstractPunchDBDatabaseExceptionPunchDB.punch(PunchData)
public void delete(PunchData entry)
throws DatabaseException
PunchAdminDB
delete in interface PunchAdminDBDatabaseException
public void delete(WorkUnit unit)
throws DatabaseException
delete in interface PunchAdminDBDatabaseException
public PunchDataAnalyzer getPunchData(User user,
Date from,
Date until,
String location,
String activity)
throws DatabaseException
PunchDB
getPunchData in interface PunchDBuser - limits retrieval by employee; if null, this limit does not applyfrom - limits retrieval by begin date; if null, this limit does not applyuntil - limits retrieval by end date; if null, this limit does not apply
DatabaseExceptionPunchData
public PunchData getFirstPunch(User user)
throws DatabaseException
PunchDB
getFirstPunch in interface PunchDBDatabaseException
public PunchData getLastPunch(User user)
throws DatabaseException
PunchDB
getLastPunch in interface PunchDBDatabaseException
public void updatePassword(User user)
throws DatabaseException
PunchDB
updatePassword in interface PunchDBDatabaseExceptionUserImpl.setPassword(char[]),
UserImpl.getPasswordHash()
public void deleteUser(User user)
throws DatabaseException
PunchAdminDB
deleteUser in interface PunchAdminDBDatabaseException
public void updateUser(User user)
throws DatabaseException
updateUser in interface PunchAdminDBDatabaseException
public void insertUser(User user)
throws DatabaseException
insertUser in interface PunchAdminDBDatabaseException
protected void storeUser(ResultSet rs,
User user)
throws SQLException
SQLException
protected PunchData getPunch(User user,
boolean first)
throws DatabaseException
DatabaseException
public void insert(WorkUnit unit)
throws DatabaseException
PunchAdminDB
insert in interface PunchAdminDBDatabaseException
public List<WorkUnit> getWorkUnits(User user,
WorkUnit.Type type,
Date beginAfter,
Date beginBefore,
String activity)
throws DatabaseException
PunchAdminDB
getWorkUnits in interface PunchAdminDBuser - limits retrieval by employee; if null, this limit does not applytype - limits retrieval by type; if null, this limit does not applybeginAfter - limits retrieval by begin date no earlier than given; if null, this limit does not applybeginBefore - limits retrieval by begin date no later than given; if null, this limit does not applyactivity - limits retrieval by activity; if null, this limit does not apply
DatabaseExceptionPunchData
public List<WorkUnit> getWorkUnitsFor(User user,
Date date)
throws DatabaseException
PunchAdminDB
getWorkUnitsFor in interface PunchAdminDBDatabaseException
public List<WorkUnit> getWorkUnits(Filter<WorkUnit> filter)
throws DatabaseException
DatabaseException
protected List<WorkUnit> extractUnits(ResultSet rs,
Map<Object,TimeUser> users,
Filter<WorkUnit> filter)
throws SQLException,
DatabaseException
SQLException
DatabaseException
public boolean isInUse(WorkUnitValidator wv)
throws DatabaseException
DatabaseException
public void delete(WorkUnitValidator wv)
throws DatabaseException
delete in interface PunchAdminDBDatabaseException
public void save(WorkUnitValidator wv)
throws DatabaseException
save in interface PunchAdminDBDatabaseException
protected void updateWorkUnitValidator(ResultSet rs,
WorkUnitValidator wv,
boolean insert)
throws SQLException
SQLException
public WorkUnitValidator getWorkUnitValidator(String name)
throws DatabaseException
DatabaseException
public Map<String,WorkUnitValidator> getWorkUnitValidators(Filter<WorkUnitValidator> filter)
throws DatabaseException
PunchAdminDB
getWorkUnitValidators in interface PunchAdminDBDatabaseException
protected Map<String,WorkUnitValidator> extractValidators(ResultSet rs,
Filter<WorkUnitValidator> filter)
throws SQLException
SQLException
public String[] getActivities()
throws DatabaseException
DatabaseException
public void delete(Holiday h)
throws DatabaseException
delete in interface PunchAdminDBDatabaseException
public void insert(Holiday h)
throws DatabaseException
insert in interface PunchAdminDBDatabaseException
public HolidayCalendar getHolidays()
throws DatabaseException
getHolidays in interface PunchAdminDBDatabaseException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||