Files
ofbiz-framework/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml
T
Jacques Le Roux b9c3ddef08 2d part and end of an effort to remove trailing spaces
[ \t]+$ => "" (empty)
Should be easier to review when committing changes with trailing spaces removed automatically by anyedit or such tool (please refer to http://docs.ofbiz.org/x/mg)

Of course this effort to remove trailing spaces has no functional implications.

Actually, I was doing a 1st commit and as it's long to upload, I got conflicts with r763135
In the meantime I did some refactoring also in *.java and *.groovy files :
){ => ) {
if( => if (
while( => while (
}else => } else
else{ => else {
switch( => switch (
try{ => try {
}catch => } catch
catch( => catch (
}finally{ => } finally {

So these changes are also in this commit, should not be a problem anyway.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@763175 13f79535-47bb-0310-9956-ffa450edef68
2009-04-08 10:54:51 +00:00

185 lines
11 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="CreateCustRequestAndAssignTaskToPerson" short-description="">
<set field="parameters.statusId" value="CRQ_ACCEPTED"/><!-- entered by employee, should only enter accepted customer requests -->
<set-service-fields service-name="createCustRequest" map="parameters" to-map="eventCreateCust"/>
<call-service service-name="createCustRequest" in-map-name="eventCreateCust">
<result-to-field result-name="custRequestId" field="custRequestId"/>
</call-service>
<if-not-empty field="parameters.workEffortParentId">
<set-service-fields service-name="createWorkEffort" map="parameters" to-map="createTask"/>
<set field="createTask.custRequestId" from-field="custRequestId"/>
<set field="createTask.workEffortName" from-field="parameters.custRequestName"/>
<call-service service-name="createWorkEffort" in-map-name="createTask" >
<result-to-field result-name="workEffortId" field="workEffortId"/>
</call-service>
<set field="updCust.statusId" value="CRQ_REVIEWED"/>
<set field="updCust.custRequestId" from-field="custRequestId"/>
<call-service service-name="updateCustRequest" in-map-name="updCust"/>
<if-not-empty field="parameters.partyId">
<set field="assignParty.workEffortId" from-field="workEffortId"/>
<set field="assignParty.partyId" from-field="parameters.partyId"/>
<set field="assignParty.roleTypeId" from-field="parameters.roleTypeId"/>
<set field="assignParty.statusId" value="PAS_ASSIGNED"/>
<call-service service-name="assignPartyToWorkEffort" in-map-name="assignParty"/>
</if-not-empty>
</if-not-empty>
</simple-method>
<simple-method method-name="acceptRequestAndConnectToTask" short-description="Accept a customer request and connect to an existing task">
<entity-one entity-name="WorkEffort" value-field="workEffort"/>
<if-empty field="workEffort">
<add-error><fail-property resource="uiLabelMap" property="ProjectMgrErrorTaskNotFound"/></add-error>
</if-empty>
<if-compare field="workEffort.currentStatusId" value="PTS_CREATED" operator="not-equals">
<add-error><fail-property resource="uiLabelMap" property="ProjectMgrErrorTaskStatusWrong"/></add-error>
</if-compare>
<entity-one entity-name="CustRequest" value-field="custRequest"/>
<if-empty field="custRequest">
<add-error><fail-property resource="uiLabelMap" property="ProjectMgrErrorRequestNotFound"/></add-error>
</if-empty>
<if-compare field="custRequest.statusId" value="CRQ_ACCEPTED" operator="not-equals">
<entity-one entity-name="StatusItem" value-field="status">
<field-map field-name="statusId" value="custRequest.statusId"/>
</entity-one>
<add-error><fail-property resource="uiLabelMap" property="ProjectMgrErrorRequestStatusWrong"/></add-error>
</if-compare>
<check-errors/>
<set field="updCust.statusId" value="CRQ_REVIEWED"/>
<set field="updCust.custRequestId" from-field="parameters.custRequestId"/>
<call-service service-name="updateCustRequest" in-map-name="updCust"/>
<set-service-fields service-name="createWorkEffortRequest" map="parameters" to-map="connectMap"/>
<call-service service-name="createWorkEffortRequest" in-map-name="connectMap"/>
</simple-method>
<simple-method method-name="setTaskStatusToComplete" short-description="Set the task status to complete, if resources assigned that status will also be set to complete">
<entity-one entity-name="WorkEffort" value-field="workEffort"/>
<if-empty field="workEffort">
<add-error><fail-property resource="uiLabelMap" property="ProjectMgrErrorTaskNotFound"/></add-error>
</if-empty>
<if-compare field="workEffort.currentStatusId" value="PTS_CREATED" operator="not-equals">
<add-error><fail-property resource="uiLabelMap" property="ProjectMgrErrorTaskStatusWrong"/></add-error>
</if-compare>
<check-errors/>
<entity-and entity-name="WorkEffortPartyAssignment" list="assigns" filter-by-date="true">
<field-map field-name="workEffortId" from-field="parameters.workEffortId"/>
</entity-and>
<!-- if all assigns are complete the task will be set to complete -->
<if-not-empty field="assigns">
<iterate entry="assign" list="assigns">
<set-service-fields service-name="updateTaskAssigment" map="assign" to-map="upd"/>
<set field="upd.statusId" value="PAS_COMPLETED"/>
<call-service service-name="updateTaskAssigment" in-map-name="upd"/>
</iterate>
<else>
<set-service-fields service-name="updateWorkEffort" map="parameters" to-map="upd"/>
<set field="upd.currentStatusId" value="PTS_COMPLETED"/>
<call-service service-name="updateWorkEffort" in-map-name="upd"/>
</else>
</if-not-empty>
</simple-method>
<simple-method method-name="addProjectMgrResource" short-description="make parties available in the project manager.">
<set-service-fields service-name="createPartyRole" map="parameters" to-map="roleData"/>
<call-service service-name="createPartyRole" in-map-name="roleData"/>
<set field="roleData.roleTypeId" value="PROJECT_TEAM"/>
<call-service service-name="createPartyRole" in-map-name="roleData"/>
</simple-method>
<!-- create workEffort content -->
<simple-method method-name="createWorkEffortContent" short-description="Creates Party Associated Content" login-required="false">
<call-class-method class-name="org.ofbiz.content.layout.LayoutWorker"
method-name="uploadImageAndParameters"
ret-field="formInput">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<string value="dataResourceName"/>
</call-class-method>
<set-service-fields service-name="createContentFromUploadedFile" map="formInput.formInput" to-map="inMap"/>
<set field="inMap._uploadedFile_fileName" from-field="formInput.imageFileName"/>
<set field="inMap.uploadedFile" from-field="formInput.imageData"/>
<set field="inMap._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
<call-service service-name="createContentFromUploadedFile" in-map-name="inMap">
<result-to-field result-name="contentId" field="context.contentId"/>
</call-service>
<if-empty field="formInput.formInput.workEffortId">
<if-not-empty field="formInput.formInput.projectId">
<set field="context.workEffortId" from-field="formInput.formInput.projectId"/>
</if-not-empty>
<else>
<set field="context.workEffortId" from-field="formInput.formInput.workEffortId"/>
</else>
</if-empty>
<set field="context.workEffortContentTypeId" from-field="formInput.formInput.workEffortContentTypeId"/>
<now-timestamp field="context.fromDate"/>
<call-map-processor in-map-name="context" out-map-name="workEffortContext">
<simple-map-processor name="newWorkEffortContent">
<process field="workEffortContentTypeId"><copy to-field="workEffortContentTypeId"/></process>
<process field="contentId"><copy to-field="contentId"/></process>
<process field="workEffortId"><copy to-field="workEffortId"/></process>
<process field="fromDate"><copy to-field="fromDate"/></process>
</simple-map-processor>
</call-map-processor>
<call-service service-name="createWorkEffortContent" in-map-name="workEffortContext">
<result-to-field result-name="contentId" field="contentId"/>
</call-service>
<!-- set the partyId in the request -->
<field-to-request field="context.workEffortId" request-name="workEffortId"/>
<field-to-request field="context.projectId" request-name="projectId"/>
<field-to-request field="contentId" request-name="contentId"/>
</simple-method>
<!-- Update workEffort content -->
<simple-method method-name="updateWorkEffortContent" short-description="Update Party Associated Content" login-required="false">
<call-class-method class-name="org.ofbiz.content.layout.LayoutWorker"
method-name="uploadImageAndParameters"
ret-field="formInput">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<string value="dataResourceName"/>
</call-class-method>
<entity-one entity-name="Content" value-field="content">
<field-map field-name="contentId" from-field="formInput.formInput.contentId"/>
</entity-one>
<set-service-fields service-name="updateContentAndUploadedFile" map="formInput.formInput" to-map="inMap"/>
<set field="inMap._uploadedFile_fileName" from-field="formInput.imageFileName"/>
<set field="inMap.uploadedFile" from-field="formInput.imageData"/>
<set field="inMap._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
<set field="inMap.contentId" from-field="formInput.formInput.contentId"/>
<set field="inMap.dataResourceId" from-field="content.dataResourceId"/>
<call-service service-name="updateContentAndUploadedFile" in-map-name="inMap">
<result-to-field result-name="contentId" field="context.contentId"/>
</call-service>
<if-empty field="formInput.formInput.workEffortId">
<if-not-empty field="formInput.formInput.projectId">
<set field="workEffortId" from-field="formInput.formInput.projectId"/>
</if-not-empty>
<else>
<set field="workEffortId" from-field="formInput.formInput.workEffortId"/>
</else>
</if-empty>
<!-- set the partyId in the request -->
<field-to-request field="workEffortId" request-name="workEffortId"/>
<field-to-request field="projectId" request-name="projectId"/>
<field-to-request field="contentId" request-name="context"/>
</simple-method>
</simple-methods>