Author: pgil
Date: Wed Nov 18 11:54:40 2015 New Revision: 1714976 URL: http://svn.apache.org/viewvc?rev=1714976&view=rev Log: OFBIZ-5750 I did review all createPartyRole service call in java/minilang/groovy, and replace some of the occurence with ensurePartyRole, one in SubscriptionServices.java that could cause issue, and others to ease the readability. Thanks Taher for reporting Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml ofbiz/trunk/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java Wed Nov 18 11:54:40 2015 @@ -1477,7 +1477,7 @@ public class ContentManagementServices { map.put("partyId", partyId); map.put("roleTypeId", roleTypeId); map.put("userLogin", userLogin); - dispatcher.runSync("createPartyRole", map); + dispatcher.runSync("ensurePartyRole", map); contentRole.create(); } } catch (GenericEntityException e) { Modified: ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml (original) +++ ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml Wed Nov 18 11:54:40 2015 @@ -23,15 +23,9 @@ <set field="parameters.roleTypeId" value="ACCOUNT"/> <call-simple-method method-name="createPartyGroupRoleAndContactMechs" xml-resource="component://party/script/org/ofbiz/party/party/PartySimpleMethods.xml"/> <field-to-result field="partyId"/> - <set field="createPartyRoleCtx.partyId" from-field="userLogin.partyId"/> - <set field="createPartyRoleCtx.roleTypeId" value="OWNER"/> - <entity-one entity-name="PartyRole" value-field="partyRole"> - <field-map field-name="partyId" from-field="createPartyRoleCtx.partyId"/> - <field-map field-name="roleTypeId" from-field="createPartyRoleCtx.roleTypeId"/> - </entity-one> - <if-empty field="partyRole"> - <call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/> - </if-empty> + <set field="ensurePartyRoleCtx.partyId" from-field="userLogin.partyId"/> + <set field="ensurePartyRoleCtx.roleTypeId" value="OWNER"/> + <call-service service-name="ensurePartyRole" in-map-name="ensurePartyRoleCtx"/> <set field="partyRelationshipCtx.partyIdFrom" from-field="userLogin.partyId"/> <set field="partyRelationshipCtx.partyIdTo" from-field="partyId"/> <set field="partyRelationshipCtx.roleTypeIdFrom" value="OWNER"/> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml Wed Nov 18 11:54:40 2015 @@ -145,13 +145,7 @@ This file contains basic services for Sa <if-not-empty field="parameters.accountPartyId"> <set field="roleMap.roleTypeId" value="ACCOUNT"/> <set field="roleMap.partyId" from-field="parameters.accountPartyId"/> - <entity-one value-field="partyRole" entity-name="PartyRole"> - <field-map field-name="roleTypeId" from-field="roleMap.roleTypeId"/> - <field-map field-name="partyId" from-field="roleMap.partyId"/> - </entity-one> - <if-empty field="partyRole"> - <call-service service-name="createPartyRole" in-map-name="roleMap"/> - </if-empty> + <call-service service-name="ensurePartyRole" in-map-name="roleMap"/> </if-not-empty> <set field="salesOpportunityRole.roleTypeId" value="ACCOUNT"/> <set field="salesOpportunityRole.salesOpportunityId" from-field="parameters.salesOpportunityId"/> @@ -171,15 +165,7 @@ This file contains basic services for Sa </if-not-empty> <!-- Check party role for create Lead Role --> <if-not-empty field="parameters.leadPartyId"> - <entity-one value-field="leadRole" entity-name="PartyRole"> - <field-map field-name="partyId" from-field="parameters.leadPartyId"/> - <field-map field-name="roleTypeId" value="LEAD"/> - </entity-one> - <if-empty field="leadRole"> - <set field="roleMap.roleTypeId" value="LEAD"/> - <set field="roleMap.partyId" from-field="parameters.leadPartyId"/> - <call-service service-name="createPartyRole" in-map-name="roleMap"/> - </if-empty> + <call-service service-name="ensurePartyRole" in-map-name="roleMap"/> </if-not-empty> <set field="salesOpportunityRole.roleTypeId" value="LEAD"/> <set field="salesOpportunityRole.salesOpportunityId" from-field="parameters.salesOpportunityId"/> Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml Wed Nov 18 11:54:40 2015 @@ -51,13 +51,7 @@ under the License. <set field="partyRoleCtx.roleTypeId" value="CUSTOMER"/> <set field="partyRoleCtx.userLogin" from-field="userLogin"/> - <entity-one entity-name="PartyRole" value-field="partyRole"> - <field-map field-name="partyId" from-field="partyRoleCtx.partyId"/> - <field-map field-name="roleTypeId" from-field="partyRoleCtx.roleTypeId"/> - </entity-one> - <if-empty field="partyRole"> - <call-service service-name="createPartyRole" in-map-name="partyRoleCtx"/> - </if-empty> + <call-service service-name="ensurePartyRole" in-map-name="partyRoleCtx"/> <!-- Create Update Shipping address --> <set-service-fields service-name="createUpdateShippingAddress" map="parameters" to-map="shipToAddressCtx"/> Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml (original) +++ ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml Wed Nov 18 11:54:40 2015 @@ -435,12 +435,9 @@ under the License. <field-map field-name="userLoginId" value="system"/> </entity-one> - <entity-one entity-name="PartyRole" value-field="partyRole"/> - <if-empty field="partyRole"> - <set-service-fields service-name="createPartyRole" map="parameters" to-map="partyRole"/> - <set field="partyRole.userLogin" from-field="sysUserLogin"/> - <call-service service-name="createPartyRole" in-map-name="partyRole" include-user-login="false"/> - </if-empty> + <set-service-fields service-name="ensurePartyRole" map="parameters" to-map="partyRole"/> + <set field="partyRole.userLogin" from-field="sysUserLogin"/> + <call-service service-name="ensurePartyRole" in-map-name="partyRole" include-user-login="false"/> <make-value value-field="newEntity" entity-name="CommunicationEventRole"/> <set-pk-fields map="parameters" value-field="newEntity"/> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java Wed Nov 18 11:54:40 2015 @@ -148,12 +148,12 @@ public class SubscriptionServices { null, null, updateSubscriptionResult); } } else { - Map<String, Object> createPartyRoleMap = new HashMap<String, Object>(); + Map<String, Object> ensurePartyRoleMap = new HashMap<String, Object>(); if (UtilValidate.isNotEmpty(roleTypeId)) { - createPartyRoleMap.put("partyId", partyId); - createPartyRoleMap.put("roleTypeId", roleTypeId); - createPartyRoleMap.put("userLogin", userLogin); - Map<String, Object> createPartyRoleResult = dispatcher.runSync("createPartyRole", createPartyRoleMap); + ensurePartyRoleMap.put("partyId", partyId); + ensurePartyRoleMap.put("roleTypeId", roleTypeId); + ensurePartyRoleMap.put("userLogin", userLogin); + Map<String, Object> createPartyRoleResult = dispatcher.runSync("ensurePartyRole", ensurePartyRoleMap); if (ServiceUtil.isError(createPartyRoleResult)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ProductSubscriptionPartyRoleCreationError", Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml Wed Nov 18 11:54:40 2015 @@ -116,18 +116,10 @@ </if-not-empty> </simple-method> <simple-method method-name="addProjectMgrResource" short-description="make parties available in the project manager."> - <entity-one value-field="partyRole" entity-name="PartyRole"/> - <if-empty field="partyRole"> - <set-service-fields service-name="createPartyRole" map="parameters" to-map="roleData"/> - <call-service service-name="createPartyRole" in-map-name="roleData"/> - </if-empty> + <set-service-fields service-name="ensurePartyRole" map="parameters" to-map="roleData"/> + <call-service service-name="ensurePartyRole" in-map-name="roleData"/> <set field="roleData.roleTypeId" value="PROJECT_TEAM"/> - <entity-one value-field="partyRole" entity-name="PartyRole"> - <field-map field-name="roleTypeId" from-field="roleData.roleTypeId"/> - </entity-one> - <if-empty field="partyRole"> - <call-service service-name="createPartyRole" in-map-name="roleData"/> - </if-empty> + <call-service service-name="ensurePartyRole" in-map-name="roleData"/> </simple-method> <!-- create workEffort content --> <simple-method method-name="createWorkEffortContent" short-description="Creates Party Associated Content" login-required="false"> Modified: 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=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml (original) +++ ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml Wed Nov 18 11:54:40 2015 @@ -1252,15 +1252,10 @@ <if-compare operator="equals" value="SCRUM_STAKEHOLDER" field="parameters.groupId"> <set field="parameters.roleTypeId" value="STAKEHOLDER"/> </if-compare> - <entity-and list="partyRoles" entity-name="PartyRole"> - <field-map field-name="partyId" from-field="parameters.partyId"/> - <field-map field-name="roleTypeId" from-field="parameters.roleTypeId"/> - </entity-and> - <if-empty field="partyRoles"> - <set-service-fields service-name="createPartyRole" to-map="createPartyRole" map="parameters"/> - <set field="createPartyRole.userLogin" from-field="sysUserLogin"/> - <call-service service-name="createPartyRole" in-map-name="createPartyRole"/> - </if-empty> + + <set-service-fields service-name="ensurePartyRole" to-map="ensurePartyRole" map="parameters"/> + <set field="ensurePartyRole.userLogin" from-field="sysUserLogin"/> + <call-service service-name="ensurePartyRole" in-map-name="ensurePartyRole"/> <entity-one entity-name="UserLogin" value-field="sysUserLogin"> <field-map field-name="userLoginId" value="system"/> </entity-one> @@ -1284,18 +1279,12 @@ <check-errors/> </else> </if-empty> - <entity-and list="memberRoles" entity-name="PartyRole"> - <field-map field-name="partyId" from-field="parameters.partyId"/> - <field-map field-name="roleTypeId" value="SCRUM_MEMBER"/> - </entity-and> - <if-empty field="memberRoles"> - <set field="roleData.partyId" from-field="parameters.partyId"/> - <set field="roleData.roleTypeId" value="SCRUM_MEMBER"/> - <set field="roleData.userLogin" from-field="sysUserLogin"/> - <call-service service-name="createPartyRole" in-map-name="roleData"> - <default-message resource="CommonUiLabels" property="CommonSuccessfullyCreated"/> - </call-service> - </if-empty> + <set field="roleData.partyId" from-field="parameters.partyId"/> + <set field="roleData.roleTypeId" value="SCRUM_MEMBER"/> + <set field="roleData.userLogin" from-field="sysUserLogin"/> + <call-service service-name="ensurePartyRole" in-map-name="roleData"> + <default-message resource="CommonUiLabels" property="CommonSuccessfullyCreated"/> + </call-service> </simple-method> <simple-method method-name="createSprintBacklogTask" short-description="Create Sprint Backlog Task"> @@ -1538,16 +1527,11 @@ <entity-one entity-name="UserLogin" value-field="sysUserLogin"> <field-map field-name="userLoginId" value="system"/> </entity-one> - <entity-and entity-name="PartyRole" list="partyRoles"> - <field-map field-name="partyId" from-field="parameters.userLoginId"/> - <field-map field-name="roleTypeId" from-field="parameters.roleTypeId"/> - </entity-and> - <if-empty field="partyRoles"> - <set-service-fields service-name="createPartyRole" to-map="createPartyRole" map="parameters"/> - <set field="createPartyRole.userLogin" from-field="sysUserLogin"/> - <set field="createPartyRole.roleTypeId" from-field="parameters.roleTypeId"/> - <call-service service-name="createPartyRole" in-map-name="createPartyRole"/> - </if-empty> + + <set-service-fields service-name="ensurePartyRole" to-map="ensurePartyRole" map="parameters"/> + <set field="ensurePartyRole.userLogin" from-field="sysUserLogin"/> + <set field="ensurePartyRole.roleTypeId" from-field="parameters.roleTypeId"/> + <call-service service-name="ensurePartyRole" in-map-name="ensurePartyRole"/> <set-service-fields service-name="assignPartyToWorkEffort" to-map="assignPartyToWorkEffort" map="parameters"/> <set field="assignPartyToWorkEffort.userLogin" from-field="sysUserLogin"/> <call-service service-name="assignPartyToWorkEffort" in-map-name="assignPartyToWorkEffort"/> Modified: ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml?rev=1714976&r1=1714975&r2=1714976&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml (original) +++ ofbiz/trunk/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml Wed Nov 18 11:54:40 2015 @@ -464,16 +464,10 @@ <entity-one entity-name="UserLogin" value-field="systemUserLogin"> <field-map field-name="userLoginId" value="system"/> </entity-one> - <entity-one value-field="partyRoleMap" entity-name="PartyRole"> - <field-map field-name="partyId" from-field="timesheet.partyId"/> - <field-map field-name="roleTypeId" value="EMPLOYEE"/> - </entity-one> - <if-empty field="partyRoleMap"> - <set field="partyRoleMap.partyId" from-field="timesheet.partyId"/> - <set field="partyRoleMap.roleTypeId" value="EMPLOYEE"/> - <set field="partyRoleMap.userLogin" from-field="systemUserLogin"/> - <call-service service-name="createPartyRole" in-map-name="partyRoleMap"/> - </if-empty> + <set field="partyRoleMap.partyId" from-field="timesheet.partyId"/> + <set field="partyRoleMap.roleTypeId" value="EMPLOYEE"/> + <set field="partyRoleMap.userLogin" from-field="systemUserLogin"/> + <call-service service-name="ensurePartyRole" in-map-name="partyRoleMap"/> <loop count="7" field="dayNr"> <if> <condition> |
Free forum by Nabble | Edit this page |