com.opnworks.timesheet.domain
Class Timesheet

java.lang.Object
  extended bycom.opnworks.timesheet.domain.Timesheet
All Implemented Interfaces:
IPersistent, java.io.Serializable

public class Timesheet
extends java.lang.Object
implements IPersistent

Instances of this class represent timesheets and are persistent objects.

Author:
laurent
See Also:
Serialized Form

Field Summary
static java.lang.String STATE_APPROVED_STRING
          Description of the Field
static java.lang.String STATE_CLOSED_STRING
          Description of the Field
static java.lang.String STATE_OPENED_STRING
          Description of the Field
static java.lang.String STATE_REJECTED_STRING
          Description of the Field
 
Constructor Summary
Timesheet()
           
 
Method Summary
 void addLineItem(TimesheetLineItem lineItem)
          Adds a line item to the Timesheet
static void addStateListener(ITimesheetStateListener listener)
           
 void approve(Comment comment, Person person)
          Set the state to APPROVED
 void close(Comment comment, IPerson person)
          Set the state to CLOSED
 java.util.List getComments()
           
 IOrganization getEmployer()
           
 java.lang.Long getId()
          Gets the Id attribute of the IPersistent object
 java.util.Set getLineItems()
           
 IPerson getOwner()
           
 int getState()
           
 java.lang.String getStateAsString()
           
 float getTotal()
           
 int getVersion()
           
 Week getWeek()
           
 boolean isApproved()
           
 boolean isClosed()
           
 boolean isOpen()
           
 boolean isRejected()
           
 void reject(Comment comment, Person person)
          Reject the timesheet
 void removeLineItem(TimesheetLineItem lineItem)
          Description of the Method
static void removeStateListener(ITimesheetStateListener listener)
           
 void reopen(Comment comment, IPerson person)
          Set the state to OPEN
 void setEmployer(IOrganization organization)
           
 void setId(java.lang.Long long1)
          Sets the Id attribute of the IPersistent object
 void setOwner(IPerson person)
           
 void setVersion(int version)
           
 void setWeek(Week week)
           
 void updateLineItem(TimesheetLineItem lineItem)
          Description of the Method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_OPENED_STRING

public static final java.lang.String STATE_OPENED_STRING
Description of the Field

See Also:
Constant Field Values

STATE_CLOSED_STRING

public static final java.lang.String STATE_CLOSED_STRING
Description of the Field

See Also:
Constant Field Values

STATE_REJECTED_STRING

public static final java.lang.String STATE_REJECTED_STRING
Description of the Field

See Also:
Constant Field Values

STATE_APPROVED_STRING

public static final java.lang.String STATE_APPROVED_STRING
Description of the Field

See Also:
Constant Field Values
Constructor Detail

Timesheet

public Timesheet()
Method Detail

setWeek

public void setWeek(Week week)
Parameters:
week -

setEmployer

public void setEmployer(IOrganization organization)
Parameters:
organization -

setOwner

public void setOwner(IPerson person)
Parameters:
person -

setId

public void setId(java.lang.Long long1)
Description copied from interface: IPersistent
Sets the Id attribute of the IPersistent object

Specified by:
setId in interface IPersistent
Parameters:
long1 -

setVersion

public void setVersion(int version)
Specified by:
setVersion in interface IPersistent
Parameters:
version - The new Version value

getLineItems

public java.util.Set getLineItems()
Returns:

getWeek

public Week getWeek()
Returns:

getEmployer

public IOrganization getEmployer()
Returns:

getOwner

public IPerson getOwner()
Returns:

isClosed

public boolean isClosed()
Returns:
true if CLOSED

isOpen

public boolean isOpen()
Returns:
true if OPEN

isApproved

public boolean isApproved()
Returns:
true if APPROVED

getComments

public java.util.List getComments()
                           throws TimesheetException
Returns:
Throws:
TimesheetException - Description of Exception

getState

public int getState()
Returns:

getStateAsString

public java.lang.String getStateAsString()
Returns:
The state as a string mnemonic

getId

public java.lang.Long getId()
Description copied from interface: IPersistent
Gets the Id attribute of the IPersistent object

Specified by:
getId in interface IPersistent
Returns:

getTotal

public float getTotal()
Returns:
The total number of hours

isRejected

public boolean isRejected()
Returns:

getVersion

public int getVersion()
Specified by:
getVersion in interface IPersistent
Returns:

close

public void close(Comment comment,
                  IPerson person)
           throws TimesheetException
Set the state to CLOSED

Parameters:
comment - Description of Parameter
person - Description of Parameter
Throws:
TimesheetException - Description of Exception

reopen

public void reopen(Comment comment,
                   IPerson person)
            throws TimesheetException
Set the state to OPEN

Parameters:
comment - Description of Parameter
person - Description of Parameter
Throws:
TimesheetException - Description of Exception

approve

public void approve(Comment comment,
                    Person person)
             throws TimesheetException
Set the state to APPROVED

Parameters:
comment - Description of Parameter
person - Description of Parameter
Throws:
TimesheetException - Description of Exception

reject

public void reject(Comment comment,
                   Person person)
            throws TimesheetException
Reject the timesheet

Parameters:
comment - Description of Parameter
person - Description of Parameter
Throws:
TimesheetException - Description of Exception

addLineItem

public void addLineItem(TimesheetLineItem lineItem)
                 throws TimesheetException
Adds a line item to the Timesheet

Parameters:
lineItem - The LineItem to be added
Throws:
TimesheetException - Description of Exception

removeLineItem

public void removeLineItem(TimesheetLineItem lineItem)
                    throws TimesheetException
Description of the Method

Parameters:
lineItem - Description of Parameter
Throws:
TimesheetException - Description of Exception

updateLineItem

public void updateLineItem(TimesheetLineItem lineItem)
                    throws TimesheetException
Description of the Method

Parameters:
lineItem - Description of Parameter
Throws:
TimesheetException - Description of Exception

addStateListener

public static void addStateListener(ITimesheetStateListener listener)
Parameters:
listener - The feature to be added to the StateListener attribute

removeStateListener

public static void removeStateListener(ITimesheetStateListener listener)
Parameters:
listener - Description of Parameter