Author: ashish
Date: Mon Aug 31 12:06:14 2009 New Revision: 809552 URL: http://svn.apache.org/viewvc?rev=809552&view=rev Log: Another update on Google Base. Following things are done in this commit: 1) Added new entity GoogleBaseConfig and reading the values from there. Also kept option to read configuration values from property file. 2) Added new ProductCategoryType record for Google Base - Thanks Jacopo for your suggestion on this. 3) Prepared data for demo purpose in DemoProduct.xml file - This demo contains the association of few product with Google Category. 4) Also prepared demo data for GoogleBaseConfig entity. 5) Provided option to have default value of webSiteUrl on the GoogleExport form - for this refer productsExportToGoogle.groovy file. Thanks Pranay for discussing few things with me in b/w this phase of development. In next Commit I will provide UI for GoogleBaseConfig entity(CRUD operations) so it will be easy for end user to update values in this entity easily instead of moving to webtools and do the needful. Added: ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml (with props) ofbiz/trunk/specialpurpose/googlebase/entitydef/ ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml (with props) ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/ ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy (with props) Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml ofbiz/trunk/specialpurpose/googlebase/data/GoogleBaseTypeData.xml ofbiz/trunk/specialpurpose/googlebase/ofbiz-component.xml ofbiz/trunk/specialpurpose/googlebase/servicedef/services.xml ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Mon Aug 31 12:06:14 2009 @@ -192,6 +192,7 @@ <ProductCategoryType description="Mix and Match" hasTable="N" parentTypeId="" productCategoryTypeId="MIXMATCH_CATEGORY"/> <ProductCategoryType description="Cross Sell" hasTable="N" parentTypeId="" productCategoryTypeId="CROSS_SELL_CATEGORY"/> <ProductCategoryType description="Tax" hasTable="N" parentTypeId="" productCategoryTypeId="TAX_CATEGORY"/> + <ProductCategoryType description="Google Base" hasTable="N" parentTypeId="" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> <!-- product geo data --> <EnumerationType description="Product Geo Data" enumTypeId="PROD_GEO" hasTable="N" parentTypeId=""/> Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/advancedsearchoptions.groovy Mon Aug 31 12:06:14 2009 @@ -21,9 +21,11 @@ import org.ofbiz.product.catalog.* import org.ofbiz.product.feature.* import org.ofbiz.product.product.* +import org.ofbiz.product.store.ProductStoreWorker; searchCategoryId = parameters.SEARCH_CATEGORY_ID; -if (!searchCategoryId || searchCategoryId.length() == 0) { +productStoreId = ProductStoreWorker.getProductStoreId(request); +if ((!searchCategoryId || searchCategoryId.length() == 0) && !productStoreId) { currentCatalogId = CatalogWorker.getCurrentCatalogId(request); searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId); } Modified: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml Mon Aug 31 12:06:14 2009 @@ -200,7 +200,53 @@ linkInfo="http://www.google.com/"/> <ProductCategoryLink productCategoryId="100" linkSeqId="03" fromDate="2001-05-13 12:00:00.0" sequenceNum="3" linkTypeEnumId="PCLT_CAT_ID" linkInfo="101"/> - + + <ProdCatalog prodCatalogId="GoogleCatalog" catalogName="Google Catalog"/> + <ProductStoreCatalog productStoreId="9000" prodCatalogId="GoogleCatalog" fromDate="2001-05-13 12:00:00.0" sequenceNum="3"/> + + <!-- Categories Specific to Google Base --> + <ProductCategory categoryName="Google Base Browse Root" + longDescription="Google Base Primary Browse Root Category" productCategoryId="GOOGLE_BASE" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Animals" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_ANIMALS" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Arts & Entertainment" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_ART_N_ENTMNT" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Business & Industrial" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_BUZ_N_INDSTRL" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Cameras & Optics" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_CMRA_N_OPTCS" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Clothing & Accessories" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_CLTNG_N_ACECRS" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Food, Beverages & Tobacco" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_FD_BVRG_N_TBCO" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Furniture" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_FURNITURE" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Hardware" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_HARDWARE" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Health & Beauty" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_HLTH_N_BEAUTY" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Home & Garden" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_HME_N_GRDN" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Luggage" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_LUGGAGE" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Mature" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_MATURE" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Media" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_MEDIA" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Motor Vehicles" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_MTR_VEHICL" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Offices Supplies" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_OFFC_SPPLS" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Software" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_SOFTWARE" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Sporting Goods" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_SPRTNG_GDS" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + <ProductCategory categoryName="Toys & Games" + primaryParentCategoryId="GOOGLE_BASE" productCategoryId="GB_TYS_GMS" productCategoryTypeId="GOOGLE_BASE_CATEGORY"/> + + <ProdCatalogCategory prodCatalogId="GoogleCatalog" productCategoryId="GOOGLE_BASE" fromDate="2001-05-13 12:00:00.0" + sequenceNum="1" prodCatalogCategoryTypeId="PCCT_BROWSE_ROOT"/> + <Product productId="GZ-1000" productTypeId="FINISHED_GOOD" primaryProductCategoryId="101" productName="Tiny Gizmo" internalName="Tiny Gizmo" description="The smallest gizmo in town." longDescription="This gizmo is very small and runs on solar power." taxable="Y" chargeShipping="Y" autoCreateKeywords="Y" isVirtual="N" isVariant="N" createdDate="2001-05-13 12:00:00.0" createdByUserLogin="admin" lastModifiedDate="2001-05-13 12:00:00.0" lastModifiedByUserLogin="admin"/> <Product productId="GZ-1001" productTypeId="FINISHED_GOOD" primaryProductCategoryId="101" productName="Nan Gizmo" internalName="Nan Gizmo" description="Indian style Nan gizmo" taxable="Y" chargeShipping="Y" autoCreateKeywords="Y" isVirtual="N" isVariant="N" createdDate="2001-05-13 12:00:00.0" createdByUserLogin="admin" lastModifiedDate="2001-05-13 12:00:00.0" lastModifiedByUserLogin="admin"/> <Product productId="GZ-1004" productTypeId="FINISHED_GOOD" primaryProductCategoryId="102" productName="Rainbow Gizmo" internalName="Rainbow Gizmo" description="The only multi-colored gizmo" longDescription="This is the original multi-colored gizmo, only available from OFBiz!" taxable="Y" chargeShipping="Y" autoCreateKeywords="Y" isVirtual="N" isVariant="N" createdDate="2001-05-13 12:00:00.0" createdByUserLogin="admin" lastModifiedDate="2001-05-13 12:00:00.0" lastModifiedByUserLogin="admin"/> @@ -507,6 +553,41 @@ <!-- Added record to check role based permission for limited admin user --> <ProductCategoryMember productCategoryId="TSTLTDADMIN" productId="GZ-2644" fromDate="2003-03-04 18:55:14.547"/> + <!-- Product Category Member records specific to Google Base --> + <ProductCategoryMember productCategoryId="GB_HARDWARE" productId="GZ-1001" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_HARDWARE" productId="GZ-1000" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_HARDWARE" productId="GZ-1005" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_HARDWARE" productId="GZ-2002" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_HARDWARE" productId="GZ-2644" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_LUGGAGE" productId="GZ-1004" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_TYS_GMS" productId="GZ-7000" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_TYS_GMS" productId="GZ-9290" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_TYS_GMS" productId="GZ-2644" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_MTR_VEHICL" productId="GZ-8544" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_MTR_VEHICL" productId="WG-9943" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_MTR_VEHICL" productId="WG-9944" fromDate="2009-07-28 12:15:00.0"/> + <ProductCategoryMember productCategoryId="GB_OFFC_SPPLS" productId="WG-1111" fromDate="2009-07-28 12:15:00.0"/> + + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_ANIMALS"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_ART_N_ENTMNT"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_BUZ_N_INDSTRL"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_CMRA_N_OPTCS"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_CLTNG_N_ACECRS"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_FD_BVRG_N_TBCO"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_FURNITURE"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_HARDWARE"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_HLTH_N_BEAUTY"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_HME_N_GRDN"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_LUGGAGE"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_MATURE"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_MEDIA"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_MATURE"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_MTR_VEHICL"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_OFFC_SPPLS"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_SOFTWARE"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_SPRTNG_GDS"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="GOOGLE_BASE" productCategoryId="GB_TYS_GMS"/> + <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="CATALOG1" productCategoryId="100"/> <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="100" productCategoryId="101"/> <ProductCategoryRollup fromDate="2001-05-13 12:00:00.0" parentProductCategoryId="100" productCategoryId="102"/> Added: ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml?rev=809552&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml (added) +++ ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml Mon Aug 31 12:06:14 2009 @@ -0,0 +1,24 @@ +<?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="GOOGLEBASE" productStoreId="9000" /> + <GoogleBaseConfig productStoreId="9000" developerKey="HKLh9khgVieditoO0b4JR2fnBT2yXp_ZAY8_yft3CFXhHIE1NvwkxQ1pZ4qyVEGh_FtRe5KtJPTKDorNP" authenticationUrl="https://www.google.com/accounts/ClientLogin" accountEmail="[hidden email]" accountPassword="47ca69ebb4bdc9ae0adec130880165d2cc05db1a" postItemsUrl="http://www.google.com/base/feeds/items/batch" webSiteUrl="http://demo.ofbiz.org"/> +</entity-engine-xml> \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/specialpurpose/googlebase/data/DemoGoogleBaseData.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/specialpurpose/googlebase/data/GoogleBaseTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/data/GoogleBaseTypeData.xml?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/data/GoogleBaseTypeData.xml (original) +++ ofbiz/trunk/specialpurpose/googlebase/data/GoogleBaseTypeData.xml Mon Aug 31 12:06:14 2009 @@ -21,5 +21,5 @@ <entity-engine-xml> <GoodIdentificationType description="Google Id" goodIdentificationTypeId="GOOGLE_ID" hasTable="N" parentTypeId=""/> - + <WebSite webSiteId="GOOGLEBASE" siteName="Google Base Application" visualThemeSetId="BACKOFFICE"/> </entity-engine-xml> Added: ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml?rev=809552&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml (added) +++ ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml Mon Aug 31 12:06:14 2009 @@ -0,0 +1,66 @@ +<?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.googlecheckout.config --> + <!-- - org.ofbiz.googlebase.shipping --> + <!-- ========================================================= --> + + <!-- ========================================================= --> + <!-- org.ofbiz.googlebase.config --> + <!-- ========================================================= --> + + <entity entity-name="GoogleBaseConfig" + package-name="org.ofbiz.googlebase.config" + title="Google Base Configuration"> + <field name="productStoreId" type="id-ne"></field> + <field name="developerKey" type="value"><description>Developer Key that should be obtained from Google Base</description></field> + <field name="authenticationUrl" type="value"><description>Authentication URL for Google Base</description></field> + <field name="accountEmail" type="name"><description>Gmail Account for logging into Google Base</description></field> + <field name="accountPassword" type="name" encrypt="true"></field> + <field name="postItemsUrl" type="value"><description>All the items should be posted to this url</description></field> + <field name="webSiteUrl" type="value"> + <description> + This will be the URL where products will be present. In short we can say Merchant Website. + This URL will be same as that of the "Website URL" present in basic settings inside Google Base account. + Please refer this page after logging with your user credentails: http://www.google.com/base/basicsettings + </description> + </field> + <prim-key field="productStoreId"/> + <relation type="one" fk-name="GBS_PROD_STORE" rel-entity-name="ProductStore"> + <key-map field-name="productStoreId"/> + </relation> + </entity> +</entitymodel> + \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/specialpurpose/googlebase/entitydef/entitymodel.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/specialpurpose/googlebase/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/ofbiz-component.xml?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/ofbiz-component.xml (original) +++ ofbiz/trunk/specialpurpose/googlebase/ofbiz-component.xml Mon Aug 31 12:06:14 2009 @@ -25,8 +25,10 @@ <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/GoogleBaseTypeData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/GoogleBaseSecurityData.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoGoogleBaseData.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/> Modified: ofbiz/trunk/specialpurpose/googlebase/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/servicedef/services.xml?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/googlebase/servicedef/services.xml Mon Aug 31 12:06:14 2009 @@ -36,6 +36,7 @@ <attribute type="String" mode="IN" name="trackingCodeId" optional="true"/> <attribute type="String" mode="IN" name="webSiteMountPoint" optional="false"/> <attribute type="String" mode="IN" name="countryCode" optional="false"/> + <attribute type="String" mode="IN" name="productStoreId" optional="true"/> </service> <service name="exportProductCategoryToGoogle" engine="java" location="org.ofbiz.googlebase.ProductsExportToGoogle" invoke="exportProductCategoryToGoogle" auth="true"> Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java (original) +++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/GoogleBaseSearchEvents.java Mon Aug 31 12:06:14 2009 @@ -90,6 +90,7 @@ String trackingCodeId = (String) request.getParameter("trackingCodeId"); String webSiteMountPoint = (String) request.getParameter("webSiteMountPoint"); String countryCode = (String) request.getParameter("countryCode"); + String productStoreId = (String) request.getParameter("productStoreId"); // Export all or selected products to Google Base try { @@ -103,6 +104,7 @@ "countryCode", countryCode); inMap.put("trackingCodeId", trackingCodeId); inMap.put("userLogin", userLogin); + inMap.put("productStoreId", productStoreId); Map exportResult = dispatcher.runSync("exportToGoogle", inMap); if (ServiceUtil.isError(exportResult)) { List errorMessages = (List)exportResult.get(ModelService.ERROR_MESSAGE_LIST); 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=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original) +++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Mon Aug 31 12:06:14 2009 @@ -52,6 +52,7 @@ import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; import org.ofbiz.service.ServiceUtil; +import org.ofbiz.base.util.StringUtil; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -63,6 +64,7 @@ private static final String googleBaseBatchUrl = "http://schemas.google.com/gdata/batch"; private static final String googleBaseMetadataUrl = "http://base.google.com/ns-metadata/1.0"; private static final String googleBaseAppUrl = "http://purl.org/atom/app#"; + private static final String configString = "googleBaseExport.properties"; public static Map exportToGoogle(DispatchContext dctx, Map context) { Locale locale = (Locale) context.get("locale"); @@ -71,30 +73,14 @@ Map result = null; try { - String configString = "googleBaseExport.properties"; - - // get the Developer Key - String developerKey = UtilProperties.getPropertyValue(configString, "googleBaseExport.developerKey"); - - // get the Authentication Url - String authenticationUrl = UtilProperties.getPropertyValue(configString, "googleBaseExport.authenticationUrl"); - - // get the Google Account Email - String accountEmail = UtilProperties.getPropertyValue(configString, "googleBaseExport.accountEmail"); - - // get the Google Account Password - String accountPassword = UtilProperties.getPropertyValue(configString, "googleBaseExport.accountPassword"); - - // get the Url to Post Items - String postItemsUrl = UtilProperties.getPropertyValue(configString, "googleBaseExport.postItemsUrl"); - + Map<String, Object> googleBaseConfigResult = buildGoogleBaseConfig(context, delegator); StringBuffer dataItemsXml = new StringBuffer(); result = buildDataItemsXml(dctx, context, dataItemsXml); - if (!ServiceUtil.isFailure(result)) { - String token = authenticate(authenticationUrl, accountEmail, accountPassword); + if (!ServiceUtil.isFailure(result) && UtilValidate.isNotEmpty(googleBaseConfigResult)) { + String token = authenticate(googleBaseConfigResult.get("authenticationUrl").toString(), googleBaseConfigResult.get("accountEmail").toString(), googleBaseConfigResult.get("accountPassword").toString()); if (token != null) { - result = postItem(token, postItemsUrl, developerKey, dataItemsXml, locale, (String)context.get("testMode"), (List)result.get("newProductsInGoogle"), (List)result.get("productsRemovedFromGoogle"), dispatcher, delegator); + result = postItem(token, googleBaseConfigResult.get("postItemsUrl").toString(), googleBaseConfigResult.get("developerKey").toString(), dataItemsXml, locale, (String)context.get("testMode"), (List)result.get("newProductsInGoogle"), (List)result.get("productsRemovedFromGoogle"), dispatcher, delegator); } else { Debug.logError("Error during authentication to Google Account", module); return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "productsExportToGoogle.errorDuringAuthenticationToGoogle", locale)); @@ -456,11 +442,24 @@ // item_type is the categories in which your product should belong. UtilXml.addChildElementNSValue(entryElem, "g:item_type", "products", feedDocument, googleBaseNSUrl); - // adding the default values for products types. - // TODO: Figure out how best we can use the product_type along with OOTB ProductType associated with Product. - // Google base support big list of product type and here is the link (Refer title "Browse the taxonomy"): http://base.google.com/support/bin/answer.py?hl=en&answer=66818 - UtilXml.addChildElementNSValue(entryElem, "g:product_type", "Electronics", feedDocument, googleBaseNSUrl); - UtilXml.addChildElementNSValue(entryElem, "g:product_type", "Business & Industrial", feedDocument, googleBaseNSUrl); + List<GenericValue> productCategoryMembers = delegator.findList("ProductCategoryMember", EntityCondition.makeCondition("productId", EntityOperator.EQUALS, prod.getString("productId")), null, UtilMisc.toList("productCategoryId"), null, false); + + Iterator productCategoryMembersIter = productCategoryMembers.iterator(); + while (productCategoryMembersIter.hasNext()) { + GenericValue productCategoryMember = (GenericValue) productCategoryMembersIter.next(); + GenericValue productCategory = productCategoryMember.getRelatedOne("ProductCategory"); + String categoryDescription = ""; + if (UtilValidate.isNotEmpty(productCategory.getString("categoryName"))) { + categoryDescription = productCategory.getString("categoryName"); + } else if (UtilValidate.isNotEmpty(productCategory.getString("description"))) { + categoryDescription = productCategory.getString("description"); + } else if (UtilValidate.isNotEmpty(productCategory.getString("longDescription"))) { + categoryDescription = productCategory.getString("longDescription"); + } + if (UtilValidate.isNotEmpty(productCategory)) { + UtilXml.addChildElementNSValue(entryElem, "g:product_type", StringUtil.wrapString(categoryDescription).toString() , feedDocument, googleBaseNSUrl); + } + } UtilXml.addChildElementNSValue(entryElem, "g:price", price, feedDocument, googleBaseNSUrl); @@ -502,6 +501,7 @@ } index++; } + //Debug.logInfo("The value of generated String is ======== " + UtilXml.writeXmlDocument(feedDocument), module); dataItemsXml.append(UtilXml.writeXmlDocument(feedDocument)); } catch (IOException e) { return ServiceUtil.returnError("IO Error creating XML document for Google :" + e.getMessage()); @@ -589,4 +589,33 @@ } return ServiceUtil.returnSuccess(); } + + private static Map<String, Object> buildGoogleBaseConfig(Map<String, Object> context, GenericDelegator delegator) { + String productStoreId = (String) context.get("productStoreId"); + Map<String, Object> buildGoogleBaseConfigContext = FastMap.newInstance(); + + if (UtilValidate.isNotEmpty(productStoreId)) { + GenericValue googleBaseConfig = null; + try { + googleBaseConfig = delegator.findOne("GoogleBaseConfig", false, UtilMisc.toMap("productStoreId", productStoreId)); + } catch (GenericEntityException e) { + Debug.logError("Unable to find value for GoogleBaseConfig", module); + e.printStackTrace(); + } + if (UtilValidate.isNotEmpty(googleBaseConfig)) { + buildGoogleBaseConfigContext.put("developerKey", googleBaseConfig.getString("developerKey")); + buildGoogleBaseConfigContext.put("authenticationUrl", googleBaseConfig.getString("authenticationUrl")); + buildGoogleBaseConfigContext.put("accountEmail", googleBaseConfig.getString("accountEmail")); + buildGoogleBaseConfigContext.put("accountPassword", googleBaseConfig.getString("accountPassword")); + buildGoogleBaseConfigContext.put("postItemsUrl", googleBaseConfig.getString("postItemsUrl")); + } + } else { + buildGoogleBaseConfigContext.put("developerKey", UtilProperties.getPropertyValue(configString, "googleBaseExport.developerKey")); + buildGoogleBaseConfigContext.put("authenticationUrl", UtilProperties.getPropertyValue(configString, "googleBaseExport.authenticationUrl")); + buildGoogleBaseConfigContext.put("accountEmail", UtilProperties.getPropertyValue(configString, "googleBaseExport.accountEmail")); + buildGoogleBaseConfigContext.put("accountPassword", UtilProperties.getPropertyValue(configString, "googleBaseExport.accountPassword")); + buildGoogleBaseConfigContext.put("postItemsUrl", UtilProperties.getPropertyValue(configString, "googleBaseExport.postItemsUrl")); + } + return buildGoogleBaseConfigContext; + } } \ No newline at end of file Added: ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy?rev=809552&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy (added) +++ ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy Mon Aug 31 12:06:14 2009 @@ -0,0 +1,32 @@ +/* + * 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. + */ + +import org.ofbiz.webapp.website.WebSiteWorker; + +webSite = WebSiteWorker.getWebSite(request); +if (webSite) { + productStoreId = webSite.productStoreId; + context.productStoreId = productStoreId; + if (productStoreId) { + googleBaseConfig = delegator.findOne("GoogleBaseConfig", [productStoreId : productStoreId], false); + if (googleBaseConfig) { + context.webSiteUrl = googleBaseConfig.webSiteUrl; + } + } +} Propchange: ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/specialpurpose/googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml (original) +++ ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseForms.xml Mon Aug 31 12:06:14 2009 @@ -22,6 +22,7 @@ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd"> <form name="ProductsExportToGoogle" type="single" target="searchExportProductListToGoogle" header-row-style="header-row" default-table-style="basic-table"> + <field name="productStoreId"><hidden/></field> <field name="selectResult"><hidden/></field> <field name="countryCode" tooltip="${uiLabelMap.GoogleBaseExportCountryCode}"> <drop-down no-current-selected-key="US"> @@ -31,7 +32,7 @@ <option key="IT" description="${uiLabelMap.GoogleBaseExportCountryCodeIT}"/> </drop-down> </field> - <field name="webSiteUrl"><text size="50" maxlength="250"/></field> + <field name="webSiteUrl"><text size="50" maxlength="250" default-value="${webSiteUrl}"/></field> <field name="webSiteMountPoint"><text size="30" maxlength="30" default-value="ecommerce"/></field> <field name="actionType"> <drop-down no-current-selected-key="insert"> Modified: ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml?rev=809552&r1=809551&r2=809552&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml (original) +++ ofbiz/trunk/specialpurpose/googlebase/widget/GoogleBaseScreens.xml Mon Aug 31 12:06:14 2009 @@ -175,6 +175,7 @@ <actions> <set field="headerItem" value="googlebase"/> <set field="titleProperty" value="PageTitleGoogleBaseProductsExportToGoogle"/> + <script location="component://googlebase/webapp/googlebase/WEB-INF/actions/productsExportToGoogle.groovy"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> |
Free forum by Nabble | Edit this page |