svn commit: r661941 - in /ofbiz/trunk/applications/product: webapp/catalog/WEB-INF/actions/feature/ widget/catalog/

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

svn commit: r661941 - in /ofbiz/trunk/applications/product: webapp/catalog/WEB-INF/actions/feature/ widget/catalog/

mrisaliti
Author: mrisaliti
Date: Fri May 30 21:59:52 2008
New Revision: 661941

URL: http://svn.apache.org/viewvc?rev=661941&view=rev
Log:
Converted EditFeatureCategoryFeatures.bsh/EditFeatureGroups.bsh/QuickAddProductFeatures.bsh to groovy (Part of issue OFBIZ-1801)

Added:
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.groovy
      - copied, changed from r661940, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.bsh
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.groovy
      - copied, changed from r661940, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.bsh
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.groovy
      - copied, changed from r661940, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.bsh
Removed:
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.bsh
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.bsh
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.bsh
Modified:
    ofbiz/trunk/applications/product/widget/catalog/FeatureScreens.xml

Copied: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.groovy (from r661940, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.groovy?p2=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.groovy&p1=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.bsh&r1=661940&r2=661941&rev=661941&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.groovy Fri May 30 21:59:52 2008
@@ -17,50 +17,43 @@
  * under the License.
  */
 
-import java.util.*;
-import java.io.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.entity.condition.*;
-import org.ofbiz.entity.util.EntityFindOptions;
-import org.ofbiz.entity.transaction.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.widget.html.*;
+import org.ofbiz.entity.*
+import org.ofbiz.entity.condition.*
+import org.ofbiz.entity.util.EntityFindOptions
+import org.ofbiz.base.util.*
+import org.ofbiz.entity.transaction.*
 
-module = "EditFeatureCategoryFeatures.bsh";
+module = "EditFeatureCategoryFeatures.groovy";
 
 security = request.getAttribute("security");
 delegator = request.getAttribute("delegator");
 
 if(security.hasEntityPermission("CATALOG", "_VIEW", session)) {
-    context.put("hasPermission", Boolean.TRUE);
+    context.hasPermission = Boolean.TRUE;
 } else {
-    context.put("hasPermission", Boolean.FALSE);
+    context.hasPermission = Boolean.FALSE;
 }
-nowTimestampString = UtilDateTime.nowTimestamp().toString();
-context.put("nowTimestampString", nowTimestampString);
+
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
 
 productId = request.getParameter("productId");
-context.put("productId", productId);
+context.productId = productId;
 
-productFeatureCategoryId = parameters.get("productFeatureCategoryId");
-context.put("productFeatureCategoryId", productFeatureCategoryId);
+productFeatureCategoryId = parameters.get("productFeatureCategoryId");
+context.productFeatureCategoryId = productFeatureCategoryId;
 
-curProductFeatureCategory = delegator.findByPrimaryKey("ProductFeatureCategory", UtilMisc.toMap("productFeatureCategoryId", productFeatureCategoryId));
-context.put("curProductFeatureCategory", curProductFeatureCategory);
+context.curProductFeatureCategory = delegator.findByPrimaryKey("ProductFeatureCategory", ['productFeatureCategoryId' : productFeatureCategoryId]);
 
-productFeatureTypes = delegator.findList("ProductFeatureType", null, null, UtilMisc.toList("description"), null, false);
-context.put("productFeatureTypes", productFeatureTypes);
+context.productFeatureTypes = delegator.findList("ProductFeatureType", null, null, ['description'], null, false);
 
-productFeatureCategories = delegator.findList("ProductFeatureCategory", null, null, UtilMisc.toList("description"), null, false);
-context.put("productFeatureCategories", productFeatureCategories);
+context.productFeatureCategories = delegator.findList("ProductFeatureCategory", null, null, ['description'], null, false);
 
 //we only need these if we will be showing the apply feature to category forms
-if (productId != null && productId.length() > 0) {
-    productFeatureApplTypes = delegator.findList("ProductFeatureApplType", null, null, UtilMisc.toList("description"), null, false);
-    context.put("productFeatureApplTypes", productFeatureApplTypes);
+if (productId && productId.length() > 0) {
+    context.productFeatureApplTypes = delegator.findList("ProductFeatureApplType", null, null, ['description'], null, false);
 }
 
-productFeaturesSize = delegator.findCountByCondition("ProductFeature", EntityCondition.makeCondition("productFeatureCategoryId", EntityOperator.EQUALS, productFeatureCategoryId), null, null);
+productFeaturesSize = delegator.findCountByCondition("ProductFeature", new EntityExpr("productFeatureCategoryId", EntityOperator.EQUALS, productFeatureCategoryId), null, null);
 
 int highIndex = 0;
 int lowIndex = 0;
@@ -76,13 +69,13 @@
     highIndex = listSize;
 }
 
-context.put("viewIndex", viewIndex);
-context.put("viewSize", viewSize);
-context.put("listSize", listSize);
-context.put("lowIndex", lowIndex);
-context.put("highIndex", highIndex);
+context.viewIndex = viewIndex;
+context.viewSize = viewSize;
+context.listSize = listSize;
+context.lowIndex = lowIndex;
+context.highIndex = highIndex;
 
-whereCondition = EntityCondition.makeCondition(UtilMisc.toMap("productFeatureCategoryId", productFeatureCategoryId), EntityOperator.AND);
+whereCondition = new EntityFieldMap(['productFeatureCategoryId' : productFeatureCategoryId], EntityOperator.AND);
 EntityFindOptions efo = new EntityFindOptions();
 efo.setDistinct(true);
 efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
@@ -91,7 +84,7 @@
 try {
     beganTransaction = TransactionUtil.begin();
 
-    productFeaturesEli = delegator.find("ProductFeature", whereCondition, null, null, UtilMisc.toList("productFeatureTypeId", "defaultSequenceNum", "description"), efo);
+    productFeaturesEli = delegator.find("ProductFeature", whereCondition, null, null, ['productFeatureTypeId', 'defaultSequenceNum', 'description'], efo);
     productFeatures = productFeaturesEli.getPartialList(lowIndex + 1, highIndex - lowIndex);
     productFeaturesEli.close();
 } catch (GenericEntityException e) {
@@ -110,7 +103,7 @@
     TransactionUtil.commit(beganTransaction);
 }
 
-context.put("productFeatures", productFeatures);
+context.productFeatures = productFeatures;
 
 productFeatureApplMap = new HashMap();
 productFeatureAppls = null;
@@ -118,11 +111,11 @@
 productFeatureApplIter = null;
 while (productFeatureIter.hasNext()) {
     productFeature = productFeatureIter.next();
-    productFeatureAppls = delegator.findByAnd("ProductFeatureAppl", UtilMisc.toMap("productId", productId, "productFeatureId", productFeature.getString("productFeatureId")), null);
+    productFeatureAppls = delegator.findByAnd("ProductFeatureAppl", ['productId' : productId, 'productFeatureId' : productFeature.productFeatureId], null);
     productFeatureApplIter = productFeatureAppls.iterator();
     while (productFeatureApplIter.hasNext()) {
         productFeatureAppl = productFeatureApplIter.next();
-        productFeatureApplMap.put(productFeatureAppl.getString("productFeatureId"), productFeatureAppl.getString("productFeatureApplTypeId"));
+        productFeatureApplMap.put(productFeatureAppl.productFeatureId, productFeatureAppl.productFeatureApplTypeId);
     }
 }
-context.put("productFeatureApplMap", productFeatureApplMap);
+context.productFeatureApplMap = productFeatureApplMap;
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.groovy (from r661940, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.groovy?p2=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.groovy&p1=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.bsh&r1=661940&r2=661941&rev=661941&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.groovy Fri May 30 21:59:52 2008
@@ -17,17 +17,13 @@
  * under the License.
  */
 
-import org.ofbiz.base.util.*;
-import org.ofbiz.entity.*;
-
 security = request.getAttribute("security");
 delegator = request.getAttribute("delegator");
 
 if(security.hasEntityPermission("CATALOG", "_VIEW", session)) {
-    context.put("hasPermission", Boolean.TRUE);
+    context.hasPermission = Boolean.TRUE;
 } else {
-    context.put("hasPermission", Boolean.FALSE);
+    context.hasPermission = Boolean.FALSE;
 }
 
-productFeatureGroups = delegator.findList("ProductFeatureGroup", null, null, null, null, false);
-context.put("productFeatureGroups", productFeatureGroups);
+context.productFeatureGroups = delegator.findList("ProductFeatureGroup", null, null, null, null, false);
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.groovy (from r661940, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.groovy?p2=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.groovy&p1=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.bsh&r1=661940&r2=661941&rev=661941&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.groovy Fri May 30 21:59:52 2008
@@ -17,11 +17,8 @@
  * under the License.
  */
 
-import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilMisc
 
-productFeatureTypes = delegator.findList("ProductFeatureType", null, null, UtilMisc.toList("description"), null, true);
-context.put("productFeatureTypes", productFeatureTypes);
+context.productFeatureTypes = delegator.findList("ProductFeatureType", null, null, ['description'], null, true);
 
-featureCategory = delegator.findByPrimaryKey("ProductFeatureCategory",
-    UtilMisc.toMap("productFeatureCategoryId", parameters.get("productFeatureCategoryId")));
-context.put("featureCategory", featureCategory);
+context.featureCategory = delegator.findByPrimaryKey("ProductFeatureCategory", ['productFeatureCategoryId' : parameters.productFeatureCategoryId]);
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/widget/catalog/FeatureScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/FeatureScreens.xml?rev=661941&r1=661940&r2=661941&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/FeatureScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/FeatureScreens.xml Fri May 30 21:59:52 2008
@@ -327,7 +327,7 @@
                 <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer" default-value="0"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="10"/>
                 
-                <!--script location="component://product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategories.bsh"/-->
+                <!--script location="component://product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategories.groovy"/-->
             </actions>
             <widgets>
                 <decorator-screen name="CommonFeatureDecorator">
@@ -367,7 +367,7 @@
     
                 <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="50"/>
-                <script location="component://product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.bsh"/>
+                <script location="component://product/webapp/catalog/WEB-INF/actions/feature/EditFeatureCategoryFeatures.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFeatureDecorator">
@@ -387,7 +387,7 @@
                 <set field="headerItem" value="featurecats"/>
                 <set field="tabButtonItem" value="FeatureGroup"/>
     
-                <script location="component://product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.bsh"/>
+                <script location="component://product/webapp/catalog/WEB-INF/actions/feature/EditFeatureGroups.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFeatureDecorator">
@@ -480,7 +480,7 @@
                 <set field="featureNum" from-field="parameters.featureNum" type="Integer"/>
                 <set field="productFeatureCategoryId" from-field="parameters.productFeatureCategoryId"/>
                 <set field="tabButtonItem" value="FeatureCategory"/>
-                <script location="component://product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.bsh"/>
+                <script location="component://product/webapp/catalog/WEB-INF/actions/feature/QuickAddProductFeatures.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFeatureDecorator">