|
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.PunchDataAnalyzer
public class PunchDataAnalyzer
used to analyze PunchData objects. The PunchDataAnalyzer also serves as an in-memory implementation of a PunchDB.
PunchData,
PunchDB,
Serialized Form| Field Summary |
|---|
| Fields inherited from class com.antelmann.timeregister.AbstractPunchDB |
|---|
listeners |
| Constructor Summary | |
|---|---|
PunchDataAnalyzer()
|
|
PunchDataAnalyzer(Collection<PunchData> punchDataEntries)
|
|
PunchDataAnalyzer(PunchDataAnalyzer analyzer)
|
|
PunchDataAnalyzer(PunchDB db)
|
|
| Method Summary | |
|---|---|
void |
addAll(Collection<PunchData> punchDataEntries)
|
void |
addAll(PunchDataAnalyzer analyzer)
|
void |
close()
doesn't do anything |
boolean |
contains(PunchData entry)
|
void |
delete(PunchData entry)
|
void |
exportToFile(File file,
String fieldSeparator,
boolean usesQuotes)
|
void |
filter(Filter<PunchData> filter)
filters this analyzer according to the given filter. |
void |
filter(User user,
Date from,
Date until,
String location,
String activity,
String comment)
filters this analyzer according to the given restrictions. |
PunchData |
findPunch(User user,
Date time)
|
String |
getActivityFor(User user)
returns the current activity |
String |
getActivityFor(User user,
Date date)
returns the activity based on the PunchData last recorded for the given date; may return null if either the user is checked-out or if the current activity is indeed null. |
SortedSet<PunchData> |
getAll()
returns an unmodifyable view on all PunchData objects |
PunchData |
getFirstPunch(User user)
if employee is null, the first punch among all employees is returned |
PunchData |
getLastPunch(User user)
if employee is null, the last punch among all employees is returned |
SortedSet<PunchData> |
getPunchData(User user)
returns a view of the data (not backed by the real data, returned is a new Set) |
PunchDataAnalyzer |
getPunchData(User user,
Date from,
Date until,
String location,
String activity)
retrieves the relevant set of Punchdata objects in a PunchDataAnalyzer |
ArrayList<PunchData> |
getPunchSequenceFor(User user,
Date time)
a punch sequence starts with the first check-in punch there is or after the most recent check-out before or at the given time; the sequence ends with the check-out (if complete). |
Map<Object,TimeUser> |
getUsers()
returns a new set of all user ids available in this analyzer |
long |
getWorkingTime()
returns the complete working time (in milliseconds) of all users from this analyzer. |
ArrayList<WorkUnit> |
getWorkUnits()
returns a list of WorkUnit objects resulting from the current content of the analyzer. |
boolean |
isCurrentlyPresent(User user)
by definition: if no punch data is available for the user, false is returned |
void |
removeAll()
|
PunchData |
removeFirst()
|
PunchData |
removeLast()
|
int |
size()
|
void |
store(PunchData entry)
used by the final punch(PunchData) method to delegate the database storing. |
void |
storeInto(PunchDB db)
|
void |
updatePassword(User user)
not supported with the analyzer; always throws DatabaseException |
void |
verifyConsistency()
|
static void |
verifyPunch(PunchDB db,
PunchData pd)
checks whether the data can be stored into the database w/o causing inconsistency for the employee in the given PunchData entry. |
| 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 |
| Constructor Detail |
|---|
public PunchDataAnalyzer()
public PunchDataAnalyzer(PunchDB db)
public PunchDataAnalyzer(PunchDataAnalyzer analyzer)
public PunchDataAnalyzer(Collection<PunchData> punchDataEntries)
| Method Detail |
|---|
public void close()
public void addAll(PunchDataAnalyzer analyzer)
public void addAll(Collection<PunchData> punchDataEntries)
public boolean contains(PunchData entry)
public void store(PunchData entry)
AbstractPunchDBpunch(PunchData) method to delegate the database storing.
(Note that a PunchAdminDB makes this method public)
store in class AbstractPunchDBPunchDB.punch(PunchData)public void removeAll()
public void delete(PunchData entry)
public void storeInto(PunchDB db)
throws DatabaseException,
FormatException
DatabaseException
FormatException
public void updatePassword(User user)
throws DatabaseException
updatePassword in interface PunchDBDatabaseExceptionUserImpl.setPassword(char[]),
UserImpl.getPasswordHash()public int size()
public void filter(Filter<PunchData> filter)
public void filter(User user,
Date from,
Date until,
String location,
String activity,
String comment)
public PunchDataAnalyzer getPunchData(User user,
Date from,
Date until,
String location,
String activity)
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
PunchData
public PunchData findPunch(User user,
Date time)
public ArrayList<PunchData> getPunchSequenceFor(User user,
Date time)
public Map<Object,TimeUser> getUsers()
getUsers in interface PunchDB
public boolean isCurrentlyPresent(User user)
throws NoSuchElementException
NoSuchElementExceptionpublic String getActivityFor(User user)
public String getActivityFor(User user,
Date date)
public SortedSet<PunchData> getAll()
public SortedSet<PunchData> getPunchData(User user)
public long getWorkingTime()
throws FormatException
This method only calculates the time based on completed working units within this analyzer, i.e. if the first punch per user is a check-out or the last punch is a check-in, that punch is ignored in the calculation.
FormatException - if the data is found to be in an inconsistent state
(e.g. if one user checked in twice in a row)filter(Filter),
filter(User, Date, Date, String, String, String)
public ArrayList<WorkUnit> getWorkUnits()
throws FormatException
FormatExceptionpublic PunchData getFirstPunch(User user)
getFirstPunch in interface PunchDBpublic PunchData getLastPunch(User user)
getLastPunch in interface PunchDBpublic PunchData removeFirst()
public PunchData removeLast()
public static void verifyPunch(PunchDB db,
PunchData pd)
throws DatabaseException,
FormatException
FormatException - if inserting the data would result in inconsistencies
DatabaseException
public void verifyConsistency()
throws FormatException
FormatException
public void exportToFile(File file,
String fieldSeparator,
boolean usesQuotes)
throws IOException
IOException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||