svn commit: r545137 - in /ofbiz/trunk/applications/product: script/org/ofbiz/product/product/ProductServices.xml servicedef/services.xml src/org/ofbiz/product/product/KeywordIndex.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r545137 - in /ofbiz/trunk/applications/product: script/org/ofbiz/product/product/ProductServices.xml servicedef/services.xml src/org/ofbiz/product/product/KeywordIndex.java

jacopoc
Author: jacopoc
Date: Thu Jun  7 03:03:45 2007
New Revision: 545137

URL: http://svn.apache.org/viewvc?view=rev&rev=545137
Log:
Added util methods and services to bulk create/delete ProductKeywords: they are going to replace the existing event. Part of issue OFBIZ-1046

Modified:
    ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
    ofbiz/trunk/applications/product/servicedef/services.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml?view=diff&rev=545137&r1=545136&r2=545137
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml Thu Jun  7 03:03:45 2007
@@ -310,6 +310,16 @@
         <entity-one entity-name="ProductKeyword" value-name="lookedUpValue"/>
         <remove-value value-name="lookedUpValue"/>
     </simple-method>
+    <simple-method method-name="forceIndexProductKeywords" short-description="induce all the keywords of a product">
+        <entity-one entity-name="Product" value-name="product"/>
+        <call-class-method class-name="org.ofbiz.product.product.KeywordIndex" method-name="forceIndexKeywords">
+            <field field-name="product" type="org.ofbiz.entity.GenericValue"/>
+        </call-class-method>
+    </simple-method>
+    <simple-method method-name="deleteProductKeywords" short-description="delete all the keywords of a product">
+        <entity-one entity-name="Product" value-name="product"/>
+        <remove-related value-name="product" relation-name="ProductKeyword"/>
+    </simple-method>
 
     <simple-method method-name="indexProductKeywords" short-description="Index the Keywords for a Product" login-required="false">
         <!-- this service is meant to be called from an entity ECA for entities that include a productId -->
@@ -330,7 +340,7 @@
                 </or>
             </condition>
             <then>
-                <call-class-method class-name="org.ofbiz.product.product.KeywordSearch" method-name="induceKeywords">
+                <call-class-method class-name="org.ofbiz.product.product.KeywordIndex" method-name="indexKeywords">
                     <field field-name="productInstance" type="org.ofbiz.entity.GenericValue"/>
                 </call-class-method>
             </then>

Modified: ofbiz/trunk/applications/product/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?view=diff&rev=545137&r1=545136&r2=545137
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services.xml Thu Jun  7 03:03:45 2007
@@ -141,11 +141,23 @@
         <permission-service service-name="productGenericPermission" main-action="DELETE"/>
         <auto-attributes include="pk" mode="IN" optional="false"/>
     </service>
+    <service name="deleteProductKeywords" engine="simple"
+            location="org/ofbiz/product/product/ProductServices.xml" invoke="deleteProductKeywords" auth="true">
+        <description>Delete all the keywords of a product</description>
+        <permission-service service-name="productGenericPermission" main-action="DELETE"/>
+        <attribute name="productId" type="String" mode="IN" optional="false"/>
+    </service>
     <service name="indexProductKeywords" engine="simple"
                 location="org/ofbiz/product/product/ProductServices.xml" invoke="indexProductKeywords" auth="false">
         <description>Index the Keywords for a Product</description>
         <attribute name="productId" type="String" mode="IN" optional="false"/>
         <attribute name="productInstance" type="GenericValue" mode="IN" optional="true"/>
+    </service>
+    <service name="forceIndexProductKeywords" engine="simple"
+            location="org/ofbiz/product/product/ProductServices.xml" invoke="forceIndexProductKeywords" auth="true">
+        <description>Induce all the keywords of a product, ignoring the flag in the Product.autoCreateKeywords flag</description>
+        <permission-service service-name="productGenericPermission" main-action="CREATE"/>
+        <attribute name="productId" type="String" mode="IN" optional="false"/>
     </service>
 
     <service name="discontinueProductSales" engine="simple"

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java?view=diff&rev=545137&r1=545136&r2=545137
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/KeywordIndex.java Thu Jun  7 03:03:45 2007
@@ -48,6 +48,14 @@
     
     public static final String module = KeywordIndex.class.getName();
 
+    public static void forceIndexKeywords(GenericValue product) throws GenericEntityException {
+        KeywordIndex.indexKeywords(product, true);
+    }
+
+    public static void indexKeywords(GenericValue product) throws GenericEntityException {
+        KeywordIndex.indexKeywords(product, false);
+    }
+
     public static void indexKeywords(GenericValue product, boolean doAll) throws GenericEntityException {
         if (product == null) return;
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();