You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2017/07/22 10:32:25 UTC
svn commit: r1802669 - in /ofbiz/ofbiz-framework/trunk/applications/party:
servicedef/services.xml
src/main/java/org/apache/ofbiz/party/party/PartyServices.java
Author: deepak
Date: Sat Jul 22 10:32:25 2017
New Revision: 1802669
URL: http://svn.apache.org/viewvc?rev=1802669&view=rev
Log:
Improved:Converted createPartyDataSource service to entity-auto (OFBIZ-9508)
Thanks Aditya Sharma for your contribution.
Modified:
ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml
ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
Modified: ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml?rev=1802669&r1=1802668&r2=1802669&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/servicedef/services.xml Sat Jul 22 10:32:25 2017
@@ -713,13 +713,12 @@ under the License.
</service>
<!-- PartyDataSource services -->
- <service name="createPartyDataSource" engine="java"
- location="org.apache.ofbiz.party.party.PartyServices" invoke="createPartyDataSource" auth="true">
+ <service name="createPartyDataSource" engine="entity-auto" default-entity-name="PartyDataSource" invoke="create" auth="true">
<description>Creates a relation between a Party and a DataSource using PartyDataSource. The userLogin must have PARTYMGR_SRC_CREATE permission.</description>
<permission-service service-name="partyDatasourcePermissionCheck" main-action="CREATE"/>
- <attribute name="partyId" type="String" mode="IN" optional="false"/>
- <attribute name="dataSourceId" type="String" mode="IN" optional="false"/>
- <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
+ <auto-attributes include="pk" mode="IN" optional="false"/>
+ <auto-attributes include="nonpk" mode="IN" optional="true"/>
+ <override name="fromDate" mode="IN" type="Timestamp" optional="true"/>
</service>
<!-- Communication Event Services -->
Modified: ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java?rev=1802669&r1=1802668&r2=1802669&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyServices.java Sat Jul 22 10:32:25 2017
@@ -1010,46 +1010,6 @@ public class PartyServices {
return result;
}
- public static Map<String, Object> createPartyDataSource(DispatchContext ctx, Map<String, ? extends Object> context) {
- Delegator delegator = ctx.getDelegator();
- Locale locale = (Locale) context.get("locale");
-
- // input data
- String partyId = (String) context.get("partyId");
- String dataSourceId = (String) context.get("dataSourceId");
- Timestamp fromDate = (Timestamp) context.get("fromDate");
- if (fromDate == null) fromDate = UtilDateTime.nowTimestamp();
-
- try {
- // validate the existance of party and dataSource
- GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne();
- GenericValue dataSource = EntityQuery.use(delegator).from("DataSource").where("dataSourceId", dataSourceId).queryOne();
- if (party == null || dataSource == null) {
- List<String> errorList = UtilMisc.toList(UtilProperties.getMessage(resource,
- "PartyCannotCreatePartyDataSource", locale));
- if (party == null) {
- errorList.add(UtilProperties.getMessage(resource,
- "PartyNoPartyFoundWithPartyId", locale) + partyId);
- }
- if (dataSource == null) {
- errorList.add(UtilProperties.getMessage(resource,
- "PartyNoPartyWithDataSourceId",
- UtilMisc.toMap("dataSourceId", dataSourceId), locale));
- }
- return ServiceUtil.returnError(errorList);
- }
-
- // create the PartyDataSource
- GenericValue partyDataSource = delegator.makeValue("PartyDataSource", UtilMisc.toMap("partyId", partyId, "dataSourceId", dataSourceId, "fromDate", fromDate));
- partyDataSource.create();
-
- } catch (GenericEntityException e) {
- Debug.logError(e, e.getMessage(), module);
- return ServiceUtil.returnError(e.getMessage());
- }
- return ServiceUtil.returnSuccess();
- }
-
@Deprecated // migration from ftl to widget in process.
public static Map<String, Object> findParty(DispatchContext dctx, Map<String, ? extends Object> context) {
Map<String, Object> result = ServiceUtil.returnSuccess();