Added: ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml?rev=1142915&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml (added) +++ ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml Tue Jul 5 08:15:32 2011 @@ -0,0 +1,4495 @@ +<?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="createSprint" short-description="Create Sprint"> + <!-- Permission Check --> + <call-simple-method method-name="getWebSiteId"/> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_SPRINT" action="_CREATE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <entity-one entity-name="UserLogin" value-field="sysUserLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <!-- Error Filtering --> + <if-compare operator="less-equals" value="0" field="parameters.maxNum"> + <add-error error-list-name="_error_message_list_"> + <fail-message message="There is no product backlogs in the system. Please create the product backlogs before perform this action."/> + </add-error> + </if-compare> + <if-compare-field operator="greater" field="parameters.sprintBacklogs" to-field="parameters.maxNum" type="Integer"> + <add-error error-list-name="_error_message_list_"> + <fail-message message="Number of sprint backlogs are too much. Please enter the number equal or less than ${parameters.maxNum}."/> + </add-error> + </if-compare-field> + <if-compare operator="less-equals" value="0" field="parameters.sprintBacklogs" type="Integer"> + <add-error error-list-name="_error_message_list_"> + <fail-message message="Number of sprint backlogs must greater than 0 (zero)"/> + </add-error> + </if-compare> + <if-empty field="parameters.sprintEstimatedStart"> + <add-error error-list-name="_error_message_list_"> + <fail-message message="Start Date is missing"/> + </add-error> + </if-empty> + + <if-not-empty field="_error_message_list_"> + <return response-code="error"/> + </if-not-empty> + <!-- calculate estimatedMilliSeconds --> + <set field="sprintDuration" from-field="parameters.sprintDuration" type="Integer"/> + <set field="actualStartDate" from-field="parameters.sprintEstimatedStart" type="Date"/> + <set field="actualCompletionDate"/> + <set field="groovy" value="${groovy: import groovy.time.*; + context.actualCompletionDate = (context.actualStartDate-1) + (context.sprintDuration*7); + }"/> + <set field="actualStartDateT" from-field="actualStartDate" type="Timestamp"/> + <set field="actualCompletionDateT" from-field="actualCompletionDate" type="Timestamp"/> + <set field="input.estimatedMilliSeconds" type="Long" value="${groovy: import groovy.time.*; + def estimatedMilliSeconds = context.sprintDuration*5*8*60*60*1000; + return (estimatedMilliSeconds); + }"/> + + <set field="input.workEffortName" from-field="parameters.sprintName"/> + <set field="input.description" from-field="parameters.sprintDescription"/> + <set field="input.actualStartDate" from-field="actualStartDate"/> + <set field="input.actualCompletionDate" from-field="actualCompletionDate"/> + <set field="input.workEffortTypeId" value="SCRUM_SPRINT"/> + <set field="input.currentStatusId" value="SPRINT_ACTIVE"/> + <set field="input.workEffortParentId" from-field="parameters.projectId"/> + <set field="input.webSiteId" from-field="parameters.webSiteId"/> + <set field="input.userLogin" from-field="sysUserLogin"/> + <!-- Create Sprint --> + <call-service service-name="createWorkEffort" in-map-name="input"> + <result-to-field result-name="workEffortId" field="parameters.sprintId"/> + </call-service> + <!-- Add sprint backlog to sprint --> + <call-simple-method method-name="createSprintBacklog"></call-simple-method> + + <!-- Add default backlog and task to sprint --> + <call-simple-method method-name="createBacklogMeeting"/> + + <entity-one value-field="workEffort" entity-name="WorkEffort"> + <field-map field-name="workEffortId" from-field="parameters.projectId"/> + </entity-one> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + + <simple-method method-name="createBacklogMeeting" short-description="Create Backlog for meeting to sprint"> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + <if-has-permission permission="SCRUM_SPRINT" action="_CREATE"/> + </or> + </condition> + <then> + <entity-and list="workEffortList" entity-name="WorkEffortAndProduct"> + <field-map field-name="workEffortId" from-field="parameters.projectId"/> + </entity-and> + <first-from-list entry="workEffortMap" list="workEffortList"/> + <make-value value-field="backlogMeeting" entity-name="CustRequest"/> + <sequenced-id sequence-name="CustRequest" field="custRequestId"/> + <set field="backlogMeeting.custRequestId" from-field="custRequestId"/> + <set field="backlogMeeting.custRequestTypeId" value="RF_SCRUM_MEETINGS"/> + <set field="backlogMeeting.statusId" value="CRQ_REVIEWED"/> + <set field="backlogMeeting.custRequestName" value="Scrum Meeting"/> + <set field="backlogMeeting.description" value="Scrum Meeting"/> + <set field="backlogMeeting.fromPartyId" from-field="userLogin.partyId"/> + <create-value value-field="backlogMeeting"/> + <set-service-fields service-name="createCustRequestItem" map="parameters" to-map="createItem"/> + <set field="createItem.custRequestId" from-field="custRequestId"/> + <set field="createItem.productId" from-field="workEffortMap.productId"/> + <call-service service-name="createCustRequestItem" in-map-name="createItem"/> + + <!-- add default backlog to sprint --> + <set field="createBL.custRequestId" from-field="custRequestId"/> + <set field="createBL.workEffortId" from-field="parameters.sprintId"/> + <set field="createBL.userLogin" from-field="userLogin"/> + <call-service service-name="createWorkEffortRequest" in-map-name="createBL"/> + + <!-- add default task to backlog --> + <set field="newDefaultTask.workEffortName" value="Scrum Planning"/> + <set field="newDefaultTask.currentStatusId" value="STS_CREATED"/> + <set field="newDefaultTask.workEffortTypeId" value="SCRUM_TASK_IMPL"/> + <set field="newDefaultTask.workEffortPurposeTypeId" value="SCRUM_DEFAULT_TASK"/> + <set field="newDefaultTask.workEffortParentId" from-field="parameters.sprintId"/> + <call-service service-name="createWorkEffort" in-map-name="newDefaultTask"> + <result-to-field result-name="workEffortId"/> + </call-service> + <set field="parameters.custRequestId" from-field="custRequestId"/> + <set field="parameters.workEffortId" from-field="workEffortId"/> + <set-service-fields service-name="createWorkEffortRequest" to-map="createWorkEffortRequest" map="parameters"/> + <call-service service-name="createWorkEffortRequest" in-map-name="createWorkEffortRequest"> + <result-to-field result-name="workEffortId" field="workEffort"/> + </call-service> + + <set field="newDefaultTask.workEffortName" value="Sprint Evaluation and Sprint Retrospective"/> + <set field="newDefaultTask.currentStatusId" value="STS_CREATED"/> + <set field="newDefaultTask.workEffortTypeId" value="SCRUM_TASK_IMPL"/> + <set field="newDefaultTask.workEffortPurposeTypeId" value="SCRUM_DEFAULT_TASK"/> + <set field="newDefaultTask.workEffortParentId" from-field="parameters.sprintId"/> + <call-service service-name="createWorkEffort" in-map-name="newDefaultTask"> + <result-to-field result-name="workEffortId"/> + </call-service> + <set field="parameters.custRequestId" from-field="custRequestId"/> + <set field="parameters.workEffortId" from-field="workEffortId"/> + <set-service-fields service-name="createWorkEffortRequest" to-map="createWorkEffortRequest" map="parameters"/> + <call-service service-name="createWorkEffortRequest" in-map-name="createWorkEffortRequest"> + <result-to-field result-name="workEffortId" field="workEffortId"/> + </call-service> + + <set field="newDefaultTask.workEffortName" value="Daily Scrum"/> + <set field="newDefaultTask.currentStatusId" value="STS_CREATED"/> + <set field="newDefaultTask.workEffortTypeId" value="SCRUM_TASK_IMPL"/> + <set field="newDefaultTask.workEffortPurposeTypeId" value="SCRUM_DEFAULT_TASK"/> + <set field="newDefaultTask.workEffortParentId" from-field="parameters.sprintId"/> + <call-service service-name="createWorkEffort" in-map-name="newDefaultTask"> + <result-to-field result-name="workEffortId"/> + </call-service> + <set field="parameters.custRequestId" from-field="custRequestId"/> + <set field="parameters.workEffortId" from-field="workEffortId"/> + <set-service-fields service-name="createWorkEffortRequest" to-map="createWorkEffortRequest" map="parameters"/> + <call-service service-name="createWorkEffortRequest" in-map-name="createWorkEffortRequest"> + <result-to-field result-name="workEffortId" field="workEffortId"/> + </call-service> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + + <simple-method method-name="updateSprintInfo" short-description="Update Sprint Infomation"> + <!-- Permission Check --> + <call-simple-method method-name="getWebSiteId"/> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_SPRINT" action="_UPDATE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <if> + <condition> + <if-compare field="parameters.statusId" value="SPRINT_CLOSED" operator="equals"/> + </condition> + <then> + <!-- close sprint and take out incomplete backlog(s) --> + <call-simple-method method-name="closeSprint"/> + </then> + <else> + <!-- Error Filltering --> + <if-empty field="parameters.workEffortName"> + <add-error error-list-name="_error_message_list_"> + <fail-message message="Sprint Name is missing."/> + </add-error> + </if-empty> + <if-empty field="parameters.actualStartDate"> + <add-error error-list-name="_error_message_list_"> + <fail-message message="Start Date is missing."/> + </add-error> + </if-empty> + <if-not-empty field="_error_message_list_"> + <return response-code="error"/> + </if-not-empty> + <!-- calculate estimatedMilliSeconds --> + <set field="sprintDuration" from-field="parameters.sprintDuration" type="Integer"/> + <set field="actualStartDate" from-field="parameters.actualStartDate" type="Date"/> + <set field="actualCompletionDate"/> + <set field="groovy" value="${groovy: import groovy.time.*; + context.actualCompletionDate = (context.actualStartDate-1) +(context.sprintDuration*7);}"/> + + <set field="actualStartDateT" from-field="actualStartDate" type="Timestamp"/> + <set field="actualCompletionDateT" from-field="actualCompletionDate" type="Timestamp"/> + <set field="parameters.estimatedMilliSeconds" type="Long" value="${groovy: import groovy.time.*; + def estimatedMilliSeconds = context.sprintDuration*5*8*60*60*1000; + return (estimatedMilliSeconds);}"/> + + <set field="parameters.actualStartDate" from-field="actualStartDateT"/> + <set field="parameters.actualCompletionDate" from-field="actualCompletionDateT"/> + <set field="parameters.currentStatusId" from-field="parameters.statusId"/> + <set field="parameters.webSiteId" from-field="parameters.webSiteId"/> + + <call-service service-name="updateWorkEffort" in-map-name="parameters"> + </call-service> + </else> + </if> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + + <simple-method method-name="deleteSprintBacklog" short-description="Delete relation of sprint and customer request"> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_SPRINT" action="_UPDATE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <call-simple-method method-name="getWebSiteId"/> + <entity-condition list="taskInSprintBacklogs" entity-name="CustRequestAndWorkEffort"> + <condition-list combine="and"> + <condition-expr field-name="custRequestId" from-field="parameters.custRequestId"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_SPRINT" operator="not-equals"/> + </condition-list> + </entity-condition> + <!-- Grouping Sprint and Customer Request --> + <set field="input.custRequestId" from-field="parameters.custRequestId"/> + <set field="input.workEffortId" from-field="parameters.sprintId"/> + <if-not-empty field="input.workEffortId"> + <call-service service-name="deleteWorkEffortRequest" in-map-name="input"/> + </if-not-empty> + <!-- Change CustRequest status back to Accepted an d reorder backlog Item--> + <entity-one value-field="sprintMap" entity-name="WorkEffort"> + <field-map field-name="workEffortId" from-field="parameters.sprintId"/> + </entity-one> + <entity-and list="projectList" entity-name="WorkEffortAndProduct"> + <field-map field-name="workEffortId" from-field="sprintMap.workEffortParentId"/> + </entity-and> + <set field="productId" from-field="projectList[0].productId"/> + <if-empty field="productId"> + <set field="productId" from-field="parameters.productId"/> + </if-empty> + <entity-one value-field="custRequest" entity-name="CustRequest"/> + <if-compare field="custRequest.custRequestTypeId" operator="equals" value="RF_UNPLAN_BACKLOG"> + <entity-count count-field="getNum" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="productId"/> + <condition-expr field-name="custRequestTypeId" operator="equals" value="RF_UNPLAN_BACKLOG"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + </entity-count> + <else> + <entity-count count-field="getNum" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="productId"/> + <condition-expr field-name="custRequestTypeId" operator="not-equals" value="RF_UNPLAN_BACKLOG"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + </entity-count> + </else> + </if-compare> + <set field="sequenceNumIn" value="1" type="Long"/> + <set field="custRequestResultMap.custRequestId" from-field="parameters.custRequestId"/> + <!-- the first sequence number --> + <if-compare operator="equals" field="getNum" value="0"> + <set field="custRequestResultMap.sequenceNum" from-field="sequenceNumIn"/> + <else> + <if-compare field="custRequest.custRequestTypeId" operator="equals" value="RF_UNPLAN_BACKLOG"> + <entity-condition list="custRequestList" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="productId"/> + <condition-expr field-name="custRequestTypeId" operator="equals" value="RF_UNPLAN_BACKLOG"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + <order-by field-name="sequenceNum"/> + </entity-condition> + <else> + <entity-condition list="custRequestList" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="productId"/> + <condition-expr field-name="custRequestTypeId" operator="not-equals" value="RF_UNPLAN_BACKLOG"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + <order-by field-name="sequenceNum"/> + </entity-condition> + </else> + </if-compare> + <set field="sequenceNumkey" from-field="sequenceNumIn" type="Integer"/> + <set field="productMap" from-field="custRequestList[sequenceNumkey-1]"/> + <set field="externalSeq" from-field="productMap.sequenceNum" type="Long"/> + <!-- Insert new transaction to CustRequest --> + <loop count="${getNum}" field="i"> + <set field="internalSeq" from-field="custRequestList[i].sequenceNum" type="Long" /> + <set field="ready" value="${groovy:internalSeq>=externalSeq}" type="Boolean"/> + <if-compare field="ready" operator="equals" value="true" type="Boolean"> + <set field="custRequestIdIn" from-field="custRequestList[i].custRequestId"/> + <entity-one value-field="custRequestMap" entity-name="CustRequest"> + <field-map field-name="custRequestId" from-field="custRequestIdIn"/> + </entity-one> + <set field="sequenceNum" from-field="custRequestMap.sequenceNum"/> + <set field="nextSeqNum" value="${sequenceNum+1}" type="Long"/> + <set field="custRequestMap.sequenceNum" from-field="nextSeqNum"/> + <store-value value-field="custRequestMap"/> + </if-compare> + </loop> + <set field="custRequestResultMap.sequenceNum" from-field="externalSeq"/> + </else> + </if-compare> + <!-- update Cust Request --> + <set field="oldStatusId" from-field="custRequest.statusId"/><!-- use in confirmation email (current status is CRQ_REVIEWED) --> + <set field="custRequestResultMap.webSiteId" from-field="parameters.webSiteId"/> + <call-service service-name="updateCustRequest" in-map-name="custRequestResultMap"/> + + <set field="setCustRequestStatusCtx.custRequestId" from-field="parameters.custRequestId"/> + <set field="setCustRequestStatusCtx.statusId" value="CRQ_ACCEPTED"/> + <set field="setCustRequestStatusCtx.webSiteId" from-field="parameters.webSiteId"/> + <call-service service-name="setCustRequestStatus" in-map-name="setCustRequestStatusCtx"/> + + <entity-condition entity-name="ProductBacklog" list="listTaskInBacklog"> + <condition-list combine="and"> + <condition-expr field-name="custRequestId" from-field="parameters.custRequestId"/> + <condition-list combine="or"> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_IMPL"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_ERROR"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_INST"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_TEST"/> + </condition-list> + </condition-list> + </entity-condition> + <if-not-empty field="listTaskInBacklog"> + <loop count="${groovy: listTaskInBacklog.size()}" field="i"> + <set field="updateProject.workEffortId" from-field="listTaskInBacklog[i].workEffortId"/> + <clear-field field="updateProject.workEffortParentId"/> + <call-service service-name="updateWorkEffort" in-map-name="updateProject"/> + </loop> + </if-not-empty> + <set field="_event_message_" value="The Sprint backlog has been deleted."/> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + + <simple-method method-name="DeleteSprint" short-description="Delete Sprint"> + <!-- Permission Check --> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_SPRINT" action="_DELETE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <set field="parameters.sprintId" from-field="parameters.workEffortId"/> + <entity-and list="custRequestWorkEfforts" entity-name="CustRequestWorkEffort"> + <field-map field-name="workEffortId" from-field="parameters.sprintId"/> + </entity-and> + + <if-not-empty field="custRequestWorkEfforts"> + <!-- Delete Bound Sprint and Customer Request --> + <remove-list list="custRequestWorkEfforts"/> + </if-not-empty> + + <!-- Delete Sprint --> + <set field="delSprintInput.workEffortId" from-field="parameters.sprintId"/> + <call-service service-name="deleteWorkEffort" in-map-name="delSprintInput"> + </call-service> + + <!-- Delete Sprint Member --> + <entity-and list="membersPartyId" entity-name="WorkEffortPartyAssignView"> + <field-map field-name="workEffortId" from-field="parameters.sprintId"/> + </entity-and> + + <if-not-empty field="membersPartyId"> + <iterate entry="memberPartyId" list="membersPartyId"> + <call-service service-name="unassignPartyFromWorkEffort" in-map-name="memberPartyId"></call-service> + </iterate> + </if-not-empty> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + + <simple-method method-name="createScrumProject" short-description="Create Scrum Project and Product Owner"> + <!-- Permission Check --> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_PROJECT" action="_CREATE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + <if-has-permission permission="SCRUM_PROJECT_ROLE" action="_ADMIN"/> + <if-has-permission permission="SCRUM_PROJECT" action="_ADMIN"/> + <if-has-permission permission="SCRUM_PROJECT" action="_UPDATE"/> + </or> + </condition> + <then> + <now-timestamp field="now"/> + <entity-one entity-name="UserLogin" value-field="sysUserLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set-service-fields service-name="createWorkEffort" to-map="createProject" map="parameters"/> + <set field="createProject.workEffortTypeId" value="SCRUM_PROJECT"/> + <set field="createProject.currentStatusId" value="SPJ_ACTIVE"/> + <set field="createProject.userLogin" from-field="sysUserLogin"/> + <call-service service-name="createWorkEffort" in-map-name="createProject" > + <result-to-field result-name="workEffortId" field="workEffortId"/> + </call-service> + <field-to-request field="workEffortId" request-name="projectId"/> + <log level="info" message="Creating new project, projectId=${workEffortId}"/> + <!-- Create workeffort associate with product --> + <make-value value-field="goodStandardMap" entity-name="WorkEffortGoodStandard"/> + <set field="goodStandardMap.workEffortId" from-field="workEffortId"/> + <set field="goodStandardMap.productId" from-field="parameters.productId"/> + <set field="goodStandardMap.workEffortGoodStdTypeId" value="SCRUM_PRO_WORKEFF"/> + <set field="goodStandardMap.fromDate" from-field="now"/> + <set field="goodStandardMap.statusId" value="WEGS_CREATED"/> + <create-value value-field="goodStandardMap"/> + <!-- Create project billed options --> + <if-not-empty field="parameters.billed"> + <make-value value-field="workEffortAttMap" entity-name="WorkEffortAttribute"/> + <set field="workEffortAttMap.workEffortId" from-field="workEffortId"/> + <set field="workEffortAttMap.attrName" value="PROJECT_BILLED"/> + <set field="workEffortAttMap.attrValue" from-field="parameters.billed"/> + <create-value value-field="workEffortAttMap"/> + </if-not-empty> + + <set-service-fields service-name="assignPartyToWorkEffort" map="parameters" to-map="assign"/> + <set field="assign.workEffortId" from-field="workEffortId"/> + <set field="assign.partyId" from-field="productRole[0].partyId"/> + <set field="assign.roleTypeId" value="PRODUCT_OWNER"/> + <set field="assign.statusId" value="PRTYASGN_ASSIGNED"/> + <set field="assign.userLogin" from-field="sysUserLogin"/> + <log level="info" message="Assign partyId ${assign.partyId} to projectId=${workEffortId}"/> + <call-service service-name="assignPartyToWorkEffort" in-map-name="assign"/> + + <entity-and entity-name="PartyRole" list="listPartyRoleScrumMaster"> + <field-map field-name="partyId" from-field="userLogin.partyId"/> + <field-map field-name="roleTypeId" value="SCRUM_MASTER"/> + </entity-and> + <if-not-empty field="listPartyRoleScrumMaster"> + <set-service-fields service-name="assignPartyToWorkEffort" map="parameters" to-map="assignScrumMaster"/> + <set field="assignScrumMaster.workEffortId" from-field="workEffortId"/> + <set field="assignScrumMaster.partyId" from-field="userLogin.partyId"/> + <set field="assignScrumMaster.roleTypeId" value="SCRUM_MASTER"/> + <set field="assignScrumMaster.statusId" value="PRTYASGN_ASSIGNED"/> + <set field="assignScrumMaster.userLogin" from-field="sysUserLogin"/> + <log level="info" message="Assign partyId ${assignScrumMaster.partyId} to projectId=${workEffortId}"/> + <call-service service-name="assignPartyToWorkEffort" in-map-name="assignScrumMaster"/> + </if-not-empty> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <log level="error" message="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + + <simple-method method-name="updateScrumProject" short-description="Update Scrum Project and Product Owner"> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_PROJECT" action="_UPDATE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + <if-has-permission permission="SCRUM_PROJECT_ROLE" action="_ADMIN"/> + </or> + </condition> + <then> + <now-timestamp field="now"/> + <set-service-fields service-name="updateWorkEffort" to-map="updateProject" map="parameters"/> + <call-service service-name="updateWorkEffort" in-map-name="updateProject"/> + <!-- remove old workeffort associate with product --> + <entity-and list="workEffGSDList" entity-name="WorkEffortGoodStandard"> + <field-map field-name="workEffortId" from-field="parameters.workEffortId"/> + <field-map field-name="workEffortGoodStdTypeId" value="SCRUM_PRO_WORKEFF"/> + </entity-and> + <if-not-empty field="workEffGSDList"> + <remove-list list="workEffGSDList"/> + </if-not-empty> + <!-- create old workeffort associate with product --> + <make-value value-field="goodStandardMap" entity-name="WorkEffortGoodStandard"/> + <set field="goodStandardMap.workEffortId" from-field="parameters.workEffortId"/> + <set field="goodStandardMap.productId" from-field="parameters.productId"/> + <set field="goodStandardMap.workEffortGoodStdTypeId" value="SCRUM_PRO_WORKEFF"/> + <set field="goodStandardMap.fromDate" from-field="now"/> + <set field="goodStandardMap.statusId" value="WEGS_CREATED"/> + <create-value value-field="goodStandardMap"/> + <!-- update project billed options --> + <entity-one value-field="workEffortAttMap" entity-name="WorkEffortAttribute"> + <field-map field-name="workEffortId" from-field="parameters.workEffortId"/> + <field-map field-name="attrName" value="PROJECT_BILLED"/> + </entity-one> + <if-not-empty field="workEffortAttMap"> + <set field="workEffortAttMap.attrValue" from-field="parameters.billed"/> + <store-value value-field="workEffortAttMap"/> + <else> + <make-value value-field="workEffortAttMap" entity-name="WorkEffortAttribute"/> + <set field="workEffortAttMap.workEffortId" from-field="parameters.workEffortId"/> + <set field="workEffortAttMap.attrName" value="PROJECT_BILLED"/> + <set field="workEffortAttMap.attrValue" from-field="parameters.billed"/> + <create-value value-field="workEffortAttMap"/> + </else> + </if-not-empty> + <!-- update project current status to closed --> + <if-compare operator="equals" field="parameters.currentStatusId" value="SPJ_CLOSED"> +<!-- <entity-and entity-name="ProjectSprintBacklogAndTask" list="sprintList">--> +<!-- <field-map field-name="projectId" from-field="parameters.projectId"/>--> +<!-- <field-map field-name="sprintTypeId" value="SCRUM_SPRINT"/>--> +<!-- </entity-and>--> + <entity-and list="sprintList" entity-name="ProjectSprint"> + <field-map field-name="projectId" from-field="parameters.projectId"/> + <field-map field-name="projectTypeId" value="SCRUM_PROJECT"/> + </entity-and> + <if-not-empty field="sprintList"></if-not-empty> + <iterate entry="sprint" list="sprintList"> + <!-- Check current status --> + <entity-one value-field="sprintEntry" entity-name="WorkEffort"> + <field-map field-name="workEffortId" from-field="sprint.sprintId"/> + </entity-one> + <if-not-empty field="sprintEntry"> + <if-compare operator="not-equals" value="SPRINT_CLOSED" field="sprintEntry.currentStatusId"> + <set field="updateStatus.currentStatusId" value="SPRINT_CLOSED"/> + <set field="updateStatus.workEffortId" from-field="sprint.sprintId"/> + <call-service service-name="updateWorkEffort" in-map-name="updateStatus"/> + <!-- clear unneccessay parameters --> + <clear-field field="parameters.currentStatusId"/> + <set field="parameters.projectId" from-field="parameters.projectId"/> + <set field="parameters.sprintId" from-field="sprint.sprintId"/> + <call-simple-method method-name="closeSprint"/> + </if-compare> + </if-not-empty> + </iterate> + </if-compare> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + + <simple-method method-name="deleteCustRequestItem" short-description="Delete Cust Request Item" login-required="false"> + <set field="custRequestItemCtx.custRequestItemSeqId" from-field="parameters.custRequestItemSeqId"/> + <remove-by-and entity-name="CustRequestItemNote" map="custRequestItemCtx"/> + <remove-by-and entity-name="CustRequestItemWorkEffort" map="custRequestItemCtx"/> + + <make-value value-field="deleteCustRequestItem" entity-name="CustRequestItem"/> + <set-pk-fields value-field="deleteCustRequestItem" map="parameters"/> + <set-nonpk-fields value-field="deleteCustRequestItem" map="parameters"/> + <remove-value value-field="deleteCustRequestItem"/> + </simple-method> + + <simple-method method-name="deleteCustRequest" short-description="Delete a draft Customer Request with no relations yet"> + <call-simple-method method-name="getWebSiteId"/> + <!-- Permission Check --> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_PRODUCT_BACKLOG" action="_DELETE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <entity-one value-field="custRequest" entity-name="CustRequest"/> + <!-- check related work effort --> + <get-related relation-name="CustRequestWorkEffort" list="custRequestWorkEfforts" value-field="custRequest"/> + <entity-condition list="taskCancelledList" entity-name="ProductBacklog"> + <condition-list combine="and"> + <condition-expr field-name="custRequestId" from-field="custRequest.custRequestId"/> + <condition-expr field-name="workEffortStatusId" value="STS_CANCELLED"/> + <condition-list combine="or"> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_ERROR"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_IMPL"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_INST"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_TEST"/> + </condition-list> + </condition-list> + <select-field field-name="workEffortId"/> + </entity-condition> + <set field="taskCancelCount" value="${groovy: taskCancelledList.size()}" default-value="0" type="Integer"/> + <set field="custCount" value="${groovy: custRequestWorkEfforts.size()}" default-value="0" type="Integer"/> + <!-- get actual Hours --> + <entity-condition list="taskList" entity-name="ProductBacklog"> + <condition-list combine="and"> + <condition-expr field-name="custRequestId" from-field="custRequest.custRequestId"/> + <condition-list combine="or"> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_ERROR"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_IMPL"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_INST"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_TEST"/> + </condition-list> + </condition-list> + <select-field field-name="workEffortId"/> + </entity-condition> + <if-not-empty field="taskList"> + <iterate entry="task" list="taskList"> + <set field="taskIdCond[+0]" from-field="task.workEffortId" /> + </iterate> + <entity-condition list="timeEntries" entity-name="TimeEntry"> + <condition-expr field-name="workEffortId" operator="in" from-field="taskIdCond" /> + <order-by field-name="workEffortId" /> + </entity-condition> + </if-not-empty> + <set field="actualHours" type="Double" value="0.0" /> + <if-not-empty field="timeEntries"> + <iterate entry="timeEntry" list="timeEntries"> + <if-not-empty field="timeEntry.hours"> + <calculate field="actualHours" type="Double"> + <calcop operator="add" field="timeEntry.hours"> + <calcop operator="get" field="actualHours" /> + </calcop> + </calculate> + </if-not-empty> + </iterate> + </if-not-empty> + <if> + <condition> + <and> + <if-compare-field field="taskCancelCount" operator="not-equals" to-field="custCount"/> + <if-compare field="actualHours" operator="greater" value="0"/> + </and> + </condition> + <then> + <add-error> + <fail-message message="Could not delete the backlog [${custRequest.custRequestId}] because there are tasks related and the actual hours(${actualHours}) is existing."/> + </add-error> + <check-errors/> + </then> + </if> + <!-- set default custRequestName --> + <if-empty field="custRequest.custRequestName"> + <set field="custRequest.custRequestName" value="product backlog[${custRequest.custRequestId}]"/> + <store-value value-field="custRequest"/> + </if-empty> + <set field="custRequest.reason" from-field="parameters.reason"/> + <if-not-empty field="custRequest"> + <set field="input.custRequestId" from-field="custRequest.custRequestId"/> + <set field="input.reason" from-field="custRequest.reason"/> + <set field="input.statusId" value="CRQ_CANCELLED"/> + <set field="input.webSiteId" from-field="parameters.webSiteId"/> + <call-service service-name="setCustRequestStatus" in-map-name="input"/> + </if-not-empty> + <!-- remove assigned task --> + <if-not-empty field="taskList"> + <iterate entry="taskMap" list="taskList"> + <entity-and list="assignmentList" entity-name="WorkEffortPartyAssignment"> + <field-map field-name="workEffortId" from-field="taskMap.workEffortId"/> + </entity-and> + <if-not-empty field="assignmentList"> + <remove-list list="assignmentList"/> + </if-not-empty> + <!-- remove task from sprint if applicable--> + <entity-one value-field="workEffortMap" entity-name="WorkEffort"> + <field-map field-name="workEffortId" from-field="taskMap.workEffortId"/> + </entity-one> + <if-not-empty field="workEffortMap.workEffortParentId"> + <clear-field field="workEffortMap.workEffortParentId"/> + <store-value value-field="workEffortMap"/> + </if-not-empty> + </iterate> + </if-not-empty> + <!-- remove the custRequest from sprint if applicable--> + <entity-and list="custWorkEffortList" entity-name="CustRequestWorkEffort"> + <field-map field-name="custRequestId" from-field="custRequest.custRequestId"/> + </entity-and> + <if-not-empty field="custWorkEffortList"> + <iterate entry="custWorkEffortMap" list="custWorkEffortList"> + <entity-one value-field="workEffortMap" entity-name="WorkEffort"> + <field-map field-name="workEffortId" from-field="custWorkEffortMap.workEffortId"/> + </entity-one> + <if-compare field="workEffortMap.workEffortTypeId" operator="equals" value="SCRUM_SPRINT" > + <remove-value value-field="custWorkEffortMap"/> + </if-compare> + </iterate> + </if-not-empty> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + </simple-method> + <simple-method method-name="updateProductBacklogItemRows" short-description="Update product backlog item rows in multi form"> + <!-- Permission Check --> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_PRODUCT_BACKLOG" action="_DELETE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <call-class-method method-name="getParameterMap" class-name="org.ofbiz.base.util.UtilHttp" ret-field="paramMap"> + <field field="request" type="javax.servlet.http.HttpServletRequest"/> + </call-class-method> + <call-class-method method-name="getMultiFormRowCount" class-name="org.ofbiz.base.util.UtilHttp" ret-field="rowCount"> + <field field="paramMap" type="java.util.Map"/> + </call-class-method> + + <!-- get all data to list --> + <set field="custRequestIndexList" type="List"/> + <set field="custRequestList" type="List"/> + <loop count="${rowCount}" field="j"> + <set field="custRequestMap" value="null" type="NewMap"/> + <set field="custRequestMap.custRequestId" from-field="paramMap["custRequestId_o_${j}"]"/> + <set field="custRequestMap.sequenceNum" from-field="paramMap["realSequenceNum_o_${j}"]"/> + <field-to-list list="custRequestList" field="custRequestMap"/> + <field-to-list list="custRequestIndexList" field="paramMap["realSequenceNum_o_${j}"]"/> + </loop> + <set field="newCustRequestList" type="List"/> + <set field="custRequestListWithNewSeq" type="List"/> + <loop count="${rowCount}" field="k"> + <set field="custRequestMap" value="null" type="NewMap"/> + <set field="custRequestMap.custRequestId" from-field="paramMap["custRequestId_o_${k}"]"/> + <set field="oldSequenceNum" from-field="paramMap["realSequenceNum_o_${k}"]"/> + <set field="newSequenceNum" from-field="paramMap["newSequenceNum_o_${k}"]"/> + <if-not-empty field="newSequenceNum"> + <set field="custRequestMap.sequenceNum" from-field="newSequenceNum"/> + <field-to-list list="custRequestListWithNewSeq" field="custRequestMap"/> + <else> + <set field="custRequestMap.sequenceNum" from-field="oldSequenceNum"/> + <field-to-list list="newCustRequestList" field="custRequestMap"/> + </else> + </if-not-empty> + </loop> + + <!-- get size --> + <set field="custRequestListSize" value="${groovy: custRequestList.size();}" type="Double"/> + + <!-- Check if there are duplicate value will reorder and change it --> + <set field="custRequestIndex" type="List"/> + <set field="custRequestIndexToSet" value="${groovy: import java.util.Set; new HashSet(custRequestIndexList);}"/> + <set field="custRequestIndexToList" from-field="custRequestIndexToSet" type="List"/> + <iterate entry="custRequestIndexMap" list="custRequestIndexToList"> + <set field="count" value="0" type="Integer"/> + <loop count="${custRequestListSize}" field="l"> + <if-compare-field field="custRequestList[l].sequenceNum" operator="equals" to-field="custRequestIndexMap" type="Integer"> + <set field="count" value="${count + 1}"/> + </if-compare-field> + </loop> + <if-compare field="count" operator="greater" value="1" type="Integer"> + <set field="custRequestIndexMap" from-field="custRequestIndexMap" type="Integer"/> + <field-to-list list="custRequestIndex" field="custRequestIndexMap"/> + </if-compare> + </iterate> + <if-not-empty field="custRequestIndex"> + <call-bsh><![CDATA[ + List indexList = custRequestIndex; + Collections.sort(indexList); + Collections.reverse(indexList); + List uniqueCustRequestIndexList = indexList; + return org.ofbiz.base.util.UtilMisc.toMap("uniqueCustRequestIndexList", uniqueCustRequestIndexList); + ]]></call-bsh> + </if-not-empty> + <if-not-empty field="uniqueCustRequestIndexList"> + <iterate entry="custRequestIndexMap" list="uniqueCustRequestIndexList"> + <set field="count" value="0" type="Integer"/> + <loop count="${custRequestListSize}" field="m"> + <if> + <condition> + <if-compare-field field="custRequestList[m].sequenceNum" operator="equals" to-field="custRequestIndexMap" type="Integer"/> + </condition> + <then> + <set field="sequenceNumIndex" value="${custRequestList[m].sequenceNum + count}" type="Integer"/> + <set field="custRequestList[m].sequenceNum" from-field="sequenceNumIndex" type="String"/> + <entity-one value-field="newCustRequestMap" entity-name="CustRequest"> + <field-map field-name="custRequestId" from-field="custRequestList[m].custRequestId"/> + </entity-one> + <set field="nextSeqNum" value="${custRequestList[m].sequenceNum}" type="Long"/> + <set field="newCustRequestMap.sequenceNum" from-field="nextSeqNum"/> + <store-value value-field="newCustRequestMap"/> + <set field="count" value="${count + 1}"/> + </then> + <else> + <if-compare-field field="custRequestList[m].sequenceNum" operator="greater" to-field="custRequestIndexMap" type="Integer"> + <set field="sequenceNumIndex" value="${custRequestIndexMap + count}" type="Integer"/> + <set field="custRequestList[m].sequenceNum" from-field="sequenceNumIndex" type="String"/> + <entity-one value-field="newCustRequestMaps" entity-name="CustRequest"> + <field-map field-name="custRequestId" from-field="custRequestList[m].custRequestId"/> + </entity-one> + <set field="nextSeqNum" value="${custRequestList[m].sequenceNum}" type="Long"/> + <set field="newCustRequestMaps.sequenceNum" from-field="nextSeqNum"/> + <store-value value-field="newCustRequestMaps"/> + <set field="count" value="${count + 1}"/> + </if-compare-field> + </else> + </if> + </loop> + </iterate> + </if-not-empty> + + <!-- if new sequence not empty --> + <if-not-empty field="custRequestListWithNewSeq"> + <if-empty field="newCustRequestList"> + <!-- use when all field in new sequence not empty --> + <loop count="${rowCount}" field="l"> + <set field="newSeq" from-field="custRequestListWithNewSeq[l].sequenceNum" type="Integer"/> + <set field="oldSeq" from-field="custRequestList[newSeq-1].sequenceNum" type="Long"/> + <set field="custRequestId" from-field="custRequestListWithNewSeq[l].custRequestId"/> + <entity-one value-field="newCustRequestMap" entity-name="CustRequest"> + <field-map field-name="custRequestId" from-field="custRequestId"/> + </entity-one> + <set field="newCustRequestMap.sequenceNum" from-field="oldSeq"/> + <store-value value-field="newCustRequestMap"/> + </loop> + <else> + <!-- get size --> + <call-bsh><![CDATA[ + List custRequestSeq = custRequestListWithNewSeq; + List custRequestSeqList = org.ofbiz.base.util.UtilMisc.sortMaps(custRequestSeq, org.ofbiz.base.util.UtilMisc.toList("sequenceNum")); + return org.ofbiz.base.util.UtilMisc.toMap("custRequestSeqList", custRequestSeqList); + ]]></call-bsh> + <set field="custRequestListWithNewSeq" from-field="custRequestSeqList"/> + <call-object-method method-name="size" obj-field="custRequestListWithNewSeq" ret-field="newCustCount"/> + + <!-- start sort transaction --> + <loop count="${newCustCount}" field="l"> + <set field="custRequestId" from-field="custRequestListWithNewSeq[l].custRequestId"/> + <entity-one value-field="newCustRequestMap" entity-name="CustRequest"> + <field-map field-name="custRequestId" from-field="custRequestId"/> + </entity-one> + <if-compare field="newCustRequestMap.custRequestTypeId" operator="equals" value="RF_PROD_BACKLOG" > + <entity-and list="custRequestItemList" entity-name="CustRequestAndCustRequestItem"> + <field-map field-name="productId" from-field="parameters.productId"/> + <field-map field-name="custRequestTypeId" value="RF_PROD_BACKLOG"/> + <field-map field-name="statusId" value="CRQ_ACCEPTED"/> + <select-field field-name="custRequestId"/> + <select-field field-name="sequenceNum"/> + <order-by field-name="sequenceNum"/> + </entity-and> + <set field="custRequestList" from-field="custRequestItemList"/> + <call-object-method method-name="size" obj-field="custRequestList" ret-field="custCount"/> + <else> + <entity-and list="custRequestItemList" entity-name="CustRequestAndCustRequestItem"> + <field-map field-name="productId" from-field="parameters.productId"/> + <field-map field-name="custRequestTypeId" value="RF_UNPLAN_BACKLOG"/> + <field-map field-name="statusId" value="CRQ_ACCEPTED"/> + <select-field field-name="custRequestId"/> + <select-field field-name="sequenceNum"/> + <order-by field-name="sequenceNum"/> + </entity-and> + <set field="custRequestList" from-field="custRequestItemList"/> + <call-object-method method-name="size" obj-field="custRequestList" ret-field="custCount"/> + </else> + </if-compare> + <set field="newOfOldSeq" from-field="newCustRequestMap.sequenceNum" type="Long"/> + <set field="newSeq" from-field="custRequestListWithNewSeq[l].sequenceNum" type="Long"/> + <set field="oldSeq" from-field="custRequestList[newSeq-1].sequenceNum" type="Long" /> + <loop count="${custCount}" field="m"> + <set field="newcustRequestId" from-field="custRequestList[m].custRequestId"/> + <entity-one value-field="custRequestMap" entity-name="CustRequest"> + <field-map field-name="custRequestId" from-field="newcustRequestId"/> + </entity-one> + <set field="sequenceNum" from-field="custRequestMap.sequenceNum" type="Long"/> + <if-compare-field field="custRequestId" operator="not-equals" to-field="newcustRequestId"> + <if-compare-field field="newOfOldSeq" operator="not-equals" to-field="oldSeq" type="Long"> + <set field="readyDown" value="${groovy:(newOfOldSeq<oldSeq)&&(sequenceNum<=oldSeq)&&(sequenceNum>newOfOldSeq)}" type="Boolean"/> + <set field="readyUp" value="${groovy:(newOfOldSeq>oldSeq)&&(sequenceNum>=oldSeq)&&(sequenceNum<newOfOldSeq)}" type="Boolean"/> + <!-- use when number move down --> + <if> + <condition> + <if-compare field="readyDown" operator="equals" value="true" type="Boolean"/> + </condition> + <then> + <set field="nextSeqNum" value="${sequenceNum-1}" type="Long"/> + <set field="custRequestMap.sequenceNum" from-field="nextSeqNum"/> + <store-value value-field="custRequestMap"/> + </then> + </if> + <!-- use when number move up --> + <if> + <condition> + <and> + <if-compare field="readyUp" operator="equals" value="true" type="Boolean"/> + </and> + </condition> + <then> + <set field="nextSeqNum" value="${sequenceNum+1}" type="Long"/> + <set field="custRequestMap.sequenceNum" from-field="nextSeqNum"/> + <store-value value-field="custRequestMap"/> + </then> + </if> + </if-compare-field> + </if-compare-field> + </loop> + <set field="newCustRequestMap.sequenceNum" from-field="oldSeq" type="Long"/> + <store-value value-field="newCustRequestMap"/> + </loop> + </else> + </if-empty> + </if-not-empty> + + <set field="beDeleted" value="false" type="Boolean"/> + <loop count="${rowCount}" field="i"> + <set field="deleteFlag" from-field="paramMap["deleteFlag_o_${i}"]" default-value="N"/> + <set field="custRequestId" from-field="paramMap["custRequestId_o_${i}"]"/> + <set field="statusId" from-field="paramMap["statusId_o_${i}"]"/> + <!-- check CRQ_COMPLETED status --> + <if-compare field="statusId" operator="not-equals" value="CRQ_COMPLETED"> + <if-compare field="deleteFlag" operator="equals" value="Y"> + <!-- delete product backlog --> + <call-simple-method method-name="deleteCustRequest"/> + <set field="beDeleted" value="true" type="Boolean"/> + <else> + <!-- update category and plan hour --> + <entity-condition entity-name="CustRequestAndWorkEffort" list="existTasks"> + <condition-list combine="and"> + <condition-expr field-name="custRequestId" from-field="custRequestId"/> + <condition-expr field-name="workEffortTypeId" operator="not-equals" value="SCRUM_SPRINT"/> + </condition-list> + </entity-condition> + <set field="parentCustRequestId" from-field="paramMap["parentCustRequestId_o_${i}"]"/> + <set field="estimatedHours" from-field="paramMap["estimatedHours_o_${i}"]" type="Double"/> + <set field="updateCustRequestInMap.custRequestId" from-field="custRequestId"/> + <set field="updateCustRequestInMap.parentCustRequestId" from-field="parentCustRequestId"/> + <set field="estimatedMilliSeconds" value="${estimatedHours*1000*60*60}" default-value="0" type="Double"/> + <set field="updateCustRequestInMap.estimatedMilliSeconds" from-field="estimatedMilliSeconds" type="Double"/> + <if-not-empty field="existTasks"> + <log level="info" message="warningMessage====================Cannot update plan hour of backlog item[${custRequestId}] because there is existing task for that already."></log> + </if-not-empty> + <call-service service-name="updateCustRequest" in-map-name="updateCustRequestInMap"/> + </else> + </if-compare> + </if-compare> + </loop> + <!-- if some backlog item be deleted then re arrange sequenceNum field --> + <if-compare field="beDeleted" operator="equals" value="true" type="Boolean"> + <set field="reOrderProductBacklogItemSequenceNumberInMap.productId" from-field="parameters.productId"/> + <call-service service-name="reOrderProductBacklogItemSequenceNumber" in-map-name="reOrderProductBacklogItemSequenceNumberInMap"/> + </if-compare> + <!-- check warning message list --> + <if-not-empty field="warningMessageList"> + <set field="_event_message_" value="Warning ${warningMessageList}"/> + </if-not-empty> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + </if> + <field-to-request field="parameters.sequence" request-name="sequence"/> + <field-to-request field="parameters.UnplannedSequence" request-name="UnplannedSequence"/> + <field-to-request field="parameters.VIEW_SIZE_1" request-name="VIEW_SIZE_1"/> + <field-to-request field="parameters.VIEW_INDEX_1" request-name="VIEW_INDEX_1"/> + </simple-method> + + <simple-method method-name="createProductBacklog" short-description=""> + <!-- Permission Check --> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_PRODUCT_BACKLOG" action="_CREATE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <call-simple-method method-name="getWebSiteId"/> + <if-compare operator="equals" value="Y" field="parameters.unplannedFlag"> + <set field="custRequestTypeId" value="RF_UNPLAN_BACKLOG"/> + <else> + <set field="custRequestTypeId" value="RF_PROD_BACKLOG"/> + </else> + </if-compare> + <if-empty field="parameters.description"> + <add-error > + <fail-message message="There Product Backlog Item is missing, Please add."/> + </add-error> + <check-errors/> + </if-empty> + <if-empty field="parameters.sequenceNum"> + <set field="sequenceNumIn" value="1" type="Long"/> + <entity-count count-field="getNum" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="parameters.productId"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + </entity-count> + <if-compare operator="equals" value="0" field="getNum"> + <set field="createCustRequestInMap.sequenceNum" from-field="sequenceNumIn"/> + <else> + <entity-condition list="custRequestList" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="parameters.productId"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + <order-by field-name="sequenceNum"/> + </entity-condition> + <set field="productMap" from-field="custRequestList[getNum-1]"/> + <set field="nextSeq" from-field="productMap.sequenceNum" type="Integer"/> + <set field="newSequenceNum" value="${nextSeq+1}" type="Long"/> + <set field="createCustRequestInMap.sequenceNum" from-field="newSequenceNum" /> + </else> + </if-compare> + <else> + <!-- check duplicate data --> + <entity-count count-field="getNum" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="parameters.productId"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + </entity-count> + <!-- the first sequence number --> + <if-compare operator="equals" field="getNum" value="0"> + <set field="createCustRequestInMap.sequenceNum" from-field="parameters.sequenceNum"/> + <else> + <entity-condition list="custRequestList" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="productId" from-field="parameters.productId"/> + <condition-expr field-name="statusId" operator="equals" value="CRQ_ACCEPTED"/> + </condition-list> + <order-by field-name="sequenceNum"/> + </entity-condition> + <set field="sequenceNumkey" from-field="parameters.sequenceNum" type="Integer"/> + <set field="productMap" from-field="custRequestList[sequenceNumkey-1]"/> + <set field="externalSeq" from-field="productMap.sequenceNum" type="Long"/> + <!-- Insert new transaction to CustRequest --> + <loop count="${getNum}" field="j"> + <set field="internalSeq" from-field="custRequestList[j].sequenceNum" type="Long" /> + <set field="ready" value="${groovy:internalSeq>=externalSeq}" type="Boolean"/> + <if-compare field="ready" operator="equals" value="true" type="Boolean"> + <set field="custRequestId" from-field="custRequestList[j].custRequestId"/> + <entity-one value-field="custRequestMap" entity-name="CustRequest"> + <field-map field-name="custRequestId" from-field="custRequestId"/> + </entity-one> + <set field="sequenceNum" from-field="custRequestMap.sequenceNum"/> + <set field="nextSeqNum" value="${sequenceNum+1}" type="Long"/> + <set field="custRequestMap.sequenceNum" from-field="nextSeqNum"/> + <store-value value-field="custRequestMap"/> + </if-compare> + </loop> + <set field="createCustRequestInMap.sequenceNum" from-field="externalSeq"/> + </else> + </if-compare> + </else> + </if-empty> + <if-empty field="parameters.fromPartyId"> + <set field="createCustRequestInMap.fromPartyId" from-field="userLogin.partyId"/> + </if-empty> + <set field="changeToMilliSec" value="${parameters.estimatedMilliSeconds*1000*60*60}"/> + <set field="createCustRequestInMap.estimatedMilliSeconds" from-field="changeToMilliSec" type="Double"/> + <set field="createCustRequestInMap.billed" from-field="parameters.billed"/> + <set field="createCustRequestInMap.custRequestTypeId" from-field="custRequestTypeId"/> + <set field="createCustRequestInMap.statusId" value="CRQ_ACCEPTED"/> + <set field="createCustRequestInMap.custRequestName" value="Product Backlog"/> + <set field="createCustRequestInMap.description" from-field="parameters.description"/> + <set field="createCustRequestInMap.openDateTime" from-field="parameters.openDateTime"/> + <set field="createCustRequestInMap.closedDateTime" from-field="parameters.closedDateTime"/> + <set field="createCustRequestInMap.parentCustRequestId" from-field="parameters.parentCustRequestId"/> + <set field="createCustRequestInMap.webSiteId" from-field="parameters.webSiteId"/> + + <sequenced-id sequence-name="CustRequestItem" field="custRequestItemSeqId"/> + <set field="createCustRequestInMap.custRequestItemSeqId" from-field="custRequestItemSeqId"/> + <set field="createCustRequestInMap.story" from-field="parameters.story"/> + <set field="createCustRequestInMap.productId" from-field="parameters.productId"/> + <call-service service-name="createCustRequest" in-map-name="createCustRequestInMap"> + <result-to-field result-name="custRequestId"/> + </call-service> + <!-- create CustRequestNote --> + <if-not-empty field="parameters.noteInfo"> + <set field="newNoteMap.note" from-field="parameters.noteInfo"/> + <set field="newNoteMap.noteName" value="How to test"/> + <call-service service-name="createNote" in-map-name="newNoteMap"> + <result-to-field result-name="noteId" field="noteId"/> + </call-service> + <make-value value-field="newEntity" entity-name="CustRequestNote"/> + <set from-field="custRequestId" field="newEntity.custRequestId"/> + <set from-field="noteId" field="newEntity.noteId"/> + <create-value value-field="newEntity"/> + </if-not-empty> + <request-to-field field="parameters.productId" request-name="productId"/> + <request-to-field field="parameters.sequence" request-name="sequence"/> + <request-to-field field="parameters.UnplannedSequence" request-name="UnplannedSequence"/> + </then> + <else> + <set field="_error_message_" value="You are has no permission to perform this action."/> + <return response-code="error"/> + </else> + + </if> + + </simple-method> + + <simple-method method-name="updateSprintBacklog" short-description="Update Sprint Backlog"> + <call-simple-method method-name="getWebSiteId"/> + <set field="parameters.estimatedMilliSeconds" from-field="parameters.estimatedHours" type="Float"/> + <calculate field="parameters.estimatedMilliSeconds" type="Float"> + <calcop operator="multiply" field="parameters.estimatedMilliSeconds"> + <number value="3600000"/> + </calcop> + </calculate> + <set-service-fields service-name="updateCustRequest" to-map="inMap" map="parameters"/> + <call-service service-name="updateCustRequest" in-map-name="inMap"/> + </simple-method> + + <simple-method method-name="createSprintBacklog" short-description="Create Sprint Backlog"> + <if> + <condition> + <or> + <if-has-permission permission="SCRUM_SPRINT" action="_UPDATE"/> + <if-has-permission permission="SCRUM" action="_ADMIN"/> + </or> + </condition> + <then> + <call-simple-method method-name="getWebSiteId"/> + <set field="parameters.sprintBacklogs" value="${parameters.sprintBacklogs}-1" type="Integer"/> + <entity-and entity-name="WorkEffortAndProduct" list="projectList"> + <field-map field-name="workEffortId" from-field="parameters.projectId"/> + </entity-and> + <first-from-list entry="project" list="projectList"/> + <entity-one value-field="workEffortAttMap" entity-name="WorkEffortAttribute"> + <field-map field-name="workEffortId" from-field="parameters.projectId"/> + <field-map field-name="attrName" value="PROJECT_BILLED"/> + </entity-one> + <entity-condition list="custRequestList" entity-name="CustRequestAndCustRequestItem"> + <condition-list combine="and"> + <condition-expr field-name="custRequestTypeId" value="RF_PROD_BACKLOG" /> + <condition-expr field-name="statusId" value="CRQ_ACCEPTED" /> + <condition-expr field-name="productId" from-field="project.productId"/> + </condition-list> + <order-by field-name="sequenceNum"/> + </entity-condition> + + <loop count="${parameters.sprintBacklogs}" field="i"> + <set field="sequenceNumx" value="${i+1}"/> + <set field="sprintBL.custRequestId" from-field="custRequestList[i].custRequestId"/> + <set field="sprintBL.workEffortId" from-field="parameters.sprintId"/> + <set field="sprintBL.userLogin" from-field="userLogin"/> + <call-service service-name="createWorkEffortRequest" in-map-name="sprintBL"/> + <set field="inMap.custRequestId" from-field="custRequestList[i].custRequestId"/> + <set field="inMap.statusId" value="CRQ_REVIEWED"/> + <set field="inMap.custRequestName" value=" "/> + <set field="inMap.webSiteId" from-field="parameters.webSiteId"/> + <!-- if the Billed field of the project was set. --> + <if-not-empty field="workEffortAttMap"> + <set field="inMap.billed" from-field="workEffortAttMap.attrValue"/> + </if-not-empty> + <set field="inMap.webSiteId" from-field="parameters.webSiteId"/> + <call-service service-name="updateCustRequest" in-map-name="inMap"/> + <!-- Check If there are tasks already in a backlog --> + <entity-condition entity-name="WorkEffortCustRequestView" list="backlogItemTaskList"> + <condition-list combine="and"> + <condition-expr field-name="custRequestId" from-field="custRequestList[i].custRequestId"/> + <condition-list combine="or"> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_ERROR"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_IMPL"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_INST"/> + <condition-expr field-name="workEffortTypeId" value="SCRUM_TASK_TEST"/> + </condition-list> + </condition-list> + </entity-condition> + <if-empty field="backlogItemTaskList"> + <entity-and entity-name="WorkEffortAndProduct" list="defaultTaskList"> + <field-map field-name="workEffortPurposeTypeId" value="SCRUM_DEFAULT_TASK"/> + <field-map field-name="productId" from-field="project.productId"/> + </entity-and> + <if-not-empty field="defaultTaskList"> + <iterate entry="defaultTask" list="defaultTaskList"> + <set field="newDefaultTask.workEffortName" from-field="defaultTask.workEffortName"/> + <set field="newDefaultTask.estimatedMilliSeconds" from-field="defaultTask.estimatedMilliSeconds"/> + <set field="newDefaultTask.currentStatusId" from-field="defaultTask.currentStatusId"/> + <set field="newDefaultTask.workEffortTypeId" from-field="defaultTask.workEffortTypeId"/> + <set field="newDefaultTask.workEffortParentId" from-field="parameters.sprintId"/> + <call-service service-name="createWorkEffort" in-map-name="newDefaultTask"> + <result-to-field result-name="workEffortId"/> + </call-service> + <set field="newBacklogItemTask.custRequestId" from-field="custRequestList[i].custRequestId"/> + <set field="newBacklogItemTask.workEffortId" from-field="workEffortId"/> + <set field="newBacklogItemTask.userLogin" from-field="userLogin"/> + <call-service service-name="createWorkEffortRequest" in-map-name="newBacklogItemTask"/> + <!-- Assigned party for default task--> + <entity-condition entity-name="WorkEffortPartyAssignment" list="assigneds"> + <condition-list combine="and"> + <condition-expr field-name="statusId" value="PRTYASGN_ASSIGNED"/> + <condition-expr field-name="workEffortId" from-field="defaultTask.workEffortId"/> + </condition-list> + </entity-condition> + <if-not-empty field="assigneds"> + <first-from-list entry="assignedMap" list="assigneds"/> + <set field="newInput.partyId" from-field="assignedMap.partyId"></set> + <set field="newInput.workEffortId" from-field="workEffortId"></set> + <set field="newInput.roleTypeId" from-field="assignedMap.roleTypeId"></set> + <set field="newInput.statusId" value="SCAS_ASSIGNED"></set> + <set field="newInput.userLogin" from-field="userLogin"/> + <call-service service-name="assignPartyToWorkEffort" in-map-name="newInput"/> + <!-- Assigned party for sprint --> + <entity-condition entity-name="WorkEffortPartyAssignment" list="sprintAssigneds"> + <condition-list combine="and"> + <condition-expr field-name="partyId" from-field="assignedMap.partyId"/> + <condition-expr field-name="statusId" value="PRTYASGN_ASSIGNED"/> + <condition-expr field-name="workEffortId" from-field="parameters.sprintId"/> + </condition-list> + </entity-condition> + <if-empty field="sprintAssigneds"> + <set field="sprintInput.partyId" from-field="assignedMap.partyId"></set> + <set field="sprintInput.workEffortId" from-field="parameters.sprintId"></set> + <set field="sprintInput.roleTypeId" from-field="assignedMap.roleTypeId"></set> + <set field="sprintInput.statusId" value="PRTYASGN_ASSIGNED"></set> + <set field="sprintInput.userLogin" from-field="userLogin"/> + <call-service service-name="assignPartyToWorkEffort" in-map-name="sprintInput"/> + </if-empty> + </if-not-empty> + </iterate> + <else> + <!-- If not have default task in product level --> + <entity-and list="defaultTaskScrum" entity-name="WorkEffort"> + <field-map field-name="workEffortPurposeTypeId" value="SYSTEM_DEFAULT_TASK"/> + </entity-and> + <if-not-empty field="defaultTaskScrum"> + <iterate entry="defaultScrum" list="defaultTaskScrum"> + <set field="newDefaultTaskScrum.workEffortName" from-field="defaultScrum.workEffortName"/> + <set field="newDefaultTaskScrum.estimatedMilliSeconds" from-field="defaultScrum.estimatedMilliSeconds"/> + <set field="newDefaultTaskScrum.currentStatusId" from-field="defaultScrum.currentStatusId"/> + <set field="newDefaultTaskScrum.workEffortTypeId" from-field="defaultScrum.workEffortTypeId"/> + <set field="newDefaultTaskScrum.workEffortParentId" from-field="parameters.sprintId"/> + <call-service service-name="createWorkEffort" in-map-name="newDefaultTaskScrum"> + <result-to-field result-name="workEffortId"/> + </call-service> + <set field="newBacklogItemTaskScrum.custRequestId" from-field="custRequestList[i].custRequestId"/> + <set field="newBacklogItemTaskScrum.workEffortId" from-field="workEffortId"/> + <set field="newBacklogItemTaskScrum.userLogin" from-field="userLogin"/> + <call-service service-name="createWorkEffortRequest" in-map-name="newBacklogItemTaskScrum"/> + <!-- Assigned party for default task--> + <entity-condition entity-name="WorkEffortPartyAssignment" list="assigneds"> + <condition-list combine="and"> + <condition-expr field-name="statusId" value="PRTYASGN_ASSIGNED"/> + <condition-expr field-name="workEffortId" from-field="defaultScrum.workEffortId"/> + </condition-list> + </entity-condition> + <if-not-empty field="assigneds"> + <first-from-list entry="assignedMap" list="assigneds"/> + <set field="newInput.partyId" from-field="assignedMap.partyId"></set> + <set field="newInput.workEffortId" from-field="workEffortId"></set> + <set field="newInput.roleTypeId" from-field="assignedMap.roleTypeId"></set> + <set field="newInput.statusId" value="SCAS_ASSIGNED"></set> + <set field="newInput.userLogin" from-field="userLogin"/> + <call-service service-name="assignPartyToWorkEffort" in-map-name="newInput"/> + <!-- Assigned party for sprint --> + <entity-condition entity-name="WorkEffortPartyAssignment" list="sprintAssigneds"> + <condition-list combine="and"> + <condition-expr field-name="partyId" from-field="assignedMap.partyId"/> + <condition-expr field-name="statusId" value="PRTYASGN_ASSIGNED"/> + <condition-expr field-name="workEffortId" from-field="parameters.sprintId"/> + </condition-list> + </entity-condition> + <if-empty field="sprintAssigneds"> + <set field="sprintInput.partyId" from-field="assignedMap.partyId"></set> + <set field="sprintInput.workEffortId" from-field="parameters.sprintId"></set> [... 3197 lines stripped ...] |
Free forum by Nabble | Edit this page |