You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/08/26 17:28:13 UTC

svn commit: r808053 - /ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java

Author: ashish
Date: Wed Aug 26 15:28:10 2009
New Revision: 808053

URL: http://svn.apache.org/viewvc?rev=808053&view=rev
Log:
More imporvement in Google Base code to support namespace specific tags along with the generated XML feed.

Modified:
    ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java

Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=808053&r1=808052&r2=808053&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original)
+++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Wed Aug 26 15:28:10 2009
@@ -448,17 +448,17 @@
                 UtilXml.addChildElementNSValue(entryElem, "g:price", price, feedDocument, googleBaseNSUrl);
 
                 // Might be nicer to load this from the product but for now we'll set it based on the country destination
-                UtilXml.addChildElementValue(entryElem, "g:currency", productCurrency, feedDocument);
+                UtilXml.addChildElementNSValue(entryElem, "g:currency", productCurrency, feedDocument, googleBaseNSUrl);
 
                 // Ensure the load goes to the correct country location either US dollar, GB sterling or DE euro
-                UtilXml.addChildElementValue(entryElem, "g:target_country", countryCode, feedDocument);
+                UtilXml.addChildElementNSValue(entryElem, "g:target_country", countryCode, feedDocument, googleBaseNSUrl);
                 if (UtilValidate.isNotEmpty(prod.getString("brandName"))) { 
-                    UtilXml.addChildElementValue(entryElem, "g:brand", prod.getString("brandName"), feedDocument);
+                    UtilXml.addChildElementNSValue(entryElem, "g:brand", prod.getString("brandName"), feedDocument, googleBaseNSUrl);
                 }
                 try {
                     googleProduct = delegator.findByPrimaryKey("GoodIdentification", UtilMisc.toMap("productId", prod.getString("productId"), "goodIdentificationTypeId", "SKU"));
                     if (UtilValidate.isNotEmpty(googleProduct)) {
-                        UtilXml.addChildElementValue(entryElem, "g:ean", googleProduct.getString("idValue"), feedDocument);
+                        UtilXml.addChildElementNSValue(entryElem, "g:ean", googleProduct.getString("idValue"), feedDocument, googleBaseNSUrl);
                     }
                 } catch (GenericEntityException gee) {
                     Debug.logInfo("Unable to get the SKU for product [" + prod.getString("productId") + "]: " + gee.getMessage(), module);
@@ -470,7 +470,7 @@
 
                 // if the product has an image it will be published on Google Product Search
                 if (UtilValidate.isNotEmpty(imageLink)) {
-                    UtilXml.addChildElementValue(entryElem, "g:image_link", imageLink, feedDocument);
+                    UtilXml.addChildElementNSValue(entryElem, "g:image_link", imageLink, feedDocument, googleBaseNSUrl);
                 }
                 // if the product is exported to google for the first time, we add it to the list
                 if ("insert".equals(itemActionType)) {
@@ -485,7 +485,6 @@
                 }
                 index++;
             }
-
             dataItemsXml.append(UtilXml.writeXmlDocument(feedDocument));
         } catch (IOException e) {
             return ServiceUtil.returnError("IO Error creating XML document for Google :" + e.getMessage());
@@ -493,7 +492,6 @@
             return ServiceUtil.returnError("Unable to read from product entity: "  + e.toString());
         }
 
-
         Map result = ServiceUtil.returnSuccess();
         result.put("newProductsInGoogle", newProductsInGoogle);
         result.put("productsRemovedFromGoogle", productsRemovedFromGoogle);