You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/11/15 12:55:55 UTC

svn commit: r1202142 - in /ofbiz/trunk/applications/content: script/org/ofbiz/content/content/ContentServices.xml script/org/ofbiz/content/website/WebSiteServices.xml servicedef/services_content.xml

Author: hansbak
Date: Tue Nov 15 11:55:54 2011
New Revision: 1202142

URL: http://svn.apache.org/viewvc?rev=1202142&view=rev
Log:
extend the generation of seo friendly content url's now also to website subcontent

Modified:
    ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
    ofbiz/trunk/applications/content/script/org/ofbiz/content/website/WebSiteServices.xml
    ofbiz/trunk/applications/content/servicedef/services_content.xml

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml?rev=1202142&r1=1202141&r2=1202142&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml Tue Nov 15 11:55:54 2011
@@ -1414,70 +1414,34 @@
         <now-timestamp field="now"/>
         <set field="contentsNotUpdated" value="0" type="Integer"/>
         <set field="contentsUpdated" value="0" type="Integer"/>
-        <entity-and list="prodCatalogCategoryList" entity-name="ProdCatalogCategory" filter-by-date="false">
-            <field-map field-name="prodCatalogId" from-field="parameters.prodCatalogId"/>
-        </entity-and>
-        
-        <!-- Get all categories -->
-        <call-class-method method-name="newInstance" class-name="javolution.util.FastList" ret-field="parameters.productCategories"/>
-        <iterate entry="prodCatalogCategory" list="prodCatalogCategoryList">
-            <set field="rootProductCategoryId" from-field="prodCatalogCategory.productCategoryId"/>
-            <entity-and list="productCategoryRollupList" entity-name="ProductCategoryRollup" filter-by-date="true">
-                <field-map field-name="parentProductCategoryId" from-field="rootProductCategoryId"/>
+        <if-not-empty field="parameters.prodCatalogId">
+            <entity-and list="prodCatalogCategoryList" entity-name="ProdCatalogCategory" filter-by-date="false">
+                <field-map field-name="prodCatalogId" from-field="parameters.prodCatalogId"/>
             </entity-and>
-            <set field="parameters.parentProductCategoryId" from-field="rootProductCategoryId"/>
-            <call-simple-method method-name="createMissingCategoryContentAltUrlInline"/>
-        </iterate>
-        
-        <iterate entry="productCategoryList" list="parameters.productCategories">
-            <!-- Create Content Alternative URLs for Product Category Content -->
-            <entity-condition list="productCategoryContentAndInfoList" entity-name="ProductCategoryContentAndInfo" filter-by-date="true" use-cache="true">
-                <condition-list combine="and">
-                    <condition-expr field-name="productCategoryId" from-field="productCategoryList.productCategoryId"/>
-                    <condition-expr field-name="prodCatContentTypeId" operator="not-equals" value="ALTERNATIVE_URL"/>
-                </condition-list>
-                <order-by field-name="-fromDate"/>
-            </entity-condition>
-            <iterate entry="productCategoryContentAndInfo" list="productCategoryContentAndInfoList">
-                <set field="createMissingCategoryContentAltUrlsMap.contentId" from-field="productCategoryContentAndInfo.contentId"/>
-                <call-service service-name="createContentAlternativeUrl" in-map-name="createMissingCategoryContentAltUrlsMap">
-                    <result-to-field result-name="contentCreated" field="contentCreated"/>
-                </call-service>
-                <if-compare operator="equals" value="Y" field="contentCreated">
-                    <calculate field="contentsUpdated" type="Integer">
-                        <calcop operator="add" field="contentsUpdated">
-                            <number value="1"/>
-                        </calcop>
-                    </calculate>
-                </if-compare>
-                <if-compare operator="equals" value="N" field="contentCreated">
-                    <calculate field="contentsNotUpdated" type="Integer">
-                        <calcop operator="add" field="contentsNotUpdated">
-                            <number value="1"/>
-                        </calcop>
-                    </calculate>
-                </if-compare>
+            
+            <!-- Get all categories -->
+            <call-class-method method-name="newInstance" class-name="javolution.util.FastList" ret-field="parameters.productCategories"/>
+            <iterate entry="prodCatalogCategory" list="prodCatalogCategoryList">
+                <set field="rootProductCategoryId" from-field="prodCatalogCategory.productCategoryId"/>
+                <entity-and list="productCategoryRollupList" entity-name="ProductCategoryRollup" filter-by-date="true">
+                    <field-map field-name="parentProductCategoryId" from-field="rootProductCategoryId"/>
+                </entity-and>
+                <set field="parameters.parentProductCategoryId" from-field="rootProductCategoryId"/>
+                <call-simple-method method-name="createMissingCategoryContentAltUrlInline"/>
             </iterate>
             
-            <!-- Create Content Alternative URLs for Product Content -->
-            <entity-condition list="productCategoryMemberList" entity-name="ProductCategoryMember" filter-by-date="true" use-cache="true">
-                <condition-list combine="and">
-                    <condition-expr field-name="productCategoryId" from-field="productCategoryList.productCategoryId"/>
-                </condition-list>
-                <order-by field-name="-fromDate"/>
-            </entity-condition>
-            <iterate entry="productCategoryMember" list="productCategoryMemberList">
-                <set field="product.productId" from-field="productCategoryMember.productId"/>
-                <entity-condition list="productContentAndInfoList" entity-name="ProductContentAndInfo" filter-by-date="true" use-cache="true">
+            <iterate entry="productCategoryList" list="parameters.productCategories">
+                <!-- Create Content Alternative URLs for Product Category Content -->
+                <entity-condition list="productCategoryContentAndInfoList" entity-name="ProductCategoryContentAndInfo" filter-by-date="true" use-cache="true">
                     <condition-list combine="and">
-                        <condition-expr field-name="productId" from-field="product.productId"/>
-                        <condition-expr field-name="productContentTypeId" operator="not-equals" value="ALTERNATIVE_URL"/>
+                        <condition-expr field-name="productCategoryId" from-field="productCategoryList.productCategoryId"/>
+                        <condition-expr field-name="prodCatContentTypeId" operator="not-equals" value="ALTERNATIVE_URL"/>
                     </condition-list>
                     <order-by field-name="-fromDate"/>
                 </entity-condition>
-                <iterate entry="productContentAndInfo" list="productContentAndInfoList">
-                    <set field="createMissingProductContentAltUrlsMap.contentId" from-field="productContentAndInfo.contentId"/>
-                    <call-service service-name="createContentAlternativeUrl" in-map-name="createMissingProductContentAltUrlsMap">
+                <iterate entry="productCategoryContentAndInfo" list="productCategoryContentAndInfoList">
+                    <set field="createMissingCategoryContentAltUrlsMap.contentId" from-field="productCategoryContentAndInfo.contentId"/>
+                    <call-service service-name="createContentAlternativeUrl" in-map-name="createMissingCategoryContentAltUrlsMap">
                         <result-to-field result-name="contentCreated" field="contentCreated"/>
                     </call-service>
                     <if-compare operator="equals" value="Y" field="contentCreated">
@@ -1495,24 +1459,76 @@
                         </calculate>
                     </if-compare>
                 </iterate>
+                
+                <!-- Create Content Alternative URLs for Product Content -->
+                <entity-condition list="productCategoryMemberList" entity-name="ProductCategoryMember" filter-by-date="true" use-cache="true">
+                    <condition-list combine="and">
+                        <condition-expr field-name="productCategoryId" from-field="productCategoryList.productCategoryId"/>
+                    </condition-list>
+                    <order-by field-name="-fromDate"/>
+                </entity-condition>
+                <iterate entry="productCategoryMember" list="productCategoryMemberList">
+                    <set field="product.productId" from-field="productCategoryMember.productId"/>
+                    <entity-condition list="productContentAndInfoList" entity-name="ProductContentAndInfo" filter-by-date="true" use-cache="true">
+                        <condition-list combine="and">
+                            <condition-expr field-name="productId" from-field="product.productId"/>
+                            <condition-expr field-name="productContentTypeId" operator="not-equals" value="ALTERNATIVE_URL"/>
+                        </condition-list>
+                        <order-by field-name="-fromDate"/>
+                    </entity-condition>
+                    <iterate entry="productContentAndInfo" list="productContentAndInfoList">
+                        <set field="createMissingProductContentAltUrlsMap.contentId" from-field="productContentAndInfo.contentId"/>
+                        <call-service service-name="createContentAlternativeUrl" in-map-name="createMissingProductContentAltUrlsMap">
+                            <result-to-field result-name="contentCreated" field="contentCreated"/>
+                        </call-service>
+                        <if-compare operator="equals" value="Y" field="contentCreated">
+                            <calculate field="contentsUpdated" type="Integer">
+                                <calcop operator="add" field="contentsUpdated">
+                                    <number value="1"/>
+                                </calcop>
+                            </calculate>
+                        </if-compare>
+                        <if-compare operator="equals" value="N" field="contentCreated">
+                            <calculate field="contentsNotUpdated" type="Integer">
+                                <calcop operator="add" field="contentsNotUpdated">
+                                    <number value="1"/>
+                                </calcop>
+                            </calculate>
+                        </if-compare>
+                    </iterate>
+                </iterate>
             </iterate>
-        </iterate>
+        </if-not-empty>
         
-        <!-- Create Content Alternative URLs for Website Content (webSiteContentTypeId=BLOG_ROOT) -->
+        <!-- Create Content Alternative URLs for Website Content -->
         <entity-and list="webSiteContents" entity-name="WebSiteContent" filter-by-date="true">
             <field-map field-name="webSiteId" from-field="parameters.webSiteId"/>
-            <field-map field-name="webSiteContentTypeId" value="BLOG_ROOT"/>
         </entity-and>
-        <first-from-list entry="webSiteContent" list="webSiteContents"/>
-        <if-not-empty field="webSiteContent">
-            <entity-and list="blogContents" entity-name="ContentAssoc" filter-by-date="true">
+        <iterate entry="webSiteContent" list="webSiteContents">
+            <entity-and list="subContents" entity-name="ContentAssoc" filter-by-date="true">
                 <field-map field-name="contentId" from-field="webSiteContent.contentId"/>
-                <field-map field-name="contentAssocTypeId" value="SUB_CONTENT"/>
             </entity-and>
-            <iterate entry="blogContent" list="blogContents">
+            <iterate entry="subContent" list="subContents">
+                <set field="createMissingContentAltUrlsMap.contentId" from-field="subContent.contentIdTo"/>
+                <call-service service-name="createContentAlternativeUrl" in-map-name="createMissingContentAltUrlsMap">
+                    <result-to-field result-name="contentCreated" field="contentCreated"/>
+                </call-service>
+                <if-compare operator="equals" value="Y" field="contentCreated">
+                    <calculate field="contentsUpdated" type="Integer">
+                        <calcop operator="add" field="contentsUpdated">
+                            <number value="1"/>
+                        </calcop>
+                    </calculate>
+                </if-compare>
+                <if-compare operator="equals" value="N" field="contentCreated">
+                    <calculate field="contentsNotUpdated" type="Integer">
+                        <calcop operator="add" field="contentsNotUpdated">
+                            <number value="1"/>
+                        </calcop>
+                    </calculate>
+                </if-compare>
                 <entity-and list="contentAssocs" entity-name="ContentAssoc" filter-by-date="true">
-                    <field-map field-name="contentId" from-field="blogContent.contentIdTo"/>
-                    <field-map field-name="contentAssocTypeId" value="PUBLISH_LINK"/>
+                    <field-map field-name="contentId" from-field="subContent.contentIdTo"/>
                 </entity-and>
                 <iterate entry="contentAssoc" list="contentAssocs">
                     <set field="createMissingContentAltUrlsMap.contentId" from-field="contentAssoc.contentIdTo"/>
@@ -1535,7 +1551,7 @@
                     </if-compare>
                 </iterate>
             </iterate>
-        </if-not-empty>
+        </iterate>
         <field-to-result field="contentsNotUpdated" result-name="contentsNotUpdated"/>
         <field-to-result field="contentsUpdated" result-name="contentsUpdated"/>
     </simple-method>

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/website/WebSiteServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/website/WebSiteServices.xml?rev=1202142&r1=1202141&r2=1202142&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/website/WebSiteServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/website/WebSiteServices.xml Tue Nov 15 11:55:54 2011
@@ -209,47 +209,69 @@ under the License.
             <entity-and list="productStoreCatalogs" entity-name="ProductStoreCatalog" filter-by-date="true">
                 <field-map field-name="productStoreId" from-field="webSite.productStoreId"/>
             </entity-and>
-            <iterate entry="productStoreCatalog" list="productStoreCatalogs">
+            <if-not-empty field="productStoreCatalogs">
+                <iterate entry="productStoreCatalog" list="productStoreCatalogs">
+                    <iterate entry="typeGenerate" list="parameters.typeGenerate">
+                        <if-compare operator="equals" value="category" field="typeGenerate">
+                            <set field="createMissingCategoryAltUrlsMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
+                            <set field="createMissingCategoryAltUrlsMap.category" value="category"/>
+                            <call-service service-name="createMissingCategoryAndProductAltUrls" in-map-name="createMissingCategoryAltUrlsMap">
+                                <result-to-field result-name="categoriesNotUpdated" field="categoriesNotUpdated"/>
+                                <result-to-field result-name="categoriesUpdated" field="categoriesUpdated"/>
+                            </call-service>
+                            <calculate field="totalCategoriesNotUpdated" type="Integer">
+                                <calcop operator="add" field="totalCategoriesNotUpdated">
+                                    <calcop operator="get" field="categoriesNotUpdated"/>
+                                </calcop>
+                            </calculate>
+                            <calculate field="totalCategoriesUpdated" type="Integer">
+                                <calcop operator="add" field="totalCategoriesUpdated">
+                                    <calcop operator="get" field="categoriesUpdated"/>
+                                </calcop>
+                            </calculate>
+                        </if-compare>
+                        <if-compare operator="equals" value="product" field="typeGenerate">
+                            <set field="createMissingProductAltUrlsMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
+                            <set field="createMissingProductAltUrlsMap.product" value="product"/>
+                            <call-service service-name="createMissingCategoryAndProductAltUrls" in-map-name="createMissingProductAltUrlsMap">
+                                <result-to-field result-name="productsNotUpdated" field="productsNotUpdated"/>
+                                <result-to-field result-name="productsUpdated" field="productsUpdated"/>
+                            </call-service>
+                            <calculate field="totalProductsNotUpdated" type="Integer">
+                                <calcop operator="add" field="totalProductsNotUpdated">
+                                    <calcop operator="get" field="productsNotUpdated"/>
+                                </calcop>
+                            </calculate>
+                            <calculate field="totalProductsUpdated" type="Integer">
+                                <calcop operator="add" field="totalProductsUpdated">
+                                    <calcop operator="get" field="productsUpdated"/>
+                                </calcop>
+                            </calculate>
+                        </if-compare>
+                        <if-compare operator="equals" value="content" field="typeGenerate">
+                            <set field="createMissingContentAltUrlsMap.webSiteId" from-field="parameters.webSiteId"/>
+                            <set field="createMissingContentAltUrlsMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
+                            <call-service service-name="createMissingContentAltUrls" in-map-name="createMissingContentAltUrlsMap">
+                                <result-to-field result-name="contentsNotUpdated" field="contentsNotUpdated"/>
+                                <result-to-field result-name="contentsUpdated" field="contentsUpdated"/>
+                            </call-service>
+                            <calculate field="totalContentsNotUpdated" type="Integer">
+                                <calcop operator="add" field="contentsNotUpdated">
+                                    <calcop operator="get" field="productsNotUpdated"/>
+                                </calcop>
+                            </calculate>
+                            <calculate field="totalContentsUpdated" type="Integer">
+                                <calcop operator="add" field="totalContentsUpdated">
+                                    <calcop operator="get" field="contentsUpdated"/>
+                                </calcop>
+                            </calculate>
+                        </if-compare>
+                    </iterate>
+                </iterate>
+            <else>
                 <iterate entry="typeGenerate" list="parameters.typeGenerate">
-                    <if-compare operator="equals" value="category" field="typeGenerate">
-                        <set field="createMissingCategoryAltUrlsMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
-                        <set field="createMissingCategoryAltUrlsMap.category" value="category"/>
-                        <call-service service-name="createMissingCategoryAndProductAltUrls" in-map-name="createMissingCategoryAltUrlsMap">
-                            <result-to-field result-name="categoriesNotUpdated" field="categoriesNotUpdated"/>
-                            <result-to-field result-name="categoriesUpdated" field="categoriesUpdated"/>
-                        </call-service>
-                        <calculate field="totalCategoriesNotUpdated" type="Integer">
-                            <calcop operator="add" field="totalCategoriesNotUpdated">
-                                <calcop operator="get" field="categoriesNotUpdated"/>
-                            </calcop>
-                        </calculate>
-                        <calculate field="totalCategoriesUpdated" type="Integer">
-                            <calcop operator="add" field="totalCategoriesUpdated">
-                                <calcop operator="get" field="categoriesUpdated"/>
-                            </calcop>
-                        </calculate>
-                    </if-compare>
-                    <if-compare operator="equals" value="product" field="typeGenerate">
-                        <set field="createMissingProductAltUrlsMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
-                        <set field="createMissingProductAltUrlsMap.product" value="product"/>
-                        <call-service service-name="createMissingCategoryAndProductAltUrls" in-map-name="createMissingProductAltUrlsMap">
-                            <result-to-field result-name="productsNotUpdated" field="productsNotUpdated"/>
-                            <result-to-field result-name="productsUpdated" field="productsUpdated"/>
-                        </call-service>
-                        <calculate field="totalProductsNotUpdated" type="Integer">
-                            <calcop operator="add" field="totalProductsNotUpdated">
-                                <calcop operator="get" field="productsNotUpdated"/>
-                            </calcop>
-                        </calculate>
-                        <calculate field="totalProductsUpdated" type="Integer">
-                            <calcop operator="add" field="totalProductsUpdated">
-                                <calcop operator="get" field="productsUpdated"/>
-                            </calcop>
-                        </calculate>
-                    </if-compare>
                     <if-compare operator="equals" value="content" field="typeGenerate">
                         <set field="createMissingContentAltUrlsMap.webSiteId" from-field="parameters.webSiteId"/>
-                        <set field="createMissingContentAltUrlsMap.prodCatalogId" from-field="productStoreCatalog.prodCatalogId"/>
                         <call-service service-name="createMissingContentAltUrls" in-map-name="createMissingContentAltUrlsMap">
                             <result-to-field result-name="contentsNotUpdated" field="contentsNotUpdated"/>
                             <result-to-field result-name="contentsUpdated" field="contentsUpdated"/>
@@ -266,7 +288,8 @@ under the License.
                         </calculate>
                     </if-compare>
                 </iterate>
-            </iterate>
+            </else>
+            </if-not-empty>
         <else>
             <iterate entry="typeGenerate" list="parameters.typeGenerate">
                 <if-compare operator="equals" value="category" field="typeGenerate">

Modified: ofbiz/trunk/applications/content/servicedef/services_content.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_content.xml?rev=1202142&r1=1202141&r2=1202142&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services_content.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services_content.xml Tue Nov 15 11:55:54 2011
@@ -344,7 +344,7 @@
     <service name="createMissingContentAltUrls" engine="simple"
                 location="component://content/script/org/ofbiz/content/content/ContentServices.xml" invoke="createMissingContentAltUrls" auth="true" use-transaction="false">
         <description>Create missing Content Alternative URLs</description>
-        <attribute name="prodCatalogId" mode="IN" type="String" optional="false"/>
+        <attribute name="prodCatalogId" mode="IN" type="String" optional="true"/>
         <attribute name="webSiteId" mode="IN" type="String" optional="true"/>
         <attribute name="contentsNotUpdated" mode="OUT" type="Integer" optional="true"/>
         <attribute name="contentsUpdated" mode="OUT" type="Integer" optional="true"/>