ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ash...@apache.org
Subject svn commit: r811645 - in /ofbiz/trunk/specialpurpose/ebay: ./ data/ entitydef/ servicedef/ src/org/ofbiz/ebay/ webapp/ebay/WEB-INF/actions/find/ webapp/ebay/find/ widget/
Date Sat, 05 Sep 2009 13:32:12 GMT
Author: ashish
Date: Sat Sep  5 13:32:12 2009
New Revision: 811645

URL: http://svn.apache.org/viewvc?rev=811645&view=rev
Log:
Following things are done in this commit.

-- Moved eBay configuration settings to a new entity - EbayConfig. Property file configuration
support also exists in current code.
-- Also prepared the demo data for this new entity.
-- For default webSiteUrl prepared demo data in WebSite entity so we can show default value
on the form.

Added:
    ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml   (with props)
    ofbiz/trunk/specialpurpose/ebay/entitydef/
    ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml   (with props)
Modified:
    ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml
    ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
    ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy
    ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/productsExportToEbay.ftl
    ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml

Added: ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml?rev=811645&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml (added)
+++ ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml Sat Sep  5 13:32:12 2009
@@ -0,0 +1,27 @@
+<?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.
+-->
+
+<entity-engine-xml>
+    <WebSite webSiteId="EBAY" standardContentPrefix="http://demo.ofbiz.org" productStoreId="9000"/>
+    <EbayConfig productStoreId="9000" devId="ppodkYk34Kh-279a-6khr-a07c-06fd1d65824b"
appId="ApacheOFB-bf44-4c32-ac45-3e099a32b675" certId="99ca5f9f-dd5c-3de-9a4c-13b247ieidfg"
compatibilityLevel="517" siteId="0" xmlGatewayUri="https://api.sandbox.ebay.com/ws/api.dll"
webSiteId="EBAY">
+        <token><![CDATA[APACHEeerer**AQresT**aOFBIZ**Dddddg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wFddddddddsssererdafjk23232uy+seQ**IzABAA**AAMAAA**6kOEMXRyvyVRLt7vAL7W+5dfjdkfjkldfjlkdjfldj121219fjlkdfjldjf+oRU0d07B0jfdFxJj6OolPHiQN5c0qmVNDRsSKaOucPjXTHSBmVm62p7M9/YmRCag/Mz1DjvDTFyS1kaBinGH2lwd9AjcBSBUbD9tSZVTdKn5PQBh3kkCh5Fe+UK5fyq9OeikM/Bdfafja377dkdkBddDDll+zPbG8pYL13cBgCGj8/zzMSGX2ugZkbU01bCLKkTzLOSqIcxj9xgJ4uDHxhjjizyWlHd2ovFKP8mmc/bEjLANUqS1z0vhR0NHydU/izZR8eYAruTvX6eYzSfsZA85sVOpIAjVEYX9M4CqgXazYxDFAT+y7E4+oM9N+tx8+/dkdkfdoTTKdHhdlKwVmgdULRhW0nP04BMugLpRCQrITSVpSJ1mfkwwb4JEQRNwSSUOe/1P3t21JhUBj3OJjpwC1ds84DSh9nlyykxF3X+EfFxtE4rTKUO+fODRDD5FBDO2+TD3AROz/3u/OWOvTWUm13u2kxMiiEQ3DNkuxN4g7Gj5xhKk7uNMIRRM8YoxoDoiJnbvuLQctBtpn1vibjUJsxTlnq92PLOhsgkp2NfhcxzS1JJfDKX1snOkmWfiluqyW5oDayJoZnrHIVKD0RkYNd2h+U5DOyOJ2/YXYIAPJAcWloGLpKO7k]]></token>
+        <customXml><![CDATA[<custom-xml><Currency>USD</Currency><UseTaxTable>false</UseTaxTable><DispatchTimeMax>3</DispatchTimeMax><ReturnPolicy><ReturnsAcceptedOption>ReturnsNotAccepted</ReturnsAcceptedOption></ReturnPolicy><ShippingDetails><ShippingType>Flat</ShippingType><ShippingServiceOptions><ShippingService>UPS2ndDay</ShippingService><ShippingServicePriority>1</ShippingServicePriority><ShippingServiceCost>5</ShippingServiceCost><ShippingServiceAdditionalCost>2</ShippingServiceAdditionalCost><ShippingSurcharge>1</ShippingSurcharge></ShippingServiceOptions></ShippingDetails></custom-xml>]]></customXml>
+    </EbayConfig>        
+</entity-engine-xml>
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/ebay/data/DemoEbayData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml?rev=811645&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml (added)
+++ ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml Sat Sep  5 13:32:12 2009
@@ -0,0 +1,65 @@
+<?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.
+-->
+
+<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
+    
+    <!-- ========================================================= -->
+    <!-- ======================== Defaults ======================= -->
+    <!-- ========================================================= -->
+    <title>Entity of an Open For Business Project Component</title>
+    <description>None</description>
+    <copyright>Copyright 2001-2009 The Apache Software Foundation</copyright>
+    <author>None</author>
+    <version>1.0</version>
+    
+    <!-- ========================================================= -->
+    <!-- ======================== Data Model ===================== -->
+    <!-- The modules in this file are as follows:                  -->
+    <!--  - org.ofbiz.ebay.config -->  
+    <!-- ========================================================= -->
+    
+    <!-- ========================================================= -->
+    <!-- org.ofbiz.ebay.config -->
+    <!-- ========================================================= -->
+
+    <entity entity-name="EbayConfig"
+            package-name="org.ofbiz.ebay.config"
+            title="eBay Configuration">
+        <field name="productStoreId" type="id-ne"></field>    
+        <field name="devId" type="value"></field>
+        <field name="appId" type="value"></field>
+        <field name="certId" type="value"></field>
+        <field name="token" type="very-long"></field>
+        <field name="compatibilityLevel" type="id"></field>
+        <field name="siteId" type="id"></field>
+        <field name="xmlGatewayUri" type="value"></field>
+        <field name="customXml" type="very-long"></field>
+        <field name="webSiteId" type="id-ne"></field>
+        <prim-key field="productStoreId"/>      
+        <relation type="one" fk-name="EBY_PROD_STORE" rel-entity-name="ProductStore">
+            <key-map field-name="productStoreId"/>
+        </relation>
+        <relation type="one" fk-name="EBY_WEBSITE" rel-entity-name="WebSite">
+            <key-map field-name="webSiteId"/>
+        </relation>
+    </entity>
+</entitymodel>    
+    
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/ebay/entitydef/entitymodel.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml?rev=811645&r1=811644&r2=811645&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/ofbiz-component.xml Sat Sep  5 13:32:12 2009
@@ -24,9 +24,11 @@
     <resource-loader name="main" type="component"/>
     <classpath type="dir" location="config"/>
     <classpath type="jar" location="build/lib/*"/>
-
+    
+    <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EbaySecurityData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayTypeData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/DemoEbayData.xml"/>
 
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
     <service-resource type="eca" loader="main" location="servicedef/secas.xml"/>

Modified: ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml?rev=811645&r1=811644&r2=811645&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/servicedef/services.xml Sat Sep  5 13:32:12 2009
@@ -49,6 +49,7 @@
         <attribute type="String" mode="IN" name="listingDuration" optional="false"/>
         <attribute type="String" mode="IN" name="startPrice" optional="true"/>
         <attribute type="String" mode="IN" name="quantity" optional="true"/>
+        <attribute type="String" mode="IN" name="productStoreId" optional="true"/>
     </service>
     <service name="getEbayCategories" engine="java"
              location="org.ofbiz.ebay.ProductsExportToEbay" invoke="getEbayCategories" auth="true">

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=811645&r1=811644&r2=811645&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Sat Sep 
5 13:32:12 2009
@@ -235,7 +235,7 @@
                         UtilXml.addChildElementValue(pictureDetails, "PictureURL", webSiteUrl
+ ebayImage, itemDocument);
                     }
                     setPaymentMethodAccepted(itemDocument, itemElem, context);
-                    setMiscDetails(itemDocument, itemElem, context);
+                    setMiscDetails(itemDocument, itemElem, context, delegator);
                     String primaryCategoryId = "";
                     String categoryCode = (String)context.get("ebayCategory");
                     if (categoryCode != null) {
@@ -423,8 +423,19 @@
         }
     }
 
-    private static void setMiscDetails(Document itemDocument, Element itemElem, Map context)
throws Exception {
-        String customXml = UtilProperties.getPropertyValue(configFileName, "eBayExport.customXml");
+    private static void setMiscDetails(Document itemDocument, Element itemElem, Map context,
GenericDelegator delegator) throws Exception {
+        String productStoreId = (String) context.get("productStoreId");
+        String customXml = "";
+        if (UtilValidate.isNotEmpty(productStoreId)) {
+            GenericValue eBayConfig = delegator.findOne("EbayConfig", false, UtilMisc.toMap("productStoreId",
productStoreId));
+            if (UtilValidate.isNotEmpty(eBayConfig.getString("customXml"))) {
+                customXml = eBayConfig.getString("customXml");
+            } else {
+                customXml = UtilProperties.getPropertyValue(configFileName, "eBayExport.customXml");
+            }
+        } else {
+            customXml = UtilProperties.getPropertyValue(configFileName, "eBayExport.customXml");
  
+        }
         if (UtilValidate.isNotEmpty(customXml)) {
             Document customXmlDoc = UtilXml.readXmlDocument(customXml);
             if (UtilValidate.isNotEmpty(customXmlDoc)) {
@@ -527,13 +538,33 @@
     
     private static Map<String, Object> buildEbayConfig(Map<String, Object> context,
GenericDelegator delegator) {
         Map<String, Object> buildEbayConfigContext = FastMap.newInstance();
-        buildEbayConfigContext.put("devID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.devID"));
-        buildEbayConfigContext.put("appID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.appID"));
-        buildEbayConfigContext.put("certID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.certID"));
-        buildEbayConfigContext.put("token", UtilProperties.getPropertyValue(configFileName,
"eBayExport.token"));
-        buildEbayConfigContext.put("compatibilityLevel", UtilProperties.getPropertyValue(configFileName,
"eBayExport.compatibilityLevel"));
-        buildEbayConfigContext.put("siteID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.siteID"));
-        buildEbayConfigContext.put("xmlGatewayUri", UtilProperties.getPropertyValue(configFileName,
"eBayExport.xmlGatewayUri"));
+        String productStoreId = (String) context.get("productStoreId");
+        if (UtilValidate.isNotEmpty(productStoreId)) {
+            GenericValue eBayConfig = null;
+            try {
+                eBayConfig = delegator.findOne("EbayConfig", false, UtilMisc.toMap("productStoreId",
productStoreId));
+            } catch (GenericEntityException e) {
+                Debug.logError("Unable to find value for EbayConfig", module);
+                e.printStackTrace();
+            }
+            if (UtilValidate.isNotEmpty(eBayConfig)) {
+                buildEbayConfigContext.put("devID", eBayConfig.getString("devId"));
+                buildEbayConfigContext.put("appID", eBayConfig.getString("appId"));
+                buildEbayConfigContext.put("certID", eBayConfig.getString("certId"));
+                buildEbayConfigContext.put("token", eBayConfig.getString("token"));
+                buildEbayConfigContext.put("compatibilityLevel", eBayConfig.getString("compatibilityLevel"));
+                buildEbayConfigContext.put("siteID", eBayConfig.getString("siteId"));
+                buildEbayConfigContext.put("xmlGatewayUri", eBayConfig.getString("xmlGatewayUri"));
+            }
+        } else {
+            buildEbayConfigContext.put("devID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.devID"));
+            buildEbayConfigContext.put("appID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.appID"));
+            buildEbayConfigContext.put("certID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.certID"));
+            buildEbayConfigContext.put("token", UtilProperties.getPropertyValue(configFileName,
"eBayExport.token"));
+            buildEbayConfigContext.put("compatibilityLevel", UtilProperties.getPropertyValue(configFileName,
"eBayExport.compatibilityLevel"));
+            buildEbayConfigContext.put("siteID", UtilProperties.getPropertyValue(configFileName,
"eBayExport.siteID"));
+            buildEbayConfigContext.put("xmlGatewayUri", UtilProperties.getPropertyValue(configFileName,
"eBayExport.xmlGatewayUri"));
+        }    
         return buildEbayConfigContext;
     }    
     

Modified: ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy?rev=811645&r1=811644&r2=811645&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy
(original)
+++ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy
Sat Sep  5 13:32:12 2009
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import org.ofbiz.webapp.website.WebSiteWorker;
 
 categoryCode = parameters.categoryCode;
 context.categoryCode = categoryCode; 
@@ -36,3 +37,9 @@
 } else {
     context.hideExportOptions = "N";
 }
+
+webSite = WebSiteWorker.getWebSite(request);
+if (webSite) {
+    context.productStoreId = webSite.productStoreId;;
+    context.webSiteUrl = webSite.getString("standardContentPrefix")?:"http://demo.ofbiz.org";
+}

Modified: ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/productsExportToEbay.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/productsExportToEbay.ftl?rev=811645&r1=811644&r2=811645&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/productsExportToEbay.ftl (original)
+++ ofbiz/trunk/specialpurpose/ebay/webapp/ebay/find/productsExportToEbay.ftl Sat Sep  5 13:32:12
2009
@@ -34,6 +34,7 @@
 </script>
 <div>
     <form method="post" action="<@ofbizUrl>PostProductsToEbay</@ofbizUrl>"
name="ProductsExportToEbay">
+        <input type="hidden" name="productStoreId" value="${productStoreId?if_exists}">
         <table border="0" cellpadding="2" cellspacing="0">
              <tr>
                 <td align="right" class="label">${uiLabelMap.FormFieldTitle_ebayCategory}</td>

Modified: ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml?rev=811645&r1=811644&r2=811645&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ebay/widget/EbayScreens.xml Sat Sep  5 13:32:12 2009
@@ -170,8 +170,6 @@
     <screen name="ProductsExportToEbay">
         <section>
             <actions>
-                <property-map resource="ebayExport.properties" map-name="ebayExportProperties"
global="true"/>
-                <set field="webSiteUrl" value="${ebayExportProperties.webSiteUrl}"/>
                 <set field="headerItem" value="export"/>
                 <set field="titleProperty" value="PageTitleEbayProductsExportToEbay"/>
                 <set field="selectResult" from-field="parameters.selectResult"/>



Mime
View raw message