|
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.WorkUnit
public class WorkUnit
represents a timeframe in which an employee worked. Note that the begin and end time are floored to the nearest second to provide better compatibility for database access. In consequense, the following assertion may fail:
java.util.Date date = new Date(); WorkUnit unit = new WorkUnit(date, 60000, user); assert date.equals(unit.getBegin()) : "the time was rounded"The same is true for the length, which is saved only by the second.
PunchAdminDB,
WorkUnitAnalyzer,
Serialized Form| Nested Class Summary | |
|---|---|
static class |
WorkUnit.Type
|
| Constructor Summary | |
|---|---|
WorkUnit(Date begin,
Date end,
User user)
type WORK is used as the default |
|
WorkUnit(Date begin,
Date end,
User user,
WorkUnit.Type type,
String activity)
|
|
WorkUnit(Date begin,
Date end,
User user,
WorkUnit.Type type,
String activity,
long breakTime,
String comment)
|
|
WorkUnit(Date begin,
Date end,
User user,
WorkUnit.Type type,
String activity,
String comment)
|
|
WorkUnit(Date begin,
long length,
User user)
type WORK is used as the default |
|
WorkUnit(Date begin,
long length,
User user,
WorkUnit.Type type,
String activity)
|
|
WorkUnit(Date begin,
long length,
User user,
WorkUnit.Type type,
String activity,
long breakTime,
String comment)
|
|
| Method Summary | |
|---|---|
int |
compareTo(WorkUnit unit)
sorts by user, begin, type, length |
boolean |
equals(Object obj)
based on user, begin, type and length |
String |
getActivity()
|
Date |
getBegin()
|
long |
getBreakTime()
|
String |
getComment()
|
Date |
getEnd()
|
long |
getLength()
total length including breakTimes |
long |
getNetLength()
returns the length minus the breakTime time |
WorkUnit.Type |
getType()
|
static WorkUnit.Type |
getTypeForString(String s)
reverts the given String to a Type and returns it - or null if no corresponding type exists |
static String[] |
getTypeStrings()
returns localized strings for all types |
User |
getUser()
|
int |
hashCode()
|
boolean |
isApproved()
false by default |
boolean |
overlapsWith(WorkUnit unit)
only looks at the time, not at the user |
void |
setActivity(String activity)
|
void |
setApproved(boolean flag)
|
void |
setBreakTime(long breakTime)
|
void |
setComment(String comment)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WorkUnit(Date begin,
Date end,
User user)
public WorkUnit(Date begin,
Date end,
User user,
WorkUnit.Type type,
String activity)
public WorkUnit(Date begin,
Date end,
User user,
WorkUnit.Type type,
String activity,
String comment)
public WorkUnit(Date begin,
Date end,
User user,
WorkUnit.Type type,
String activity,
long breakTime,
String comment)
public WorkUnit(Date begin,
long length,
User user)
public WorkUnit(Date begin,
long length,
User user,
WorkUnit.Type type,
String activity)
public WorkUnit(Date begin,
long length,
User user,
WorkUnit.Type type,
String activity,
long breakTime,
String comment)
| Method Detail |
|---|
public boolean overlapsWith(WorkUnit unit)
public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic int compareTo(WorkUnit unit)
compareTo in interface Comparable<WorkUnit>public boolean isApproved()
public void setApproved(boolean flag)
public void setActivity(String activity)
public void setComment(String comment)
public Date getBegin()
public long getLength()
public Date getEnd()
public User getUser()
public WorkUnit.Type getType()
public String getActivity()
public String getComment()
public long getBreakTime()
public void setBreakTime(long breakTime)
throws IllegalArgumentException
IllegalArgumentExceptionpublic long getNetLength()
public String toString()
toString in class Objectpublic static String[] getTypeStrings()
getTypeForString(String)public static WorkUnit.Type getTypeForString(String s)
getTypeStrings()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||