wt.projmgmt.msproject.mppobject
Class MPPExecutionObject

java.lang.Object
  extended bywt.projmgmt.msproject.mppobject.MPPObject
      extended bywt.projmgmt.msproject.mppobject.MPPExecutionObject
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
MPPPlan, MPPTask

public abstract class MPPExecutionObject
extends MPPObject

An object that represents data from a Microsoft Project Plan Object. An object is a task, resource or assignment. These object all have a UID attribute.


Field Summary
private  Collection children
           
private  int constraintType
           
private  boolean isDataRolledUp
           
private  ProjectHealthStatus rolledUpHealthStatus
           
 
Fields inherited from class wt.projmgmt.msproject.mppobject.MPPObject
 
Constructor Summary
MPPExecutionObject()
           
 
Method Summary
protected  void addChild(MPPTask child)
          Add a task to this object's collection of children.
protected  Timestamp alignTime(Timestamp stamp, boolean nextDay)
          Return the Timestamp that represents midnight in the specified TimeZone specified by this object's ImportInfo on the same day as the specified timestamp or on the day following the specified timestamp depending on the value of nextDay.
protected  Timestamp alignTime(Timestamp stamp, boolean nextDay, boolean bAllowNonWorking)
          Return the Timestamp that represents midnight in the specified TimeZone specified by this object's ImportInfo on the same day as the specified timestamp or on the day following the specified timestamp depending on the value of nextDay.
protected  void doDataRollUp()
          Roll up data from this object's contained objects.
 Currency getActualCost()
          Return the Actual Cost for this execution object that is defined in the XML.
 Work getActualWork()
          Return the Actual Work for this execution object that is defined in the XML.
 Timestamp getAlignedDeadline()
          Return the deadline that is aligned properly with the day boundary.
 TimeToElapse getAlignedDuration()
          Return the duration that is computed based on the alignd timeToStart and the aligned .
 Timestamp getAlignedEstimatedFinishDate()
          Return the estimatedFinishDate that is aligned properly with the day boundary.
 Timestamp getAlignedTimeToStart()
          Return the timeToStart that is aligned properly with the day boundary.
abstract  ProjectCategory getCategory()
          Get the category for this execution object that is specified in the XML.
 Collection getChildren()
          Get this object's child tasks.
 Timestamp getConstraintDate()
          Return the constraint date for the constraint that has been applied to this object if one exists.
 int getConstraintType()
          Get the ConstraintType of any constraint that has been applied to this task.
 Currency getCost()
          Return the Cost for this execution object that is defined in the XML.
 TimeToElapse getDuration()
          Return the duration for this execution object that is defined in the XML.
 long getElapsedDuration()
          Return the elapsed duration for this execution object that is defined in the XML.
 Timestamp getEstimatedFinishDate()
          Return the estimatedFinishDate for this execution object.
 ExecutionObject getExecutionObject()
          Get the persistable ExecutionObject that this object corresponds to.
 ProjectState getExecutionState()
          Get the ProjectState for this object that is specified in the XML.
 ProjectHealthStatus getHealthStatus()
          Get the ProjectHealthStatus for this object that is specified in the XML.
 WTPrincipal getOwner()
          Get the owner of this execution object that is specified in the XML.
 Long getPercentComplete()
          Return the Percent Complete for this execution object that is defined in the XML.
 Long getPercentWorkComplete()
          Return the Percent Work Complete for this execution object that is defined in the XML.
 String getRiskDescription()
          Get the risk description for this object that is specified in the XML.
 ProjectRiskValue getRiskValue()
          Get the ProjectRiskValue for this object that is specified in the XML.
 ProjectHealthStatus getRolledUpHealthStatus()
          Get the health status that is rolled up from this object's contained objects.
 String getStatusDescription()
          Get the health status for this object that is specified in the XML.
 Timestamp getTimeToStart()
          Return the timeToStart for this execution object that is defined in the XML.
protected  WTUser getUser(String fullName, String email)
          Get a WTUser based on the specified fullName and email.
 Work getWork()
          Return the Work for this execution object that is defined in the XML.
 double getWorkingDays()
          Return the duration for this execution object that is defined in the XML.
protected  boolean isCreateTasksMode()
          Return true if the plan is in create tasks mode.
protected  boolean isManualExecutionMode()
          Return true if the plan is in manual execution mode.
protected abstract  boolean isOwnable()
          Return true if the ownership of this object should be assigned to the owner specified in the XML.
abstract  boolean isRollUpCost()
          Return true if the total cost and actual cost of this task are rolled-up.
abstract  boolean isRollUpFinishDate()
          Return true if the estimated finish date of this task is rolled-up.
abstract  boolean isRollUpPercentComplete()
          Return true if the percent complete of this task is rolled-up.
protected  boolean isRollUpRequired()
          Return whether or not dat has been rolled up from this object's contained objects.
 boolean isRollUpStatus()
          Return true if the health status of this task is rolled-up.
abstract  boolean isRollUpWork()
          Return true if the total work and actual work of this task are rolled-up.
abstract  boolean isStartAtEndOfDay()
          Returns true if the the object should start at the end of the working day instead of at the beginning.
 boolean isStartComputed()
          Return true if the planned start date of this task is computed.
protected  boolean isTrackCostsMode()
          Return true if the plan is in track project costs mode.
protected  boolean isValidPersistable(Persistable p)
          Make sure that the specified Persistable is of the right type for this object.
protected  boolean isValidUpdateState(ProjectState state)
          Returns true if the specified ProjectState is a state that allows updates.
protected  Timestamp parseXSDDateTime(String dateTime)
          Parse the specified xsd:dateTime string using the default time zone specified in the ImportInfo.
protected  void printNoUpdate(String key, ProjectState state)
          Print out a message indicating that an attribute cannot be updated because the object is not in a valid update state.
protected  void rollUpData()
          Roll up data from this object's contained objects.
protected  void setRolledUpHealthStatus(ProjectHealthStatus status)
           
protected  ExecutionObject updateCost(ExecutionObject exObj)
          Update the total cost and current cost of the specified ExecutionObject.
protected  ExecutionObject updateExecutionObject(ExecutionObject exObj)
          Update the values that are specific to ExecutionObjects.
protected  ExecutionObject updateName(ExecutionObject exObj)
          Update the name of the specified ExecutionObject.
 Persistable updatePersistable(Persistable p)
          Update values on the ExecutionObject based on the data in this MPPExecutionObject.
protected  WfExecutionObject updateTimeToStart(WfExecutionObject exObj)
          Update the timeToStart of this WfExecutionObject.
protected  WfExecutionObject updateWfExecutionObject(WfExecutionObject exObj)
          Update the values that are specific to WfExecutionObjects.
protected  ExecutionObject updateWork(ExecutionObject exObj)
          Update the percent complete, total work and performed work of the specified ExecutionObject.
 
Methods inherited from class wt.projmgmt.msproject.mppobject.MPPObject
compareTo, containsKey, createPersistable, entrySet, get, getCurrentDate, getGenericName, getID, getImportInfo, getName, getNameElement, getObjectIdentifier, getPersistable, getPersistableClass, getPersistableID, getPlan, getProjectPlan, getUID, isContainer, keySet, print, printImpl, printMsg, printNoUpdate, printNoUpdate, printRollUp, printUpdate, printUpdate, put, refreshPersistable, savePersistable, setID, setPersistable, setPlan, toString, updatePersistableCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

constraintType

private int constraintType

rolledUpHealthStatus

private ProjectHealthStatus rolledUpHealthStatus

isDataRolledUp

private boolean isDataRolledUp

children

private final Collection children
Constructor Detail

MPPExecutionObject

public MPPExecutionObject()
Method Detail

getConstraintType

public final int getConstraintType()
Get the ConstraintType of any constraint that has been applied to this task.


getConstraintDate

public final Timestamp getConstraintDate()
Return the constraint date for the constraint that has been applied to this object if one exists. Otherwise return null.


getTimeToStart

public final Timestamp getTimeToStart()
Return the timeToStart for this execution object that is defined in the XML. If the start date is constrained then return the constraint date. Otherwise, just return the start date.


getAlignedTimeToStart

public final Timestamp getAlignedTimeToStart()
Return the timeToStart that is aligned properly with the day boundary.

See Also:
getTimeToStart()

getDuration

public final TimeToElapse getDuration()
Return the duration for this execution object that is defined in the XML. This duration is "normalized" to working days instead of the working hours that is actually reported in the XML.


getAlignedDuration

public final TimeToElapse getAlignedDuration()
                                      throws WTException
Return the duration that is computed based on the alignd timeToStart and the aligned .

Throws:
WTException
See Also:
getAlignedTimeToStart(), getAlignedEstimatedFinishDate()

getWorkingDays

public final double getWorkingDays()
                            throws WTException
Return the duration for this execution object that is defined in the XML. The number of working days is returned.

Throws:
WTException

getElapsedDuration

public final long getElapsedDuration()
Return the elapsed duration for this execution object that is defined in the XML. This duration is the amount of calendar time that exists between the timeToStart and the estimatedFinishDate.

Returns:
the duration in milliseconds

getEstimatedFinishDate

public final Timestamp getEstimatedFinishDate()
Return the estimatedFinishDate for this execution object. This is always equal to the timeToStart plus the elapsedDuration between the start and end dates that are reported in the XML.

See Also:
getTimeToStart(), getElapsedDuration()

getAlignedEstimatedFinishDate

public final Timestamp getAlignedEstimatedFinishDate()
Return the estimatedFinishDate that is aligned properly with the day boundary.

See Also:
getEstimatedFinishDate()

getAlignedDeadline

public final Timestamp getAlignedDeadline()
Return the deadline that is aligned properly with the day boundary.


getPercentComplete

public final Long getPercentComplete()
Return the Percent Complete for this execution object that is defined in the XML.


getPercentWorkComplete

public final Long getPercentWorkComplete()
Return the Percent Work Complete for this execution object that is defined in the XML.


getActualWork

public final Work getActualWork()
Return the Actual Work for this execution object that is defined in the XML.


getWork

public final Work getWork()
Return the Work for this execution object that is defined in the XML.


getActualCost

public final Currency getActualCost()
Return the Actual Cost for this execution object that is defined in the XML.


getCost

public final Currency getCost()
Return the Cost for this execution object that is defined in the XML.


isStartComputed

public boolean isStartComputed()
Return true if the planned start date of this task is computed. The start date is computed if one of the following is true:
  1. a constraint has not been placed on the start date, or
  2. a constraint exists but the planned start date is being imported and the planned start date does not equal the constraint date


isStartAtEndOfDay

public abstract boolean isStartAtEndOfDay()
Returns true if the the object should start at the end of the working day instead of at the beginning.


isRollUpFinishDate

public abstract boolean isRollUpFinishDate()
Return true if the estimated finish date of this task is rolled-up.


isRollUpStatus

public boolean isRollUpStatus()
Return true if the health status of this task is rolled-up.


getRolledUpHealthStatus

public final ProjectHealthStatus getRolledUpHealthStatus()
Get the health status that is rolled up from this object's contained objects. This is not necessarily the same as the value that is recorded in the XML.


setRolledUpHealthStatus

protected final void setRolledUpHealthStatus(ProjectHealthStatus status)

isRollUpPercentComplete

public abstract boolean isRollUpPercentComplete()
Return true if the percent complete of this task is rolled-up.


isRollUpWork

public abstract boolean isRollUpWork()
Return true if the total work and actual work of this task are rolled-up.


isRollUpCost

public abstract boolean isRollUpCost()
Return true if the total cost and actual cost of this task are rolled-up.


isRollUpRequired

protected final boolean isRollUpRequired()
Return whether or not dat has been rolled up from this object's contained objects.


rollUpData

protected final void rollUpData()
Roll up data from this object's contained objects.


doDataRollUp

protected void doDataRollUp()
                     throws WTException
Roll up data from this object's contained objects.

This default implementation rolls up status information from this object's children.

Throws:
WTException

isTrackCostsMode

protected final boolean isTrackCostsMode()
Return true if the plan is in track project costs mode. Otherwise, return false.


isCreateTasksMode

protected final boolean isCreateTasksMode()
Return true if the plan is in create tasks mode. Otherwise, return false.


isManualExecutionMode

protected final boolean isManualExecutionMode()
Return true if the plan is in manual execution mode. Otherwise, return false.


getCategory

public abstract ProjectCategory getCategory()
Get the category for this execution object that is specified in the XML.


getOwner

public WTPrincipal getOwner()
                     throws WTException
Get the owner of this execution object that is specified in the XML.

Throws:
WTException

isOwnable

protected abstract boolean isOwnable()
Return true if the ownership of this object should be assigned to the owner specified in the XML.


getRiskValue

public final ProjectRiskValue getRiskValue()
Get the ProjectRiskValue for this object that is specified in the XML.


getRiskDescription

public final String getRiskDescription()
Get the risk description for this object that is specified in the XML.


getHealthStatus

public ProjectHealthStatus getHealthStatus()
Get the ProjectHealthStatus for this object that is specified in the XML.


getStatusDescription

public final String getStatusDescription()
Get the health status for this object that is specified in the XML.


getExecutionState

public final ProjectState getExecutionState()
Get the ProjectState for this object that is specified in the XML.


getExecutionObject

public final ExecutionObject getExecutionObject()
                                         throws WTException
Get the persistable ExecutionObject that this object corresponds to.

Throws:
WTException
See Also:
wt.projmgmt.msproject.mppobject.MPPThing#getPersistable

isValidUpdateState

protected final boolean isValidUpdateState(ProjectState state)
Returns true if the specified ProjectState is a state that allows updates. Otherwise returns false.


getChildren

public final Collection getChildren()
Get this object's child tasks.


addChild

protected final void addChild(MPPTask child)
Add a task to this object's collection of children.

Parameters:
child - the child to be added

updatePersistable

public Persistable updatePersistable(Persistable p)
                              throws WTException,
                                     WTPropertyVetoException
Update values on the ExecutionObject based on the data in this MPPExecutionObject.

Subclass should call super.updatePersistable if they override this method so that the ExecutionObject and WfExecutionObject attributes are updated.

Specified by:
updatePersistable in class MPPObject
Throws:
WTException
WTPropertyVetoException

isValidPersistable

protected boolean isValidPersistable(Persistable p)
                              throws WTException
Description copied from class: MPPObject
Make sure that the specified Persistable is of the right type for this object. Return false if null is passed to the method.

This class's implementation of this method ensures that the perisitable is in the right ProjectPlan. Subclasses that override this method should be sure to make a call to super so that this code is executed.

Overrides:
isValidPersistable in class MPPObject
Throws:
WTException

updateExecutionObject

protected final ExecutionObject updateExecutionObject(ExecutionObject exObj)
                                               throws WTException
Update the values that are specific to ExecutionObjects. These include the following values:

Throws:
WTException

updateWfExecutionObject

protected final WfExecutionObject updateWfExecutionObject(WfExecutionObject exObj)
                                                   throws WTException
Update the values that are specific to WfExecutionObjects. These include the following values:

Throws:
WTException

updateTimeToStart

protected WfExecutionObject updateTimeToStart(WfExecutionObject exObj)
Update the timeToStart of this WfExecutionObject. The following two values are updated:

Parameters:
exObj - the object to update

updateName

protected ExecutionObject updateName(ExecutionObject exObj)
                              throws WTException
Update the name of the specified ExecutionObject.

Throws:
WTException

updateWork

protected ExecutionObject updateWork(ExecutionObject exObj)
                              throws WTException
Update the percent complete, total work and performed work of the specified ExecutionObject.

Throws:
WTException

updateCost

protected ExecutionObject updateCost(ExecutionObject exObj)
                              throws WTException
Update the total cost and current cost of the specified ExecutionObject.

Throws:
WTException

printNoUpdate

protected final void printNoUpdate(String key,
                                   ProjectState state)
Print out a message indicating that an attribute cannot be updated because the object is not in a valid update state.

Parameters:
key - the name of the attribute that cannot be updated
state - the execution object's state

getUser

protected final WTUser getUser(String fullName,
                               String email)
                        throws WTException
Get a WTUser based on the specified fullName and email. If both fullName and email are null then null is returned. The user to returned is determined using the following precedence rules:
  1. the user linked with the person resource whose name is fullName
  2. the user linked with the person resource whose name is formed by appending @ to the fullName
  3. the user returned by Utils.getUser(java.lang.String, java.lang.String)

If multiple users are considered equal based on the precedence rules then the first user found in the database is returned.

Parameters:
fullName - the full name of the user or null
email - the email address of the user or null
Returns:
a user or null
Throws:
WTException

parseXSDDateTime

protected final Timestamp parseXSDDateTime(String dateTime)
Parse the specified xsd:dateTime string using the default time zone specified in the ImportInfo.

Parameters:
dateTime - a date and time in xsd:dateTime format
Returns:
a Timestamp or null

alignTime

protected final Timestamp alignTime(Timestamp stamp,
                                    boolean nextDay,
                                    boolean bAllowNonWorking)
Return the Timestamp that represents midnight in the specified TimeZone specified by this object's ImportInfo on the same day as the specified timestamp or on the day following the specified timestamp depending on the value of nextDay.

If nextDay is true then midnight on the next day is returned. Otherwise, midnight on the same day is returned.

Parameters:
stamp - the original timestamp
bAllowNonWorking - whether to allow a non working day or not

alignTime

protected final Timestamp alignTime(Timestamp stamp,
                                    boolean nextDay)
Return the Timestamp that represents midnight in the specified TimeZone specified by this object's ImportInfo on the same day as the specified timestamp or on the day following the specified timestamp depending on the value of nextDay.

If nextDay is true then midnight on the next day is returned. Otherwise, midnight on the same day is returned.

Parameters:
stamp - the original timestamp