You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by pg...@apache.org on 2015/11/18 12:54:49 UTC
svn commit: r1714977 - in /ofbiz/branches/release14.12:
applications/content/src/org/ofbiz/content/
applications/marketing/script/org/ofbiz/sfa/account/
applications/order/script/org/ofbiz/order/opportunity/
applications/order/script/org/ofbiz/order/or...
Author: pgil
Date: Wed Nov 18 11:54:49 2015
New Revision: 1714977
URL: http://svn.apache.org/viewvc?rev=1714977&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/branches/release14.12/applications/content/src/org/ofbiz/content/ContentManagementServices.java
ofbiz/branches/release14.12/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml
ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml
ofbiz/branches/release14.12/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
ofbiz/branches/release14.12/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml
ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml
ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml
Modified: ofbiz/branches/release14.12/applications/content/src/org/ofbiz/content/ContentManagementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original)
+++ ofbiz/branches/release14.12/applications/content/src/org/ofbiz/content/ContentManagementServices.java Wed Nov 18 11:54:49 2015
@@ -1479,7 +1479,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/branches/release14.12/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml (original)
+++ ofbiz/branches/release14.12/applications/marketing/script/org/ofbiz/sfa/account/AccountServices.xml Wed Nov 18 11:54:49 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/branches/release14.12/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml (original)
+++ ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml Wed Nov 18 11:54:49 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/branches/release14.12/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml (original)
+++ ofbiz/branches/release14.12/applications/order/script/org/ofbiz/order/order/CheckoutServices.xml Wed Nov 18 11:54:49 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/branches/release14.12/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml (original)
+++ ofbiz/branches/release14.12/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml Wed Nov 18 11:54:49 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/branches/release14.12/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java (original)
+++ ofbiz/branches/release14.12/applications/product/src/org/ofbiz/product/subscription/SubscriptionServices.java Wed Nov 18 11:54:49 2015
@@ -150,17 +150,17 @@ public class SubscriptionServices {
null, null, updateSubscriptionResult);
}
} else {
- Map<String, Object> createPartyRoleMap = FastMap.newInstance();
+ Map<String, Object> ensurePartyRoleMap = FastMap.newInstance();
if (UtilValidate.isNotEmpty(roleTypeId)) {
- createPartyRoleMap.put("partyId", partyId);
- createPartyRoleMap.put("roleTypeId", roleTypeId);
- createPartyRoleMap.put("userLogin", userLogin);
- Map<String, Object> createPartyRoleResult = dispatcher.runSync("createPartyRole", createPartyRoleMap);
- if (ServiceUtil.isError(createPartyRoleResult)) {
+ ensurePartyRoleMap.put("partyId", partyId);
+ ensurePartyRoleMap.put("roleTypeId", roleTypeId);
+ ensurePartyRoleMap.put("userLogin", userLogin);
+ Map<String, Object> ensurePartyRoleResult = dispatcher.runSync("ensurePartyRole", ensurePartyRoleMap);
+ if (ServiceUtil.isError(ensurePartyRoleResult)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"ProductSubscriptionPartyRoleCreationError",
UtilMisc.toMap("subscriptionResourceId", subscriptionResourceId), locale),
- null, null, createPartyRoleResult);
+ null, null, ensurePartyRoleResult);
}
}
Map<String, Object> createSubscriptionMap = dctx.getModelService("createSubscription").makeValid(newSubscription, ModelService.IN_PARAM);
Modified: ofbiz/branches/release14.12/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml (original)
+++ ofbiz/branches/release14.12/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml Wed Nov 18 11:54:49 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/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml (original)
+++ ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumEvents.xml Wed Nov 18 11:54:49 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/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml?rev=1714977&r1=1714976&r2=1714977&view=diff
==============================================================================
--- ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml (original)
+++ ofbiz/branches/release14.12/specialpurpose/scrum/script/org/ofbiz/scrum/ScrumServices.xml Wed Nov 18 11:54:49 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>