Author: arunpatidar
Date: Sat Sep 17 09:48:00 2016 New Revision: 1761169 URL: http://svn.apache.org/viewvc?rev=1761169&view=rev Log: Implemented: Added CRUD services for Delivery, EmailTemplateSetting and EbayProductListingAttribute entity. (OFBIZ-8050) (OFBIZ-8057)(OFBIZ-8058) Thanks: Amit Gadaley for the contribution. Added: ofbiz/trunk/applications/datamodel/servicedef/ ofbiz/trunk/applications/datamodel/servicedef/services_shipment.xml ofbiz/trunk/specialpurpose/ebaystore/servicedef/services_store.xml Modified: ofbiz/trunk/applications/datamodel/ofbiz-component.xml ofbiz/trunk/framework/common/servicedef/services_email.xml ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java Modified: ofbiz/trunk/applications/datamodel/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/ofbiz-component.xml?rev=1761169&r1=1761168&r2=1761169&view=diff ============================================================================== --- ofbiz/trunk/applications/datamodel/ofbiz-component.xml (original) +++ ofbiz/trunk/applications/datamodel/ofbiz-component.xml Sat Sep 17 09:48:00 2016 @@ -33,5 +33,8 @@ under the License. <entity-resource type="model" reader-name="main" loader="main" location="entitydef/product-entitymodel.xml"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/shipment-entitymodel.xml"/> <entity-resource type="model" reader-name="main" loader="main" location="entitydef/workeffort-entitymodel.xml"/> + + <!-- Shipment Services --> + <service-resource type="model" loader="main" location="servicedef/services_shipment.xml"/> </ofbiz-component> Added: ofbiz/trunk/applications/datamodel/servicedef/services_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/servicedef/services_shipment.xml?rev=1761169&view=auto ============================================================================== --- ofbiz/trunk/applications/datamodel/servicedef/services_shipment.xml (added) +++ ofbiz/trunk/applications/datamodel/servicedef/services_shipment.xml Sat Sep 17 09:48:00 2016 @@ -0,0 +1,42 @@ +<?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. +--> + +<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd"> + <description>Shipment Services</description> + <vendor>OFBiz</vendor> + <version>1.0</version> + + <!-- Shipment services --> + <service name="createDelivery" engine="entity-auto" invoke="create" default-entity-name="Delivery" auth="true"> + <description>Create a Delivery record</description> + <auto-attributes include="pk" mode="INOUT" optional="true"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="updateDelivery" engine="entity-auto" invoke="update" default-entity-name="Delivery" auth="true"> + <description>Update a Delivery record</description> + <auto-attributes include="pk" mode="IN"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="deleteDelivery" engine="entity-auto" invoke="delete" default-entity-name="Delivery" auth="true"> + <description>Delete a Delivery record</description> + <auto-attributes include="pk" mode="IN"/> + </service> +</services> Modified: ofbiz/trunk/framework/common/servicedef/services_email.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services_email.xml?rev=1761169&r1=1761168&r2=1761169&view=diff ============================================================================== --- ofbiz/trunk/framework/common/servicedef/services_email.xml (original) +++ ofbiz/trunk/framework/common/servicedef/services_email.xml Sat Sep 17 09:48:00 2016 @@ -170,4 +170,18 @@ under the License. <implements service="mailProcessInterface"/> </service> --> + <service name="createEmailTemplateSetting" engine="entity-auto" invoke="create" default-entity-name="EmailTemplateSetting" auth="true"> + <description>Create a EmailTemplateSetting record</description> + <auto-attributes include="pk" mode="INOUT" optional="true"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="updateEmailTemplateSetting" engine="entity-auto" invoke="update" default-entity-name="EmailTemplateSetting" auth="true"> + <description>Update a EmailTemplateSetting record</description> + <auto-attributes include="pk" mode="IN"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="deleteEmailTemplateSetting" engine="entity-auto" invoke="delete" default-entity-name="EmailTemplateSetting" auth="true"> + <description>Delete a EmailTemplateSetting record</description> + <auto-attributes include="pk" mode="IN"/> + </service> </services> Modified: ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml?rev=1761169&r1=1761168&r2=1761169&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml (original) +++ ofbiz/trunk/specialpurpose/ebaystore/ofbiz-component.xml Sat Sep 17 09:48:00 2016 @@ -35,6 +35,7 @@ under the License. <service-resource type="eca" loader="main" location="servicedef/secas.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/> + <service-resource type="model" loader="main" location="servicedef/services_store.xml"/> <webapp name="ebaystore" title="eBay Store" Added: ofbiz/trunk/specialpurpose/ebaystore/servicedef/services_store.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/servicedef/services_store.xml?rev=1761169&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/servicedef/services_store.xml (added) +++ ofbiz/trunk/specialpurpose/ebaystore/servicedef/services_store.xml Sat Sep 17 09:48:00 2016 @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd"> + <description>eBay Component Services</description> + <vendor>OFBiz</vendor> + <version>1.0</version> + + <service name="createEbayProductListingAttribute" engine="entity-auto" invoke="create" default-entity-name="EbayProductListingAttribute" auth="true"> + <description>Create a EbayProductListingAttribute record</description> + <auto-attributes include="pk" mode="IN"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="updateEbayProductListingAttribute" engine="entity-auto" invoke="update" default-entity-name="EbayProductListingAttribute" auth="true"> + <description>Update a EbayProductListingAttribute record</description> + <auto-attributes include="pk" mode="IN"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> + </service> + <service name="deleteEbayProductListingAttribute" engine="entity-auto" invoke="delete" default-entity-name="EbayProductListingAttribute" auth="true"> + <description>Delete a EbayProductListingAttribute record</description> + <auto-attributes include="pk" mode="IN"/> + </service> +</services> Modified: ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java?rev=1761169&r1=1761168&r2=1761169&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java (original) +++ ofbiz/trunk/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java Sat Sep 17 09:48:00 2016 @@ -465,8 +465,11 @@ public class EbayStoreHelper { public static Map<String, Object> setEbayProductListingAttribute(DispatchContext dctx, Map<String, Object> context) { Delegator delegator = dctx.getDelegator(); + LocalDispatcher dispatcher = dctx.getDispatcher(); HashMap<String, Object> attributeMapList = UtilGenerics.cast(context.get("attributeMapList")); String productListingId = (String) context.get("productListingId"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); + Map<String, Object> ebayProductListingAttributeMap = new HashMap<String, Object>(); try { List<GenericValue> attributeToClears = EntityQuery.use(delegator).from("EbayProductListingAttribute").where("productListingId", productListingId).queryList(); for (int clearCount = 0; clearCount < attributeToClears.size(); clearCount++) { @@ -477,15 +480,17 @@ public class EbayStoreHelper { } for (Map.Entry<String,Object> entry : attributeMapList.entrySet()) { if (UtilValidate.isNotEmpty(entry.getKey())) { - GenericValue ebayProductListingAttribute = delegator.makeValue("EbayProductListingAttribute"); - ebayProductListingAttribute.set("productListingId", productListingId); - ebayProductListingAttribute.set("attrName", entry.getKey().toString()); - ebayProductListingAttribute.set("attrValue", entry.getValue().toString()); - ebayProductListingAttribute.create(); + ebayProductListingAttributeMap.put("productListingId", productListingId); + ebayProductListingAttributeMap.put("attrName", entry.getKey().toString()); + ebayProductListingAttributeMap.put("attrValue", entry.getValue().toString()); + ebayProductListingAttributeMap.put("userLogin", userLogin); + dispatcher.runSync("createEbayProductListingAttribute", ebayProductListingAttributeMap); } } } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); + } catch (GenericServiceException e) { + return ServiceUtil.returnError(e.getMessage()); } return ServiceUtil.returnSuccess(); } |
Free forum by Nabble | Edit this page |