git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@1747850 13f79535-47bb-0310-9956-ffa450edef68
176 lines
12 KiB
XML
176 lines
12 KiB
XML
<?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.
|
|
-->
|
|
|
|
<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
|
|
<simple-method method-name="autoUpdateToGoogleBase" short-description="Auto update to google base" >
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="productStoreIds">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStoreId"/>
|
|
</call-class-method>
|
|
<set field="productStoreIds" value="${groovy: spl = productStoreIds.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="outOfStocks">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.option.outOfStock"/>
|
|
</call-class-method>
|
|
<set field="outOfStocks" value="${groovy: spl = outOfStocks.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="backInStocks">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.option.backInStock"/>
|
|
</call-class-method>
|
|
<set field="backInStocks" value="${groovy: spl = backInStocks.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="webSiteUrls">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.webSiteUrl"/>
|
|
</call-class-method>
|
|
<set field="webSiteUrls" value="${groovy: spl = webSiteUrls.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="actionTypes">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.actionType"/>
|
|
</call-class-method>
|
|
<set field="actionTypes" value="${groovy: spl = actionTypes.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="statusIds">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.statusId"/>
|
|
</call-class-method>
|
|
<set field="statusIds" value="${groovy: spl = statusIds.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="testModes">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.testMode"/>
|
|
</call-class-method>
|
|
<set field="testModes" value="${groovy: spl = testModes.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="webSiteMountPoints">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.webSiteMountPoint"/>
|
|
</call-class-method>
|
|
<set field="webSiteMountPoints" value="${groovy: spl = webSiteMountPoints.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="countryCodes">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.countryCode"/>
|
|
</call-class-method>
|
|
<set field="countryCodes" value="${groovy: spl = countryCodes.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="trackingCodeIds">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.trackingCodeId"/>
|
|
</call-class-method>
|
|
<set field="trackingCodeIds" value="${groovy: spl = trackingCodeIds.split(","); return spl.toList();}" type="List"/>
|
|
<call-class-method method-name="getPropertyValue" class-name="org.ofbiz.base.util.UtilProperties" ret-field="allowRecommendeds">
|
|
<string value="autoUpdateToGoogleBase.properties"/>
|
|
<string value="autoUpdateGoogleBase.productStore.allowRecommended"/>
|
|
</call-class-method>
|
|
<set field="allowRecommendeds" value="${groovy: spl = allowRecommendeds.split(","); return spl.toList();}" type="List"/>
|
|
|
|
<!-- read configs from autoUpdateToGoogleBase.properties, then iterate each ProductStore-->
|
|
<set field="indexOfSetting" value="0" type="Integer"/>
|
|
<iterate entry="productStoreId" list="productStoreIds">
|
|
<entity-one value-field="productStore" entity-name="ProductStore"/>
|
|
<log level="info" message="======= autoUpdateToGoogleBase.properties of productStoreId[${productStoreId}] ==="/>
|
|
<log level="info" message="=== outOfStocks: ${outOfStocks[indexOfSetting]}"/>
|
|
<log level="info" message="=== backInStocks: ${backInStocks[indexOfSetting]}"/>
|
|
<log level="info" message="=== webSiteUrls: ${webSiteUrls[indexOfSetting]}"/>
|
|
<log level="info" message="=== actionTypes: ${actionTypes[indexOfSetting]}"/>
|
|
<log level="info" message="=== statusIds: ${statusIds[indexOfSetting]}"/>
|
|
<log level="info" message="=== testModes: ${testModes[indexOfSetting]}"/>
|
|
<log level="info" message="=== webSiteMountPoints: ${webSiteMountPoints[indexOfSetting]}"/>
|
|
<log level="info" message="=== countryCodes$: ${countryCodes[indexOfSetting]}"/>
|
|
<log level="info" message="=== trackingCodeIds: ${trackingCodeIds[indexOfSetting]}"/>
|
|
<log level="info" message="=== allowRecommendeds: ${allowRecommendeds[indexOfSetting]}"/>
|
|
<set field="parameters.productStoreId" from-field="productStoreId"/>
|
|
<script location="component://googlebase/groovyScripts/ProductsToGooglebase.groovy"/>
|
|
<!-- iterate each CatalogList in each ProductStore -->
|
|
<iterate entry="catalogCategoryIds" list="categoryIds">
|
|
<if-not-empty field="catalogCategoryIds">
|
|
<!-- iterate each Category in each Catalog -->
|
|
<iterate entry="categoryId" list="catalogCategoryIds">
|
|
<if-not-empty field="categoryId">
|
|
<set field="categoryIdMap.categoryId" from-field="categoryId"/>
|
|
<call-service service-name="getProductCategoryMembers" in-map-name="categoryIdMap">
|
|
<result-to-field result-name="categoryMembers"/>
|
|
</call-service>
|
|
<if-not-empty field="categoryMembers">
|
|
<!-- iterate each CategoryMembers(Product) in Category-->
|
|
<iterate entry="categoryMember" list="categoryMembers">
|
|
<field-to-list list="productList" field="categoryMember.productId"/>
|
|
</iterate>
|
|
</if-not-empty>
|
|
</if-not-empty>
|
|
</iterate>
|
|
</if-not-empty>
|
|
</iterate>
|
|
<if>
|
|
<condition>
|
|
<and>
|
|
<if-compare operator="equals" value="N" field="outOfStocks[indexOfSetting]"/>
|
|
<if-compare operator="equals" value="N" field="backInStocks[indexOfSetting]"/>
|
|
</and>
|
|
</condition>
|
|
<then>
|
|
<return/>
|
|
</then>
|
|
</if>
|
|
<if-not-empty field="productList">
|
|
<script location="component://googlebase/groovyScripts/GooglebaseDivideList.groovy"/>
|
|
<set field="i" value="0" type="Integer"/>
|
|
<iterate entry="productExportList" list="productExportLists">
|
|
<iterate entry="checkProductId" list="productExportList">
|
|
<set field="isAvailableMap.productId" from-field="checkProductId"/>
|
|
<set field="isAvailableMap.productStoreId" from-field="productStoreId"/>
|
|
<set field="isAvailableMap.quantity" value="1" type="BigDecimal"/>
|
|
<call-service service-name="isStoreInventoryAvailable" in-map-name="isAvailableMap">
|
|
<result-to-field result-name="available"/>
|
|
</call-service>
|
|
<if-compare operator="not-equals" value="N" field="outOfStocks[indexOfSetting]">
|
|
<if-compare operator="equals" value="N" field="available">
|
|
<field-to-list list="selectResult" field="checkProductId"/>
|
|
</if-compare>
|
|
</if-compare>
|
|
<if-compare operator="not-equals" value="N" field="backInStocks[indexOfSetting]">
|
|
<if-compare operator="equals" value="Y" field="available">
|
|
<field-to-list list="selectResult" field="checkProductId"/>
|
|
</if-compare>
|
|
</if-compare>
|
|
</iterate>
|
|
<set field="inMap.selectResult" from-field="selectResult"/>
|
|
<set field="inMap.webSiteUrl" from-field="webSiteUrls[indexOfSetting]"/>
|
|
<set field="inMap.actionType" from-field="actionTypes[indexOfSetting]"/>
|
|
<set field="inMap.statusId" from-field="statusIds[indexOfSetting]"/>
|
|
<set field="inMap.testMode" from-field="testModes[indexOfSetting]"/>
|
|
<set field="inMap.webSiteMountPoint" from-field="webSiteMountPoints[indexOfSetting]"/>
|
|
<set field="inMap.countryCode" from-field="countryCodes[indexOfSetting]"/>
|
|
<set field="inMap.trackingCodeId" from-field="trackingCodeIds[indexOfSetting]"/>
|
|
<set field="inMap.allowRecommended" from-field="allowRecommendeds[indexOfSetting]"/>
|
|
<set field="inMap.userLogin" from-field="userLogin"/>
|
|
<set field="inMap.productStoreId" from-field="productStoreId"/>
|
|
<!--<log level="info" message="=== productStoreId[${productStoreId}] inMap section[${i}]: ${inMap}"/>-->
|
|
<call-service service-name="exportToGoogle" in-map-name="inMap"/>
|
|
<field-to-list list="allProductExportList" field="selectResult"/>
|
|
<clear-field field="selectResult"/>
|
|
<clear-field field="inMap"/>
|
|
<clear-field field="productList"/>
|
|
<set field="i" value="${groovy: i+1}" type="Integer"/>
|
|
</iterate>
|
|
</if-not-empty>
|
|
<set field="indexOfSetting" value="${groovy: indexOfSetting + 1;}" type="Integer"/>
|
|
</iterate>
|
|
<field-to-result field="allProductExportList"/>
|
|
<log level="info" message="=== allProductExportList ${allProductExportList}"/>
|
|
</simple-method>
|
|
</simple-methods>
|