git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@604769 13f79535-47bb-0310-9956-ffa450edef68
592 lines
32 KiB
XML
592 lines
32 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
|
|
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
|
|
|
|
<simple-method method-name="projectScheduler" short-description="Project Schulers sets the planningdates according task requirements and available resources">
|
|
<!--
|
|
theory behind the program
|
|
- - - - - - - - - - - - -
|
|
|
|
Assumptions for tasks and resources
|
|
1. a workday has 8 hours
|
|
2. a workweek has 40 hours and 5 days
|
|
3. The default order of the Tasks is by name
|
|
4. The default order of the tasks can be modified by the priority
|
|
|
|
The steps of the program are:
|
|
1. read all tasks into a list with the following fields:
|
|
name, id, length in hours, sequence
|
|
for critical path processing:
|
|
* ES - Earliest Start time
|
|
* EF - Earliest Finish time
|
|
* LS - Latest Start time
|
|
* LF - Latest Finish time
|
|
|
|
EF = LF task is on the critical path
|
|
|
|
|
|
The program will allocate certain values for certain facts to indicate the importance
|
|
and add the values to the sequence field.
|
|
|
|
order by name: 10 for every position
|
|
priority 1000 for every number
|
|
|
|
The system will then sort the list by sequence and will insert the planned dates
|
|
according the startdate and sat and sundays.
|
|
-->
|
|
</simple-method>
|
|
|
|
<simple-method method-name="updateTimeEntryByWorkeffort" short-description="Update workeffort by workeffort and timesheetId ">
|
|
<if-empty field-name="parameters.workEffortId">
|
|
<return/>
|
|
</if-empty>
|
|
<if-compare field-name="parameters.workEffortId" operator="equals" value="Totals">
|
|
<return/>
|
|
</if-compare>
|
|
<entity-one entity-name="Timesheet" value-name="timesheet"/>
|
|
|
|
<entity-and entity-name="ProjectAndPhaseAndTask" list-name="projects">
|
|
<field-map field-name="workEffortId" env-name="parameters.workEffortId"/>
|
|
</entity-and>
|
|
<if-not-empty field-name="project">
|
|
<first-from-list entry-name="projects" list-name="project"/>
|
|
</if-not-empty>
|
|
|
|
<get-related value-name="timesheet" relation-name="TimeEntry" list-name="timeEntries"/>
|
|
|
|
<!-- update existing entries -->
|
|
<set field="hours" value="0" type="Double"/>
|
|
<if-not-empty field-name="timeEntries">
|
|
<iterate entry-name="timeEntry" list-name="timeEntries">
|
|
<if-compare-field field-name="timeEntry.workEffortId" operator="equals" to-field-name="parameters.workEffortId">
|
|
<!-- check if the entry does not contain any hours, then delete -->
|
|
<if-empty field-name="timeEntry.hours">
|
|
<set from-field="timeEntry.timeEntryId" field="teDelMap.timeEntryId"/>
|
|
<call-service service-name="deleteTimeEntry" in-map-name="teDelMap"/>
|
|
<else>
|
|
<!-- translate the date into the daynumber -->
|
|
<call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="getIntervalInDays" ret-field-name="dayNumber">
|
|
<field field-name="timesheet.fromDate" type="java.sql.Timestamp"/>
|
|
<field field-name="timeEntry.fromDate" type="java.sql.Timestamp"/>
|
|
</call-class-method>
|
|
<!-- get the related field -->
|
|
<if-not-empty field-name="parameters.hoursDay${dayNumber}">
|
|
<set field="hours" from-field="parameters.hoursDay${dayNumber}"/>
|
|
<else>
|
|
<set field="hours" value="0"/>
|
|
</else>
|
|
</if-not-empty>
|
|
<set field="parameters.hoursDay${dayNumber}" value="-1"/>
|
|
<call-simple-method method-name="updateTimeEntry"/>
|
|
</else>
|
|
</if-empty>
|
|
</if-compare-field>
|
|
</iterate>
|
|
</if-not-empty>
|
|
|
|
<!-- process not yet done fields -->
|
|
<loop count="7" field="dayNr">
|
|
<if-not-empty field-name="parameters.hoursDay${dayNr}">
|
|
<set field="hours" from-field="parameters.hoursDay${dayNr}"/>
|
|
<else>
|
|
<set field="hours" value="0"/>
|
|
</else>
|
|
</if-not-empty>
|
|
<set field="hours" from-field="parameters.hoursDay${dayNr}"/>
|
|
<call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="addDaysToTimestamp" ret-field-name="fromDate">
|
|
<field field-name="timesheet.fromDate" type="java.sql.Timestamp"/>
|
|
<field field-name="dayNr" type="int"/>
|
|
</call-class-method>
|
|
<call-simple-method method-name="updateTimeEntry"/>
|
|
</loop>
|
|
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getProjectIdAndName" short-description="Get the projectId when a phase or task is provided." login-required="true">
|
|
<if-empty field-name="parameters.taskId">
|
|
<if-empty field-name="parameters.phaseId">
|
|
<return/>
|
|
</if-empty>
|
|
</if-empty>
|
|
<if-not-empty field-name="parameters.taskId">
|
|
<entity-one entity-name="WorkEffort" value-name="task">
|
|
<field-map field-name="workEffortId" env-name="parameters.taskId"/>
|
|
</entity-one>
|
|
<get-related-one value-name="task" relation-name="ParentWorkEffort" to-value-name="phase"/>
|
|
<else>
|
|
<entity-one entity-name="WorkEffort" value-name="phase">
|
|
<field-map field-name="workEffortId" env-name="parameters.phaseId"/>
|
|
</entity-one>
|
|
</else>
|
|
</if-not-empty>
|
|
<get-related-one value-name="phase" relation-name="ParentWorkEffort" to-value-name="project"/>
|
|
<field-to-result field-name="project.workEffortId" result-name="projectId"/>
|
|
<field-to-result field-name="project.workEffortName" result-name="projectName"/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getProject" short-description="get Project information" login-required="true">
|
|
<if-empty field-name="parameters.projectId">
|
|
<return/>
|
|
</if-empty>
|
|
<entity-one entity-name="WorkEffort" value-name="project">
|
|
<field-map field-name="workEffortId" env-name="parameters.projectId"/>
|
|
</entity-one>
|
|
<set field="highInfo.projectId" from-field="project.workEffortId"/>
|
|
<set field="highInfo.projectName" from-field="project.workEffortName"/>
|
|
<set field="highInfo.projectDescription" from-field="project.description"/>
|
|
<set field="highInfo.currentStatusId" from-field="project.currentStatusId"/>
|
|
<set field="highInfo.scopeEnumId" from-field="project.scopeEnumId"/>
|
|
<entity-one entity-name="StatusItem" value-name="highSeq">
|
|
<field-map field-name="statusId" env-name="project.currentStatusId"/>
|
|
</entity-one>
|
|
<set field="highInfo.sequenceId" from-field="highSeq.sequenceId"/>
|
|
<set field="highInfo.statusDescription" from-field="highSeq.description"/>
|
|
<set field="highInfo.createdDate" from-field="project.createdDate"/>
|
|
<if-not-empty field-name="project.workEffortParentId">
|
|
<entity-one entity-name="WorkEffort" value-name="parentProject">
|
|
<field-map field-name="workEffortId" env-name="project.workEffortParentId"/>
|
|
</entity-one>
|
|
<set field="highInfo.parentProjectName" from-field="parentProject.workEffortName"/>
|
|
<set field="highInfo.parentProjectId" from-field="parentProject.workEffortId"/>
|
|
</if-not-empty>
|
|
<!-- loop through the related phases and tasks -->
|
|
<get-related value-name="project" relation-name="ChildWorkEffort" list-name="phases"/>
|
|
<iterate entry-name="phase" list-name="phases">
|
|
<get-related value-name="phase" relation-name="ChildWorkEffort" list-name="tasks"/>
|
|
<iterate entry-name="lowInfo" list-name="tasks">
|
|
<call-simple-method method-name="combineInfo"/>
|
|
</iterate>
|
|
</iterate>
|
|
|
|
<!-- translate squenceId back into statusId -->
|
|
<entity-and entity-name="StatusItem" list-name="statusses">
|
|
<field-map field-name="sequenceId" env-name="highInfo.sequenceId"/>
|
|
<field-map field-name="statusTypeId" value="TASK_STATUS"/>
|
|
</entity-and>
|
|
<first-from-list entry-name="status" list-name="statusses"/>
|
|
<clear-field field-name="highInfo.sequenceId"/>
|
|
<set field="highInfo.statusId" from-field="status.statusId"/>
|
|
|
|
<call-simple-method method-name="createDates"/>
|
|
|
|
<!-- results -->
|
|
<field-to-result field-name="highInfo" result-name="projectInfo"/>
|
|
<field-to-result field-name="parameters.projectId" result-name="projectId"/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getProjectPhaseList" short-description="get Project Phase information" login-required="true">
|
|
<if-empty field-name="parameters.projectId">
|
|
<return/>
|
|
</if-empty>
|
|
<entity-and entity-name="WorkEffort" list-name="phases">
|
|
<field-map field-name="workEffortParentId" env-name="parameters.projectId"/>
|
|
<field-map field-name="workEffortTypeId" value="PHASE"/>
|
|
</entity-and>
|
|
|
|
<iterate entry-name="phase" list-name="phases">
|
|
<!-- get the phase seq id -->
|
|
<entity-one entity-name="StatusItem" value-name="highSeq">
|
|
<field-map field-name="statusId" env-name="phase.currentStatusId"/>
|
|
</entity-one>
|
|
<clear-field field-name="highInfo"/>
|
|
<set field="highInfo.sequenceId" from-field="highSeq.sequenceId"/>
|
|
<set field="highInfo.phaseId" from-field="phase.workEffortId"/>
|
|
<set field="highInfo.phaseName" from-field="phase.workEffortName"/>
|
|
<set field="highInfo.phaseDescription" from-field="phase.description"/>
|
|
<set field="highInfo.scopeEnumId" from-field="phase.scopeEnumId"/>
|
|
|
|
<!-- loop through the related tasks and combine information -->
|
|
<get-related value-name="phase" relation-name="ChildWorkEffort" list-name="tasks"/>
|
|
<iterate entry-name="lowInfo" list-name="tasks">
|
|
<call-simple-method method-name="combineInfo"/>
|
|
</iterate>
|
|
|
|
<!-- merge estimated and actual dates -->
|
|
<call-simple-method method-name="createDates"/>
|
|
<!-- translate squenceId back into statusId -->
|
|
<entity-and entity-name="StatusItem" list-name="statusses">
|
|
<field-map field-name="sequenceId" env-name="highInfo.sequenceId"/>
|
|
<field-map field-name="statusTypeId" value="TASK_STATUS"/>
|
|
</entity-and>
|
|
<first-from-list entry-name="status" list-name="statusses"/>
|
|
<clear-field field-name="highInfo.sequenceId"/>
|
|
<set field="highInfo.statusId" from-field="status.statusId"/>
|
|
<field-to-list field-name="highInfo" list-name="phaseList"/>
|
|
</iterate>
|
|
|
|
<!-- results -->
|
|
<field-to-result field-name="phaseList"/>
|
|
<field-to-result field-name="parameters.projectId" result-name="projectId"/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getProjectTaskList" short-description="get Project Phase/task information" login-required="true">
|
|
<if-empty field-name="parameters.projectId">
|
|
<return/>
|
|
</if-empty>
|
|
<entity-and entity-name="ProjectAndPhaseAndTask" list-name="tasks">
|
|
<field-map field-name="projectId" env-name="parameters.projectId"/>
|
|
</entity-and>
|
|
|
|
<iterate entry-name="task" list-name="tasks">
|
|
|
|
<!-- merge estimated and actual dates -->
|
|
<if-empty field-name="savePhaseName">
|
|
<set field="savePhaseName" from-field="task.phaseName"/>
|
|
<set field="highInfo.phaseName" from-field="task.phaseName"/>
|
|
<else>
|
|
<if-compare-field field-name="task.phaseName" operator="not-equals" to-field-name="savePhaseName">
|
|
<set field="highInfo.phaseName" from-field="task.phaseName"/>
|
|
<set field="savePhaseName" from-field="task.phaseName"/>
|
|
</if-compare-field>
|
|
</else>
|
|
</if-empty>
|
|
<set field="highInfo.phaseId" from-field="task.phaseId"/>
|
|
<set field="highInfo.workEffortId" from-field="task.workEffortId"/>
|
|
<set field="highInfo.workEffortName" from-field="task.workEffortName"/>
|
|
<set field="highInfo.workEffortDescription" from-field="workEffortDescription"/>
|
|
<set field="highInfo.currentStatusId" from-field="task.currentStatusId"/>
|
|
<set field="highInfo.scopeEnumId" from-field="task.scopeEnumId"/>
|
|
<set field="highInfo.priority" from-field="task.priority"/>
|
|
<set field="highInfo.estimatedStartDate" from-field="task.estimatedStartDate"/>
|
|
<set field="highInfo.estimatedCompletionDate" from-field="task.estimatedCompletionDate"/>
|
|
<set field="highInfo.actualStartDate" from-field="task.actualStartDate"/>
|
|
<set field="highInfo.actualCompletionDate" from-field="task.actualCompletionDate"/>
|
|
<call-simple-method method-name="createDates"/>
|
|
<set field="lowInfo" from-field="task"/>
|
|
<call-simple-method method-name="getHours"/>
|
|
<field-to-list field-name="highInfo" list-name="taskList"/>
|
|
<clear-field field-name="highInfo"/>
|
|
</iterate>
|
|
|
|
<!-- results -->
|
|
<field-to-result field-name="taskList"/>
|
|
<field-to-result field-name="parameters.projectId" result-name="projectId"/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getProjectTask" short-description="get Project task information" login-required="true">
|
|
<entity-one entity-name="WorkEffort" value-name="lowInfo">
|
|
<field-map field-name="workEffortId" env-name="parameters.taskId"/>
|
|
</entity-one>
|
|
<set field="highInfo.taskId" from-field="lowInfo.worEffortId"/>
|
|
<set field="highInfo.taskName" from-field="lowInfo.workEffortName"/>
|
|
<set field="highInfo.taskDescription" from-field="lowInfo.description"/>
|
|
<set field="highInfo.scopeEnumId" from-field="lowInfo.scopeEnumId"/>
|
|
<call-simple-method method-name="combineInfo"/>
|
|
<clear-field field-name="highInfo.sequenceId"/>
|
|
<set field="highInfo.statusId" from-field="lowInfo.currentStatusId"/>
|
|
<field-to-result field-name="highInfo" result-name="taskInfo"/>
|
|
<field-to-result field-name="parameters.projectId" result-name="projectId"/>
|
|
<field-to-result field-name="parameters.taskId" result-name="taskId"/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getProjectsByParties" short-description="get Project information by party member" login-required="true">
|
|
<!-- get the list of tasks optionaly selected for a party -->
|
|
<if-empty field-name="parameters.partyId">
|
|
<set field="parameters.partyId" value="%"/>
|
|
</if-empty>
|
|
<if-empty field-name="parameters.projectId">
|
|
<set field="parameters.projectId" value="%"/>
|
|
</if-empty>
|
|
<entity-condition entity-name="ProjectPartyAndPhaseAndTask" list-name="tasks">
|
|
<condition-list combine="and">
|
|
<condition-expr field-name="partyId" operator="like" env-name="parameters.partyId"/>
|
|
<condition-expr field-name="projectId" operator="like" env-name="parameters.projectId"/>
|
|
</condition-list>
|
|
<order-by field-name="projectId"/>
|
|
<order-by field-name="partyId"/>
|
|
</entity-condition>
|
|
<if-not-empty field-name="tasks">
|
|
<iterate entry-name="task" list-name="tasks">
|
|
<if>
|
|
<condition >
|
|
<and>
|
|
<not>
|
|
<if-empty field-name="projectParty"/>
|
|
</not>
|
|
<if-compare-field field-name="task.partyId" operator="not-equals" to-field-name="projectParty.partyId"/>
|
|
</and>
|
|
</condition>
|
|
<then>
|
|
<field-to-list field-name="projectParty" list-name="projectParties"/>
|
|
<clear-field field-name="projectParty"/>
|
|
</then>
|
|
</if>
|
|
|
|
<if-empty field-name="projectParty">
|
|
<set field="projectParty.partyId" from-field="task.partyId"/>
|
|
<entity-one entity-name="PartyNameView" value-name="partyNameView">
|
|
<field-map field-name="partyId" env-name="task.partyId"/>
|
|
</entity-one>
|
|
<if-not-empty field-name="partyNameView">
|
|
<set field="projectParty.partyName" value="${partyNameView.lastName},${partyNameView.firstName}${partyNameView.groupName}"/>
|
|
</if-not-empty>
|
|
<set field="projectParty.roleTypeId" from-field="task.roleTypeId"/>
|
|
<set field="projectParty.fromDate" from-field="task.fromDate"/>
|
|
<set field="projectParty.thruDate" from-field="task.thruDate"/>
|
|
</if-empty>
|
|
|
|
<!-- get the planned hours -->
|
|
<set field="lowInfo" from-field="task"/>
|
|
<set field="hoursPartyId" from-field="task.partyId"/>
|
|
<call-simple-method method-name="getHours"/>
|
|
<set field="projectParty.plannedHours" from-field="highInfo.plannedHours"/>
|
|
<set field="projectParty.actualHours" from-field="highInfo.actualHours"/>
|
|
|
|
</iterate>
|
|
<if-not-empty field-name="projectParty">
|
|
<field-to-list field-name="projectParty" list-name="projectParties"/>
|
|
</if-not-empty>
|
|
<if-not-empty field-name="projectParties">
|
|
<field-to-result field-name="projectParties"/>
|
|
</if-not-empty>
|
|
</if-not-empty>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getTasksByParties" short-description="get task information by party member" login-required="true">
|
|
<!-- get the list of tasks optionaly selected for a party -->
|
|
<if-empty field-name="parameters.partyId">
|
|
<set field="parameters.partyId" value="%"/>
|
|
</if-empty>
|
|
<if-empty field-name="parameters.workEffortId">
|
|
<set field="parameters.workEffortId" value="%"/>
|
|
</if-empty>
|
|
<entity-condition entity-name="WorkEffortPartyAssignment" list-name="tasks">
|
|
<condition-list combine="and">
|
|
<condition-expr field-name="partyId" operator="like" env-name="parameters.partyId"/>
|
|
<condition-expr field-name="workEffortId" operator="like" env-name="parameters.workEffortId"/>
|
|
</condition-list>
|
|
<order-by field-name="workEffortId"/>
|
|
<order-by field-name="partyId"/>
|
|
</entity-condition>
|
|
<if-not-empty field-name="tasks">
|
|
<iterate entry-name="task" list-name="tasks">
|
|
<if>
|
|
<condition >
|
|
<and>
|
|
<not>
|
|
<if-empty field-name="taskParty"/>
|
|
</not>
|
|
<if-compare-field field-name="task.partyId" operator="not-equals" to-field-name="taskParty.partyId"/>
|
|
</and>
|
|
</condition>
|
|
<then>
|
|
<field-to-list field-name="taskParty" list-name="taskParties"/>
|
|
<clear-field field-name="taskParty"/>
|
|
</then>
|
|
</if>
|
|
|
|
<if-empty field-name="taskParty">
|
|
<set field="taskParty.partyId" from-field="task.partyId"/>
|
|
<entity-one entity-name="PartyNameView" value-name="partyNameView">
|
|
<field-map field-name="partyId" env-name="task.partyId"/>
|
|
</entity-one>
|
|
<if-not-empty field-name="partyNameView">
|
|
<set field="taskParty.partyName" value="${partyNameView.lastName},${partyNameView.firstName}${partyNameView.groupName}"/>
|
|
</if-not-empty>
|
|
<set field="taskParty.roleTypeId" from-field="task.roleTypeId"/>
|
|
<set field="taskParty.statusId" from-field="task.statusId"/>
|
|
<set field="taskParty.fromDate" from-field="task.fromDate"/>
|
|
<set field="taskParty.thruDate" from-field="task.thruDate"/>
|
|
</if-empty>
|
|
|
|
<!-- get the planned hours -->
|
|
<set field="lowInfo" from-field="task"/>
|
|
<set field="hoursPartyId" from-field="task.partyId"/>
|
|
<get-related-one value-name="task" relation-name="WorkEffort" to-value-name="lowInfo"/>
|
|
<call-simple-method method-name="getHours"/>
|
|
<set field="taskParty.plannedHours" from-field="highInfo.plannedHours"/>
|
|
<set field="taskParty.actualHours" from-field="highInfo.actualHours"/>
|
|
|
|
</iterate>
|
|
<if-not-empty field-name="taskParty">
|
|
<field-to-list field-name="taskParty" list-name="taskParties"/>
|
|
</if-not-empty>
|
|
<if-not-empty field-name="taskParties">
|
|
<field-to-result field-name="taskParties"/>
|
|
</if-not-empty>
|
|
</if-not-empty>
|
|
</simple-method>
|
|
|
|
<!-- Internal functions -->
|
|
<simple-method method-name="combineInfo" short-description="combine lower level status, dates of tasks.">
|
|
<!-- in/output highInfo infoMap -->
|
|
<!-- input lowInfo info map -->
|
|
<!-- set the dates from the lower level tasks -->
|
|
<if-not-empty field-name="lowInfo.estimatedStartDate">
|
|
<if-empty field-name="highInfo.estimatedStartDate">
|
|
<set field="highInfo.estimatedStartDate" from-field="lowInfo.estimatedStartDate" />
|
|
<else>
|
|
<if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="estimatedStartDate" operator="greater">
|
|
<set field="highInfo.estimatedStartDate" from-field="lowInfo.estimatedStartDate" />
|
|
</if-compare-field>
|
|
</else>
|
|
</if-empty>
|
|
</if-not-empty>
|
|
<if-not-empty field-name="lowInfo.estimatedCompletionDate">
|
|
<if-empty field-name="highInfo.estimatedCompletionDate">
|
|
<set field="highInfo.estimatedCompletionDate" from-field="lowInfo.estimatedCompletionDate" />
|
|
<else>
|
|
<if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="estimatedCompletionDate" operator="less">
|
|
<set field="highInfo.estimatedCompletionDate" from-field="lowInfo.estimatedCompletionDate" />
|
|
</if-compare-field>
|
|
</else>
|
|
</if-empty>
|
|
</if-not-empty>
|
|
<if-not-empty field-name="lowInfo.actualStartDate">
|
|
<if-empty field-name="highInfo.actualStartDate">
|
|
<set field="highInfo.actualStartDate" from-field="lowInfo.actualStartDate" />
|
|
<else>
|
|
<if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="actualStartDate" operator="greater">
|
|
<set field="highInfo.actualStartDate" from-field="lowInfo.actualStartDate" />
|
|
</if-compare-field>
|
|
</else>
|
|
</if-empty>
|
|
</if-not-empty>
|
|
<if-not-empty field-name="lowInfo.actualCompletionDate">
|
|
<if-empty field-name="highInfo.actualCompletionDate">
|
|
<set field="highInfo.actualCompletionDate" from-field="lowInfo.actualCompletionDate" />
|
|
<else>
|
|
<if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="actualCompletionDate" operator="less">
|
|
<set field="highInfo.actualCompletionDate" from-field="lowInfo.actualCompletionDate" />
|
|
</if-compare-field>
|
|
</else>
|
|
</if-empty>
|
|
</if-not-empty>
|
|
|
|
<!-- combine the priorities -->
|
|
<if-not-empty field-name="lowInfo.priority">
|
|
<if-empty field-name="highInfo.priority">
|
|
<set field="highInfo.priority" from-field="lowInfo.priority" />
|
|
<else>
|
|
<if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="priority" operator="greater">
|
|
<set field="highInfo.priority" from-field="lowInfo.priority" />
|
|
</if-compare-field>
|
|
</else>
|
|
</if-empty>
|
|
</if-not-empty>
|
|
|
|
<!-- get the status from the lowerlevel tasks follow the sequence in the StatusItem entity and use the lowest-->
|
|
<entity-one entity-name="StatusItem" value-name="status">
|
|
<field-map field-name="statusId" env-name="lowInfo.currentStatusId"/>
|
|
</entity-one>
|
|
<if-empty field-name="highInfo.sequenceId">
|
|
<set field="highInfo.sequenceId" from-field="status.sequenceId"/>
|
|
<else>
|
|
<if-compare-field field-name="highInfo.sequenceId" operator="greater" to-field-name="status.sequenceId">
|
|
<set field="highInfo.sequenceId" from-field="status.sequenceId"/>
|
|
</if-compare-field>
|
|
</else>
|
|
</if-empty>
|
|
|
|
<!-- add the estimated/planned hours together -->
|
|
<call-simple-method method-name="getHours"/>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="getHours" short-description="get the planned and estimated hours for a task">
|
|
|
|
<!-- input is 'lowInfo' map output is 'highInfo map -->
|
|
<!-- hoursPartyId: if provided only the hours of that party -->
|
|
|
|
<!-- add the planned hours together -->
|
|
<get-related value-name="lowInfo" relation-name="WorkEffortSkillStandard" list-name="estimates"/>
|
|
<iterate entry-name="estimate" list-name="estimates">
|
|
<if-not-empty field-name="estimate.estimatedDuration">
|
|
<calculate field-name="highInfo.plannedHours">
|
|
<calcop operator="get" field-name="highInfo.hours"></calcop>
|
|
<calcop operator="add" field-name="estimate.estimatedDuration"/>
|
|
</calculate>
|
|
</if-not-empty>
|
|
</iterate>
|
|
|
|
<!-- get the actual hours -->
|
|
<get-related value-name="lowInfo" relation-name="TimeEntry" list-name="actuals"/>
|
|
<iterate entry-name="actual" list-name="actuals">
|
|
<if-not-empty field-name="actual.hours">
|
|
<get-related-one value-name="actual" relation-name="Timesheet" to-value-name="timesheet"/>
|
|
<if>
|
|
<condition>
|
|
<or>
|
|
<if-empty field-name="hoursPartyId"/>
|
|
<and>
|
|
<not><if-empty field-name="hoursPartyId"/></not>
|
|
<if-compare-field field-name="timeSheet.partyId" operator="equals" to-field-name="hoursPartyId"/>
|
|
</and>
|
|
</or>
|
|
</condition>
|
|
<then>
|
|
<calculate field-name="highInfo.actualHours">
|
|
<calcop operator="get" field-name="highInfo.actualHours"/>
|
|
<calcop operator="add" field-name="actual.hours"></calcop>
|
|
</calculate>
|
|
</then>
|
|
</if>
|
|
</if-not-empty>
|
|
</iterate>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="createDates" short-description="merge the estimated and actual dates">
|
|
|
|
<!-- input/output is 'highInfo map -->
|
|
|
|
<!-- create dates taking the last known one to save space on the list -->
|
|
<if-not-empty field-name="highInfo.actualStartDate">
|
|
<set field="highInfo.startDate" from-field="highInfo.actualStartDate"/>
|
|
<else>
|
|
<set field="highInfo.startDate" from-field="highInfo.estimatedStartDate"/>
|
|
</else>
|
|
</if-not-empty>
|
|
<if-not-empty field-name="highInfo.actualCompletionDate">
|
|
<set field="highInfo.completionDate" from-field="highInfo.actualCompletionDate"/>
|
|
<else>
|
|
<set field="highInfo.completionDate" from-field="highInfo.estimatedCompletionDate"/>
|
|
</else>
|
|
</if-not-empty>
|
|
</simple-method>
|
|
|
|
<simple-method method-name="updateTimeEntry" short-description="">
|
|
<if-compare field-name="hours" value="-1" operator="equals">
|
|
<return/>
|
|
</if-compare>
|
|
<if-not-empty field-name="timeEntry.timeEntryId">
|
|
<if-compare field-name="hours" operator="equals" value="0">
|
|
<set field="teDelMap.timeEntryId" from-field="timeEntry.timeEntryId"/>
|
|
<call-service service-name="deleteTimeEntry" in-map-name="teDelMap"/>
|
|
<else>
|
|
<clear-field field-name="teUpdMap"/>
|
|
<set field="teUpdMap.hours" from-field="hours"/>
|
|
<set field="teUpdMap.timeEntryId" from-field="timeEntry.timeEntryId"/>
|
|
<call-service service-name="updateTimeEntry" in-map-name="teUpdMap"/>
|
|
</else>
|
|
</if-compare>
|
|
<else>
|
|
<if-compare field-name="hours" operator="not-equals" value="0">
|
|
<set-service-fields service-name="createTimeEntry" map-name="parameters" to-map-name="teCreMap"/>
|
|
<set field="teCreMap.hours" from-field="hours"/>
|
|
<set field="teCreMap.fromDate" from-field="fromDate"/>
|
|
<call-service service-name="createTimeEntry" in-map-name="teCreMap"/>
|
|
</if-compare>
|
|
</else>
|
|
</if-not-empty>
|
|
</simple-method>
|
|
|
|
</simple-methods>
|