wt.projmgmt.resource
Class StandardProjResourceService

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.projmgmt.resource.StandardProjResourceService
All Implemented Interfaces:
Manager, NetFactor, ProjResourceService, ProjResourceServiceSvr, Serializable

public class StandardProjResourceService
extends StandardManager
implements ProjResourceService, ProjResourceServiceSvr, Serializable

The StandardProjResourceService class contains the standard implementation of both remotely and server accessible API.

This service is a light-weight service and depends on the wt.projmgmt.StandardProjMgmtService for dispatching and capturing events.

Use the newStandardProjResourceService static factory method(s), not the StandardProjResourceService constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: false

Extendable: false

See Also:
ProjResourceService, ProjResourceServiceSvr, ProjMgmtService, Serialized Form

Field Summary
private static String CLASSNAME
           
private static String MONITOR_RESOURCE
           
private static String RESOURCE
           
private static boolean VERBOSE
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardProjResourceService()
           
 
Method Summary
 ProjectActivity addResources(ProjectActivity act, Vector resources, Vector max_units)
          Add the resources to the ProjectActivity.
private  boolean changeAllocation(ProjectActivity activity)
          Determines whether the resource allocation for an activity should be changed.
 ProjectActivity changeResource(ProjectActivity projectActivity, ProjectResource old_resource, ProjectResource new_resource)
          This method replaces one ProjectResource with another ProjectResource in a ProjectActivity.
 ProjectResource changeResourceCost(ProjectResource resource, Currency use, CurrencyRate std, CurrencyRate ovt)
          Changes cost properties of the ProjectResource passed as argument.
 Currency computeActivityCost(ProjectActivity activity, Work work)
          Computes the current cost for a project activity (@link wt.projmgtm.executionProjectActivity}) for a given work.
private  int computeAllocation(ProjectActivity activity, Vector resources)
          Computes allocation for an activity with n resources.
 double computeCurrentCost(ProjectActivity activity, Timestamp time)
          Returns current cost accrued by the activity due to use of material, equipment and facilities.
 Currency computeInitialWorkCost(ProjectActivity activity)
          Returns the initial work cost for a given activity.
private  Work computePerformedWork(ProjectActivity activity, PersonResource resource)
          Computes the work spent by a person resource in an activity without work items.
 double computeTotalCost(ProjectActivity activity)
          Returns total cost to be accrued by the activity due to use of material, equipment and facilities.
private  Work computeTotalWork(ProjectActivity activity, PersonResource resource)
          Computes the work spent by a person resource in an activity without work items.
 Currency computeWorkItemCost(ProjectWorkItem item, Work standard_work, Work overtime_work)
          Computes the current cost for a project work item given the current standard work and the current overtime work.
protected  PersonResource createPersonResource(ProjectPlan plan, WTPrincipalReference princ_ref)
           
 QueryResult createPersonResources(ProjectPlan plan, Vector assignees)
          Creates person resources for a list of WTUser passed as argument.
 void delegate(ProjectWorkItem workItem, WTPrincipal principal)
          Changes the owner of the ProjectWorkItem to user passed as argument.
 void deleteContainedObjects(ProjectPlan plan)
          Delete all resources objects contained in the plan passed as argument.
 ProjectActivity getActivityHolder(Deliverable deliverable)
          Returns the ProjectActivity that holds the Deliverable passed as argument.
private  QueryResult getActivityHolders(ProjectResource resource)
           
 QueryResult getActivityResources(ProjectActivity activity)
          Return all enabled ProjectResource associated with a given ProjectActivity.
 QueryResult getAllActivityResources(ProjectActivity activity)
          Return all enabled and disabled ProjectResource objects associated with a given ProjectActivity.
 QueryResult getAllProjectResources(ProjectPlan plan)
          Return all enabled and disabled ProjectResource associated with a given ProjectPlan passed as arguent.
 QueryResult getAllResourceAssignments(ProjectPlan plan, ResourceHolder holder, ProjectResource resource)
          Returns resource assignments (ResourceAssignmentLink) for a ProjectPlan, ResourceHolder, and ProjectResource passed as arguments.
 QueryResult getAssignees(ProjectActivity activity)
          Returns the assignees for the activity passed as argument.
private  QueryResult getAssignments(ProjectPlan plan, ResourceHolder holder, ProjectResource resource, boolean only_enabled)
           
 String getConceptualClassname()
          Deprecated.  
protected  double getCurrentAssignmentUnits(QueryResult assignments, Timestamp time)
           
 Currency getCurrentCost(ExecutionObject exec_obj, Timestamp time)
          Returns the total cost incurred in the execution of the object up to the time passed as argument.
 Currency getCurrentCost(ProjectResource resource, ProjectActivity activity, Timestamp time)
          Returns the current cost spent by a ProjectResource in a ProjectActivity up to the time passed as argument.
 Currency getCurrentResourceCost(ProjectResource resource, Timestamp time)
          Returns the cost spent so far for a given ProjectResource in the plan up to the time passed as argument.
 double getCurrentResourceUnits(ProjectResource resource, Timestamp time)
          Returns the number of resources (units) consumed so far for a given ProjectResource in the plan up to the time passed as argument.
 double getCurrentUnits(ProjectResource resource, ProjectActivity activity, Timestamp time)
          Returns the current units spent by a ProjectResource in a ProjectActivity up to the time passed as argument.
protected  int getCurrentUses(QueryResult assignments)
           
 QueryResult getDeliverables(ExecutionObject exec_obj)
          Returns all Deliverables associated to n {@link wt.projmgmt.execution.
 QueryResult getDeliverables(WTUser user)
          Returns all Deliverable objects owner by the WTUser passed as argument.
private  TimeToElapse getDuration(ExecutionObject exec_obj, Timestamp time)
          Returns a how long has elapsed since the execution object started.
private  double getHours(TimeToElapse duration)
          Returns a how long has elapsed since the execution object started.
private  String getIdString(Object obj)
           
 QueryResult getMilestoneHolders(Deliverable deliverable)
          Returns a list of Milestone that hold for the Deliverable passed as argument.
private  ObjectIdentifier getOid(Object obj)
           
private  PersonResource getPersonResource(ProjectPlan plan, WTPrincipalReference user_ref)
           
 PersonResource getPersonResource(ProjectPlan plan, WTUser person)
          Returns the PersonResource for a plan given a WTUser.
private  PersonResource getPersonResource(ProjectPlan plan, WTUser replacedUser, WTUser newUser)
           
private  String getPersonResourceName(WTPrincipalReference pRef)
          Get a default name to use for a person resoure based on the principal referenced by the resource.
 QueryResult getProjectPlanDeliverables(ProjectPlan plan)
          Returns project plan deliverables for a given ProjectPlan.
private  ProjectResource getProjectResource(ProjectPlan plan, Object res_obj)
          Returns a project resource.
 QueryResult getProjectResources(ProjectPlan plan)
          Return all enabled ProjectResource associated with a given ProjectPlan passed as argument.
 ProjectResource getResource(ProjectPlan plan, String resource_name)
          Returns a ProjectResource given the host ProjectPlan and the resource name.
 QueryResult getResourceAssignments(ProjectPlan plan, ResourceHolder holder, ProjectResource resource)
          Returns resource assignments (ResourceAssignmentLink) for a ProjectPlan, ResourceHolder, and ProjectResource passed as arguments.
private  Work getResourcePerformedWork(PersonResource resource, ProjectActivity activity)
          Computes the work spent by a person resource in an activity.
private  QueryResult getResources(ProjectActivity activity, boolean only_enabled)
           
private  QueryResult getResources(ProjectPlan plan, boolean only_enabled)
          Returns resources for a given plan.
private  Work getResourceTotalWork(PersonResource resource, ProjectActivity activity)
          Computes the work spent by a person resource in an activity.
private  Timestamp getStart(ExecutionObject exec_obj)
           
 QueryResult getSummaryDeliverables(SummaryActivity summary)
           
protected  double getTotalAssignmentUnits(QueryResult assignments)
           
 Currency getTotalCost(ExecutionObject exec_obj)
          Returns the total cost incurred in the execution of the object passed as argument.
 Currency getTotalCost(ProjectResource resource, ProjectActivity activity)
          Returns the total cost to be spent by a ProjectResource in a ProjectActivity.
 Currency getTotalResourceCost(ProjectResource resource)
          Returns the total cost for a given ProjectResource in the ProjectPlan that contains the resource This method may return a non-zero value only for CostResource objects.
 double getTotalResourceUnits(ProjectResource resource)
          Returns the total resources (or units) to be spent for a given ProjectResource.
 double getTotalUnits(ProjectResource resource, ProjectActivity activity)
          Returns the total units to be spent by a ProjectResource.
 QueryResult getUnboundProjectPlanDeliverables(ProjectPlan plan)
          Returns unbound project plan deliverables for a given ProjectPlan.
protected  QueryResult getUserDeliverables(ProjectPlan plan, WTUser user)
           
 QueryResult getUserDeliverables(WTUser user, ProjectPlan plan, ProjectState state)
          Returns all Deliverable that belong to a given WTUser.
 QueryResult getUserDeliverables(WTUser user, ProjectPlan plan, ProjectState state, Integer queryLimit, String orderByStr)
          Returns all Deliverable that belong to a given WTUser.
private  boolean isUnoverride(ProjectActivity activity)
          Determines whether there is a need to possibly un-override attribute roll up flags.
static StandardProjResourceService newStandardProjResourceService()
          Default factory for the class.
 ProjectActivity removeResources(ProjectActivity act, Vector resources)
          Removes the resource assignments (ResourceAssignmentLink) that correspond to the ProjectActivity.and ProjectResources passed as arguments.
 void replaceUser(WTContainer container, WTUser replacedUser, WTUser newUser)
          Replaces the replaced user with the new user for resource objects.
 void setMilestones(Deliverable deliverable, Vector milestones)
          Adds the Deliverable to each be contained in each Milestone passed as argument as a list.
 ProjectActivity setResources(ProjectActivity act, Vector resources, Vector max_units)
          Sets initial ProjectResources for a ProjectActivity, given the resources and associated maximum units.
 Deliverable setTarget(Deliverable deliverable, Persistable target, boolean latest)
          Sets the target of a Deliverable as the Persistable passed as argument.
private  String showVector(Vector objs)
          Returns a comma separated list of the objects in the Vector.
private  ProjectActivity unoverride(ProjectActivity activity)
          Unoverrides roll up flags.
 void updateResourceAllocation(ExecutionObject exec_obj)
          Updates the resource allocation for a project work item or a project activity.
 ProjectActivity updateResources(ProjectActivity act, Vector resources, Vector max_units)
          Updates project resources for an activity, given the resources and associated maximum units.
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, performStartupProcess, registerEvents, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

VERBOSE

private static final boolean VERBOSE

MONITOR_RESOURCE

private static final String MONITOR_RESOURCE
Constructor Detail

StandardProjResourceService

public StandardProjResourceService()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

newStandardProjResourceService

public static StandardProjResourceService newStandardProjResourceService()
                                                                  throws WTException
Default factory for the class.

Supported API: false

Returns:
StandardProjResourceService
Throws:
WTException

addResources

public ProjectActivity addResources(ProjectActivity act,
                                    Vector resources,
                                    Vector max_units)
                             throws WTException
Add the resources to the ProjectActivity. The resources and their corresponding maximum units are given as two lists (Vector) of ProjectResource and Integer, respectively. If the resource assignment already exists and if the current maximum units resources is the same as the maximum units resources passed as argument nothing happens. Otherwise the maximum units that differ are updated.

Supported API: false

Specified by:
addResources in interface ProjResourceService
Parameters:
act -
resources -
max_units -
Returns:
ProjectActivity
Throws:
WTException

changeResource

public ProjectActivity changeResource(ProjectActivity projectActivity,
                                      ProjectResource old_resource,
                                      ProjectResource new_resource)
                               throws WTException
This method replaces one ProjectResource with another ProjectResource in a ProjectActivity.

Supported API: false

Specified by:
changeResource in interface ProjResourceService
Parameters:
projectActivity -
old_resource -
new_resource -
Returns:
ProjectActivity
Throws:
WTException

changeResourceCost

public ProjectResource changeResourceCost(ProjectResource resource,
                                          Currency use,
                                          CurrencyRate std,
                                          CurrencyRate ovt)
                                   throws WTException
Changes cost properties of the ProjectResource passed as argument. For PersonResource objects the method propagates changes as they affect work cost.

Supported API: false

Specified by:
changeResourceCost in interface ProjResourceService
Parameters:
resource -
use -
std -
ovt -
Returns:
ProjectResource
Throws:
WTException

createPersonResources

public QueryResult createPersonResources(ProjectPlan plan,
                                         Vector assignees)
                                  throws WTException
Creates person resources for a list of WTUser passed as argument. Returns the list of PersonResource just created. A resource is created for a specific user only if it doesn't exist already.

Supported API: false

Specified by:
createPersonResources in interface ProjResourceService
Parameters:
plan -
assignees -
Returns:
QueryResult
Throws:
WTException

delegate

public void delegate(ProjectWorkItem workItem,
                     WTPrincipal principal)
              throws WTException
Changes the owner of the ProjectWorkItem to user passed as argument. Updates the resource assignment and calls the workflow method of the same name in the work service.

Supported API: false

Specified by:
delegate in interface ProjResourceService
Parameters:
workItem -
principal -
Throws:
WTException

getActivityHolder

public ProjectActivity getActivityHolder(Deliverable deliverable)
                                  throws WTException
Returns the ProjectActivity that holds the Deliverable passed as argument. Returns 'null' if deliverable is not held by any activity.

Supported API: false

Specified by:
getActivityHolder in interface ProjResourceService
Parameters:
deliverable -
Returns:
ProjectActivity
Throws:
WTException

getActivityResources

public QueryResult getActivityResources(ProjectActivity activity)
                                 throws WTException
Return all enabled ProjectResource associated with a given ProjectActivity.

Supported API: false

Specified by:
getActivityResources in interface ProjResourceService
Parameters:
activity -
Returns:
QueryResult
Throws:
WTException

getAllActivityResources

public QueryResult getAllActivityResources(ProjectActivity activity)
                                    throws WTException
Return all enabled and disabled ProjectResource objects associated with a given ProjectActivity.

Supported API: false

Specified by:
getAllActivityResources in interface ProjResourceService
Parameters:
activity -
Returns:
QueryResult
Throws:
WTException

getAllProjectResources

public QueryResult getAllProjectResources(ProjectPlan plan)
                                   throws WTException
Return all enabled and disabled ProjectResource associated with a given ProjectPlan passed as arguent.

Supported API: false

Specified by:
getAllProjectResources in interface ProjResourceService
Parameters:
plan -
Returns:
QueryResult
Throws:
WTException

getAllResourceAssignments

public QueryResult getAllResourceAssignments(ProjectPlan plan,
                                             ResourceHolder holder,
                                             ProjectResource resource)
                                      throws WTException
Returns resource assignments (ResourceAssignmentLink) for a ProjectPlan, ResourceHolder, and ProjectResource passed as arguments. If the resource holder is not null, only resource assignments for the holder are returned. Similarly, if the resource is not null, only assignments for the given resource are returned. If the resource is null, assignments for both enabled and disabled resources are returned.

Supported API: false

Specified by:
getAllResourceAssignments in interface ProjResourceService
Parameters:
plan -
holder -
resource -
Returns:
QueryResult
Throws:
WTException

getAssignees

public QueryResult getAssignees(ProjectActivity activity)
                         throws WTException
Returns the assignees for the activity passed as argument. If the activity is running, returns the actual workitem owners, otherwise returns the principal assignees from the activity template.

Supported API: false

Specified by:
getAssignees in interface ProjResourceService
Parameters:
activity -
Returns:
QueryResult
Throws:
WTException

getCurrentCost

public Currency getCurrentCost(ExecutionObject exec_obj,
                               Timestamp time)
                        throws WTException
Returns the total cost incurred in the execution of the object up to the time passed as argument. Implemented only for ProjectActivity, SummaryActivity, ProjectProxy and ProjectPlan.

Supported API: false

Specified by:
getCurrentCost in interface ProjResourceService
Parameters:
exec_obj -
time -
Returns:
Currency
Throws:
WTException

getCurrentCost

public Currency getCurrentCost(ProjectResource resource,
                               ProjectActivity activity,
                               Timestamp time)
                        throws WTException
Returns the current cost spent by a ProjectResource in a ProjectActivity up to the time passed as argument.

Supported API: false

Specified by:
getCurrentCost in interface ProjResourceService
Parameters:
resource -
activity -
time -
Returns:
Currency
Throws:
WTException

getCurrentResourceCost

public Currency getCurrentResourceCost(ProjectResource resource,
                                       Timestamp time)
                                throws WTException
Returns the cost spent so far for a given ProjectResource in the plan up to the time passed as argument. This method may return a non-zero value only for CostResource objects. For non-cost resources this method returns 0.0.

The current cost for a single activity is the cost per use plus a cost that depends on the type of the resource, as follows.



Supported API: false

Specified by:
getCurrentResourceCost in interface ProjResourceService
Parameters:
resource -
time -
Returns:
Currency
Throws:
WTException

getCurrentResourceUnits

public double getCurrentResourceUnits(ProjectResource resource,
                                      Timestamp time)
                               throws WTException
Returns the number of resources (units) consumed so far for a given ProjectResource in the plan up to the time passed as argument.

Supported API: false

Specified by:
getCurrentResourceUnits in interface ProjResourceService
Parameters:
resource -
time -
Returns:
double
Throws:
WTException

getCurrentUnits

public double getCurrentUnits(ProjectResource resource,
                              ProjectActivity activity,
                              Timestamp time)
                       throws WTException
Returns the current units spent by a ProjectResource in a ProjectActivity up to the time passed as argument.

Supported API: false

Specified by:
getCurrentUnits in interface ProjResourceService
Parameters:
resource -
activity -
time -
Returns:
double
Throws:
WTException

getDeliverables

public QueryResult getDeliverables(ExecutionObject exec_obj)
                            throws WTException
Returns all Deliverables associated to n ExecutionObject . If the execution object is a deliverable holder (milestone or project activity) it navigates the deliverable holding association. If it is a project plan, it returns all deliverables in the plan. If it is a summary activity, it returns all deliverables held by objects contained in the summary. Otherwise an empty list is returned. Only enabled deliverables are returned.

Supported API: false

Specified by:
getDeliverables in interface ProjResourceService
Parameters:
exec_obj -
Returns:
QueryResult
Throws:
WTException
See Also:
wt.projmgmtexecution.Milestone, wt.projmgmtexecution.ProjectActivity, wt.projmgmtexecution.ProjectPlan, wt.projmgmtexecution.ProjectProxy, wt.projmgmtexecution.SummaryActivity, Deliverable, DeliverableHolder

getDeliverables

public QueryResult getDeliverables(WTUser user)
                            throws WTException
Returns all Deliverable objects owner by the WTUser passed as argument. Only deliverables belonging to running projects are returned. The user passed as argument can not be 'null'

Supported API: false

Specified by:
getDeliverables in interface ProjResourceService
Parameters:
user -
Returns:
QueryResult
Throws:
WTException

getMilestoneHolders

public QueryResult getMilestoneHolders(Deliverable deliverable)
                                throws WTException
Returns a list of Milestone that hold for the Deliverable passed as argument.

Supported API: false

Specified by:
getMilestoneHolders in interface ProjResourceService
Parameters:
deliverable -
Returns:
QueryResult
Throws:
WTException

getPersonResource

public PersonResource getPersonResource(ProjectPlan plan,
                                        WTUser person)
                                 throws WTException
Returns the PersonResource for a plan given a WTUser.

Supported API: false

Specified by:
getPersonResource in interface ProjResourceService
Parameters:
plan -
person -
Returns:
PersonResource
Throws:
WTException

getProjectResources

public QueryResult getProjectResources(ProjectPlan plan)
                                throws WTException
Return all enabled ProjectResource associated with a given ProjectPlan passed as argument.

Supported API: false

Specified by:
getProjectResources in interface ProjResourceService
Parameters:
plan -
Returns:
QueryResult
Throws:
WTException

getResource

public ProjectResource getResource(ProjectPlan plan,
                                   String resource_name)
                            throws WTException
Returns a ProjectResource given the host ProjectPlan and the resource name. Returns 'null' if this resource can't be found.

Supported API: false

Specified by:
getResource in interface ProjResourceService
Parameters:
plan -
resource_name -
Returns:
ProjectResource
Throws:
WTException

getResourceAssignments

public QueryResult getResourceAssignments(ProjectPlan plan,
                                          ResourceHolder holder,
                                          ProjectResource resource)
                                   throws WTException
Returns resource assignments (ResourceAssignmentLink) for a ProjectPlan, ResourceHolder, and ProjectResource passed as arguments. If the resource holder is not null, only resource assignments for the holder are returned. Similarly, if the resource is not null, only assignments for the given resource are returned. If the resource is null, assignments for only enabled are returned.

Supported API: false

Specified by:
getResourceAssignments in interface ProjResourceService
Parameters:
plan -
holder -
resource -
Returns:
QueryResult
Throws:
WTException

getTotalCost

public Currency getTotalCost(ExecutionObject exec_obj)
                      throws WTException
Returns the total cost incurred in the execution of the object passed as argument. Implemented only for ProjectActivity, SummaryActivity, ProjectProxy and ProjectPlan.

Supported API: false

Specified by:
getTotalCost in interface ProjResourceService
Parameters:
exec_obj -
Returns:
Currency
Throws:
WTException

getTotalCost

public Currency getTotalCost(ProjectResource resource,
                             ProjectActivity activity)
                      throws WTException
Returns the total cost to be spent by a ProjectResource in a ProjectActivity.

Supported API: false

Specified by:
getTotalCost in interface ProjResourceService
Parameters:
resource -
activity -
Returns:
Currency
Throws:
WTException

getTotalResourceCost

public Currency getTotalResourceCost(ProjectResource resource)
                              throws WTException
Returns the total cost for a given ProjectResource in the ProjectPlan that contains the resource This method may return a non-zero value only for CostResource objects. For non-cost resources this method returns 0.0.

The total cost for a single activity is the cost per use plus a cost that depends on the type of the resource, as follows.



Supported API: false

Specified by:
getTotalResourceCost in interface ProjResourceService
Parameters:
resource -
Returns:
Currency
Throws:
WTException

getTotalResourceUnits

public double getTotalResourceUnits(ProjectResource resource)
                             throws WTException
Returns the total resources (or units) to be spent for a given ProjectResource.

The total units depends on the type of the resource, as follows. It is a sum of the units for each activity in the plan.



Supported API: false

Specified by:
getTotalResourceUnits in interface ProjResourceService
Parameters:
resource -
Returns:
double
Throws:
WTException

getTotalUnits

public double getTotalUnits(ProjectResource resource,
                            ProjectActivity activity)
                     throws WTException
Returns the total units to be spent by a ProjectResource. in a ProjectActivity.

Supported API: false

Specified by:
getTotalUnits in interface ProjResourceService
Parameters:
resource -
activity -
Returns:
double
Throws:
WTException

getUserDeliverables

public QueryResult getUserDeliverables(WTUser user,
                                       ProjectPlan plan,
                                       ProjectState state)
                                throws WTException
Returns all Deliverable that belong to a given WTUser. If the plan passed as argument is 'null', deliverables from all ProjectPlan objects are returned. Only plans in the state (ProjectState) passed as argument are considered. If the state is null, however, all states are considered.

The deliverables are returned ordered by their deadlines (sooner first) and then by their names.

Supported API: false

Specified by:
getUserDeliverables in interface ProjResourceService
Parameters:
user -
plan -
state -
Returns:
QueryResult
Throws:
WTException

removeResources

public ProjectActivity removeResources(ProjectActivity act,
                                       Vector resources)
                                throws WTException
Removes the resource assignments (ResourceAssignmentLink) that correspond to the ProjectActivity.and ProjectResources passed as arguments. This method doesn't remove the resources from the plan just their assignments in the activity.

Supported API: false

Specified by:
removeResources in interface ProjResourceService
Parameters:
act -
resources -
Returns:
ProjectActivity
Throws:
WTException

replaceUser

public void replaceUser(WTContainer container,
                        WTUser replacedUser,
                        WTUser newUser)
                 throws WTException
Replaces the replaced user with the new user for resource objects.

Supported API: false

Specified by:
replaceUser in interface ProjResourceService
Parameters:
container -
replacedUser -
newUser -
Throws:
WTException

setMilestones

public void setMilestones(Deliverable deliverable,
                          Vector milestones)
                   throws WTException
Adds the Deliverable to each be contained in each Milestone passed as argument as a list. Removes the deliverable from all milestones not in the list.

Supported API: false

Specified by:
setMilestones in interface ProjResourceService
Parameters:
deliverable -
milestones -
Throws:
WTException

setResources

public ProjectActivity setResources(ProjectActivity act,
                                    Vector resources,
                                    Vector max_units)
                             throws WTException
Sets initial ProjectResources for a ProjectActivity, given the resources and associated maximum units. Assumes no resources has been set for the activity. To update resources use ProjResourceService.updateResources(wt.projmgmt.execution.ProjectActivity, java.util.Vector, java.util.Vector)

Supported API: false

Specified by:
setResources in interface ProjResourceService
Parameters:
act -
resources -
max_units -
Returns:
ProjectActivity
Throws:
WTException

setTarget

public Deliverable setTarget(Deliverable deliverable,
                             Persistable target,
                             boolean latest)
                      throws WTException
Sets the target of a Deliverable as the Persistable passed as argument. In case of iterated object targets, the association between a deliverable is established between the deliverable and the master if latest is 'true' or with the iteration itself if not.

Supported API: false

Specified by:
setTarget in interface ProjResourceService
Parameters:
deliverable -
target -
latest -
Returns:
Deliverable
Throws:
WTException

updateResources

public ProjectActivity updateResources(ProjectActivity act,
                                       Vector resources,
                                       Vector max_units)
                                throws WTException
Updates project resources for an activity, given the resources and associated maximum units. If the resource assignment already exists and if the total resources is the same as the total resources passed as argument nothing happens. Otherwise the resource total is changed. If an existing resource is not in the list then its assignment is removed.

Supported API: false

Specified by:
updateResources in interface ProjResourceService
Parameters:
act -
resources -
max_units -
Returns:
ProjectActivity
Throws:
WTException

getUserDeliverables

public QueryResult getUserDeliverables(WTUser user,
                                       ProjectPlan plan,
                                       ProjectState state,
                                       Integer queryLimit,
                                       String orderByStr)
                                throws WTException
Returns all Deliverable that belong to a given WTUser. If the plan passed as argument is 'null', deliverables from all ProjectPlan objects are returned. Only plans in the state (ProjectState) passed as argument are considered. If the state is null, however, all states are considered.

The deliverables are returned ordered by their deadlines (sooner first) and then by their names.

Supported API: false

Specified by:
getUserDeliverables in interface ProjResourceService
Parameters:
user -
plan -
state -
queryLimit -
orderByStr -
Returns:
QueryResult
Throws:
WTException

deleteContainedObjects

public void deleteContainedObjects(ProjectPlan plan)
                            throws WTException
Delete all resources objects contained in the plan passed as argument.

Supported API: false

Specified by:
deleteContainedObjects in interface ProjResourceServiceSvr
Parameters:
plan -
Throws:
WTException

computeWorkItemCost

public Currency computeWorkItemCost(ProjectWorkItem item,
                                    Work standard_work,
                                    Work overtime_work)
                             throws WTException
Computes the current cost for a project work item given the current standard work and the current overtime work. For pro-rated resources, the cost is computed by extracting the rates (standard and overtime) for the owner of the item, multiplying them by the current work and adding the cost-per-use of the resource.

Supported API: false

Specified by:
computeWorkItemCost in interface ProjResourceServiceSvr
Parameters:
item -
standard_work -
overtime_work -
Returns:
Currency
Throws:
WTException
See Also:
Work, Currency, CurrencyRate

computeActivityCost

public Currency computeActivityCost(ProjectActivity activity,
                                    Work work)
                             throws WTException
Computes the current cost for a project activity (@link wt.projmgtm.executionProjectActivity}) for a given work. Computes the total work cost for an activity and the total work passed as argument. The cost is computed by averaging all standard rates of all person resources assigned to the activity and multiplying by the given work. Also the costs per uses are summed up as well.

This is to used when the activity when the performed or total work is set at the activity level.

Supported API: false

Specified by:
computeActivityCost in interface ProjResourceServiceSvr
Parameters:
activity -
work -
Returns:
Currency
Throws:
WTException
See Also:
Work, Currency, CurrencyRate

computeInitialWorkCost

public Currency computeInitialWorkCost(ProjectActivity activity)
                                throws WTException
Returns the initial work cost for a given activity. The initial work cost is the sum of all cost per uses for all assignees.

Supported API: false

Specified by:
computeInitialWorkCost in interface ProjResourceServiceSvr
Parameters:
activity -
Returns:
Currency
Throws:
WTException

computeTotalCost

public double computeTotalCost(ProjectActivity activity)
                        throws WTException
Returns total cost to be accrued by the activity due to use of material, equipment and facilities. To be added to the cost of person work to give total activity cost.

Supported API: false

Specified by:
computeTotalCost in interface ProjResourceServiceSvr
Parameters:
activity -
Returns:
double
Throws:
WTException

computeCurrentCost

public double computeCurrentCost(ProjectActivity activity,
                                 Timestamp time)
                          throws WTException
Returns current cost accrued by the activity due to use of material, equipment and facilities. To be added to the cost of person work to give total activity cost. The current cost is based on the total number of rsources of the task and the number of days elapsed since the start of the activity.

Supported API: false

Specified by:
computeCurrentCost in interface ProjResourceServiceSvr
Parameters:
activity -
time -
Returns:
double
Throws:
WTException

getProjectPlanDeliverables

public QueryResult getProjectPlanDeliverables(ProjectPlan plan)
                                       throws WTException
Returns project plan deliverables for a given ProjectPlan. A "project deliverable" is a deliverable that has the "projectDeliverable" set to 'true'.

Supported API: false

Specified by:
getProjectPlanDeliverables in interface ProjResourceServiceSvr
Parameters:
plan -
Returns:
QueryResult
Throws:
WTException

getUnboundProjectPlanDeliverables

public QueryResult getUnboundProjectPlanDeliverables(ProjectPlan plan)
                                              throws WTException
Returns unbound project plan deliverables for a given ProjectPlan. A "project deliverable" is a deliverable that has the "projectDeliverable" set to 'true' and is not associated with either a milestone or an activity.

Supported API: false

Specified by:
getUnboundProjectPlanDeliverables in interface ProjResourceServiceSvr
Parameters:
plan -
Returns:
QueryResult
Throws:
WTException

updateResourceAllocation

public void updateResourceAllocation(ExecutionObject exec_obj)
                              throws WTException
Updates the resource allocation for a project work item or a project activity. This is called every time the duration or the total work is changed. The new allocation is computed by the formula: allocation = (100 * work) / (n * duration in days * hour per day) where n is the number of users assigned to the activity or item. For items n = 1.

Supported API: false

Specified by:
updateResourceAllocation in interface ProjResourceServiceSvr
Parameters:
exec_obj -
Throws:
WTException

getResources

private QueryResult getResources(ProjectActivity activity,
                                 boolean only_enabled)
                          throws WTException
Throws:
WTException

changeAllocation

private boolean changeAllocation(ProjectActivity activity)
                          throws WTException
Determines whether the resource allocation for an activity should be changed. Returns 'false' if the activity has tasks; otherwise returns 'true'.

Throws:
WTException

computeAllocation

private int computeAllocation(ProjectActivity activity,
                              Vector resources)
                       throws WTException
Computes allocation for an activity with n resources. The allocation is computed by the formula: allocation = total activity work / (n * activity actual duration * number hours per day)

Throws:
WTException

getAssignments

private QueryResult getAssignments(ProjectPlan plan,
                                   ResourceHolder holder,
                                   ProjectResource resource,
                                   boolean only_enabled)
                            throws WTException
Throws:
WTException

getResources

private QueryResult getResources(ProjectPlan plan,
                                 boolean only_enabled)
                          throws WTException
Returns resources for a given plan.

Throws:
WTException

isUnoverride

private boolean isUnoverride(ProjectActivity activity)
Determines whether there is a need to possibly un-override attribute roll up flags.


unoverride

private ProjectActivity unoverride(ProjectActivity activity)
Unoverrides roll up flags.


getTotalAssignmentUnits

protected double getTotalAssignmentUnits(QueryResult assignments)
                                  throws WTException
Throws:
WTException

getCurrentAssignmentUnits

protected double getCurrentAssignmentUnits(QueryResult assignments,
                                           Timestamp time)
                                    throws WTException
Throws:
WTException

getCurrentUses

protected int getCurrentUses(QueryResult assignments)
                      throws WTException
Throws:
WTException

getUserDeliverables

protected QueryResult getUserDeliverables(ProjectPlan plan,
                                          WTUser user)
                                   throws WTException
Throws:
WTException

createPersonResource

protected PersonResource createPersonResource(ProjectPlan plan,
                                              WTPrincipalReference princ_ref)
                                       throws WTException
Throws:
WTException

getPersonResourceName

private String getPersonResourceName(WTPrincipalReference pRef)
                              throws WTException
Get a default name to use for a person resoure based on the principal referenced by the resource.

Parameters:
pRef - a reference to the person resource's person
Returns:
a default name for the person resource
Throws:
WTException

getSummaryDeliverables

public QueryResult getSummaryDeliverables(SummaryActivity summary)
                                   throws WTException
Throws:
WTException

getPersonResource

private PersonResource getPersonResource(ProjectPlan plan,
                                         WTPrincipalReference user_ref)
                                  throws WTException
Throws:
WTException

getPersonResource

private PersonResource getPersonResource(ProjectPlan plan,
                                         WTUser replacedUser,
                                         WTUser newUser)
                                  throws WTException
Throws:
WTException

getHours

private double getHours(TimeToElapse duration)
                 throws WTException
Returns a how long has elapsed since the execution object started.

Throws:
WTException

getDuration

private TimeToElapse getDuration(ExecutionObject exec_obj,
                                 Timestamp time)
                          throws WTException
Returns a how long has elapsed since the execution object started.

Throws:
WTException

getResourcePerformedWork

private Work getResourcePerformedWork(PersonResource resource,
                                      ProjectActivity activity)
                               throws WTException
Computes the work spent by a person resource in an activity. There are two cases to consider, depending whether or not workitems are generated. If they are, the work performed is extracted from the work items, directly. If not, the work is estimated based on the work performed for the activity and the contribution of each resource assigned to an activity. This contribution is assumed to be proportional to the percentage of time allocated.

Throws:
WTException

computePerformedWork

private Work computePerformedWork(ProjectActivity activity,
                                  PersonResource resource)
                           throws WTException
Computes the work spent by a person resource in an activity without work items.

Throws:
WTException

getResourceTotalWork

private Work getResourceTotalWork(PersonResource resource,
                                  ProjectActivity activity)
                           throws WTException
Computes the work spent by a person resource in an activity. There are two cases to consider, depending whether or not workitems are generated. If they are, the work performed is extracted from the work items, directly. If not, the work is estimated based on the work performed for the activity and the contribution of each resource assigned to an activity. This contribution is assumed to be proportional to the percentage of time allocated.

Throws:
WTException

computeTotalWork

private Work computeTotalWork(ProjectActivity activity,
                              PersonResource resource)
                       throws WTException
Computes the work spent by a person resource in an activity without work items.

Throws:
WTException

getProjectResource

private ProjectResource getProjectResource(ProjectPlan plan,
                                           Object res_obj)
                                    throws WTException
Returns a project resource.

Throws:
WTException

getStart

private Timestamp getStart(ExecutionObject exec_obj)
                    throws WTException
Throws:
WTException

showVector

private String showVector(Vector objs)
Returns a comma separated list of the objects in the Vector.


getIdString

private String getIdString(Object obj)

getActivityHolders

private QueryResult getActivityHolders(ProjectResource resource)
                                throws WTException
Throws:
WTException

getOid

private ObjectIdentifier getOid(Object obj)