Author: mrisaliti
Date: Tue May 27 15:00:09 2008 New Revision: 660738 URL: http://svn.apache.org/viewvc?rev=660738&view=rev Log: Converted ApplyFeaturesFromCategory.bsh/ApplyFeaturesFromGroup to groovy (Part of issue OFBIZ-1801) Added: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy - copied, changed from r660696, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.bsh ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy - copied, changed from r660696, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh Removed: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.bsh ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh Modified: ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Copied: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy (from r660696, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy?p2=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy&p1=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.bsh&r1=660696&r2=660738&rev=660738&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.bsh (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy Tue May 27 15:00:09 2008 @@ -17,39 +17,30 @@ * 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.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.*; -module = "ApplyFeaturesFromCategory.bsh"; +module = "ApplyFeaturesFromCategory.groovy"; -nowTimestampString = UtilDateTime.nowTimestamp().toString(); -context.put("nowTimestampString", nowTimestampString); +context.nowTimestampString = UtilDateTime.nowTimestamp().toString(); productFeatureCategoryId = request.getParameter("productFeatureCategoryId"); -context.put("productFeatureCategoryId", productFeatureCategoryId); +context.productFeatureCategoryId = productFeatureCategoryId; -selFeatureApplTypeId = request.getParameter("productFeatureApplTypeId"); -context.put("selFeatureApplTypeId", selFeatureApplTypeId); +context.selFeatureApplTypeId = request.getParameter("productFeatureApplTypeId"); -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); + context.productFeatureApplTypes = delegator.findList("ProductFeatureApplType", null, null, ['description'], null, false); } productFeaturesSize = delegator.findCountByCondition("ProductFeature", new EntityExpr("productFeatureCategoryId", EntityOperator.EQUALS, productFeatureCategoryId), null, null); @@ -67,13 +58,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 = new EntityFieldMap(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); @@ -82,7 +73,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) { @@ -101,7 +92,7 @@ TransactionUtil.commit(beganTransaction); } -context.put("productFeatures", productFeatures); +context.productFeatures = productFeatures; productFeatureApplMap = new HashMap(); productFeatureAppls = null; @@ -109,11 +100,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/product/ApplyFeaturesFromGroup.groovy (from r660696, ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy?p2=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy&p1=ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh&r1=660696&r2=660738&rev=660738&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy Tue May 27 15:00:09 2008 @@ -22,24 +22,24 @@ * Puts productFeatureGroup and productFeatures which are put of this group into the context. Currently does not break out the features by view size. */ -import org.ofbiz.base.util.UtilMisc; -import org.ofbiz.entity.GenericDelegator; -import org.ofbiz.entity.GenericEntity; +import org.ofbiz.base.util.UtilMisc +import org.ofbiz.entity.GenericDelegator +import org.ofbiz.entity.GenericEntity productFeatureGroupId = parameters.get("productFeatureGroupId"); if ((productFeatureGroupId != null) && !(productFeatureGroupId.equals(""))) { - productFeatureGroup = delegator.findByPrimaryKey("ProductFeatureGroup", UtilMisc.toMap("productFeatureGroupId", productFeatureGroupId)); + productFeatureGroup = delegator.findByPrimaryKey("ProductFeatureGroup", ['productFeatureGroupId' : productFeatureGroupId]); productFeatures = new LinkedList(); - productFeatureGroupAppls = productFeatureGroup.getRelated("ProductFeatureGroupAppl", UtilMisc.toList("sequenceNum")); + productFeatureGroupAppls = productFeatureGroup.getRelated("ProductFeatureGroupAppl", ['sequenceNum']); for (pFGAi = productFeatureGroupAppls.iterator(); pFGAi.hasNext(); ) { productFeatureGroupAppl = (GenericEntity)pFGAi.next(); productFeature = (GenericEntity)productFeatureGroupAppl.getRelatedOne("ProductFeature"); productFeature.set("defaultSequenceNum", productFeatureGroupAppl.getLong("sequenceNum")); productFeatures.add(productFeature); } - context.put("productFeatureGroup", productFeatureGroup); - context.put("productFeatures", productFeatures); + context.productFeatureGroup = productFeatureGroup; + context.productFeatures = productFeatures; // this will not break out the product features by view size - context.put("listSize", productFeatures.size()); - context.put("highIndex", productFeatures.size()); -} + context.listSize = productFeatures.size(); + context.highIndex = productFeatures.size(); +} \ No newline at end of file Modified: ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=660738&r1=660737&r2=660738&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Tue May 27 15:00:09 2008 @@ -1461,8 +1461,8 @@ <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/product/ApplyFeaturesFromCategory.bsh"/> - <script location="component://product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.bsh"/> + <script location="component://product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromCategory.groovy"/> + <script location="component://product/webapp/catalog/WEB-INF/actions/product/ApplyFeaturesFromGroup.groovy"/> </actions> <widgets> <decorator-screen name="CommonProductDecorator" location="${parameters.mainDecoratorLocation}"> |
Free forum by Nabble | Edit this page |