Holger's
Java API

com.antelmann.timeregister
Class PunchData

java.lang.Object
  extended by com.antelmann.timeregister.PunchData
All Implemented Interfaces:
Serializable, Comparable<PunchData>

public class PunchData
extends Object
implements Serializable, Comparable<PunchData>

encapsulates the check-in or a check-out data for an employee's time-punch. Note that for compatibility reasons with several databases, the milliseconds are not stored, i.e. the time is floored to the second. In consequense, the following assertion may fail:

 java.util.Date time = new Date();
 PunchData pd = new PunchData(user, time, true, "location");
 assert time.equals(pd.getTime()) : "the time was rounded"
 

Author:
Holger Antelmann
See Also:
PunchDB, PunchDataAnalyzer, Serialized Form

Constructor Summary
PunchData(User user, Date time, boolean checkIn, String location)
           
PunchData(User user, Date time, boolean checkIn, String location, String activity, String comment)
          the activity is ignored on checkout
 
Method Summary
 int compareTo(PunchData pd)
          compares first the user and then the time
 boolean equals(Object obj)
           
 String getActivity()
          The activity is only relevant for a check-in; for a check-out, null is always returned
 String getComment()
           
 String getLocation()
           
 Date getTime()
           
 User getUser()
           
 int hashCode()
           
 boolean isCheckIn()
           
 boolean isCheckOut()
           
 void setComment(String comment)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PunchData

public PunchData(User user,
                 Date time,
                 boolean checkIn,
                 String location)
          throws IllegalArgumentException
Throws:
IllegalArgumentException

PunchData

public PunchData(User user,
                 Date time,
                 boolean checkIn,
                 String location,
                 String activity,
                 String comment)
          throws IllegalArgumentException
the activity is ignored on checkout

Throws:
IllegalArgumentException
Method Detail

getTime

public Date getTime()

getUser

public User getUser()

getLocation

public String getLocation()

getActivity

public String getActivity()
The activity is only relevant for a check-in; for a check-out, null is always returned


isCheckIn

public boolean isCheckIn()

isCheckOut

public boolean isCheckOut()

getComment

public String getComment()

setComment

public void setComment(String comment)

compareTo

public int compareTo(PunchData pd)
compares first the user and then the time

Specified by:
compareTo in interface Comparable<PunchData>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


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