[ofbiz-framework] branch trunk updated: Improved: Use GroovyBaseScript's makeValue utility methods in each Groovy files (OFBIZ-11779)

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

[ofbiz-framework] branch trunk updated: Improved: Use GroovyBaseScript's makeValue utility methods in each Groovy files (OFBIZ-11779)

Pawan Verma-2
This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 5a144c0  Improved: Use GroovyBaseScript's makeValue utility methods in each Groovy files (OFBIZ-11779)
5a144c0 is described below

commit 5a144c0beddf9747176d7523bdde32a5f0a832d3
Author: Priya Sharma <[hidden email]>
AuthorDate: Sun Jun 28 01:24:32 2020 +0530

    Improved: Use GroovyBaseScript's makeValue utility methods in each Groovy files (OFBIZ-11779)
   
   
   
    Co-authored-by: Priya Sharma <[hidden email]>
---
 .../accounting/groovyScripts/payment/PaymentServices.groovy  | 12 ++++++------
 applications/content/groovyScripts/cms/CmsEditAddPrep.groovy |  4 ++--
 .../groovyScripts/content/GetContentLookupList.groovy        |  2 +-
 .../groovyScripts/catalog/price/EditProductPriceRules.groovy |  4 ++--
 .../groovyScripts/facility/facility/EditFacility.groovy      |  4 ++--
 .../groovyScripts/facility/facility/ViewContactMechs.groovy  |  4 ++--
 .../product/category/CategoryContentServices.groovy          |  4 ++--
 .../groovyScripts/entity/EntityPerformanceTest.groovy        |  2 +-
 framework/webtools/groovyScripts/entity/ViewGeneric.groovy   |  2 +-
 9 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/applications/accounting/groovyScripts/payment/PaymentServices.groovy b/applications/accounting/groovyScripts/payment/PaymentServices.groovy
index 4479bb8..6cee217 100644
--- a/applications/accounting/groovyScripts/payment/PaymentServices.groovy
+++ b/applications/accounting/groovyScripts/payment/PaymentServices.groovy
@@ -31,7 +31,7 @@ def createPayment() {
         return error(UtilProperties.getResourceBundleMap("AccountingUiLabels", locale)?.AccountingCreatePaymentPermissionError)
     }
 
-    GenericValue payment = delegator.makeValue("Payment")
+    GenericValue payment = makeValue("Payment")
     payment.paymentId = parameters.paymentId ?: delegator.getNextSeqId("Payment")
     paymentId = payment.paymentId
     parameters.statusId = parameters.statusId ?: "PMNT_NOT_PAID"
@@ -62,7 +62,7 @@ def createPayment() {
     return result
 }
 def updatePayment() {
-    Map lookupPayment = delegator.makeValue("Payment")
+    Map lookupPayment = makeValue("Payment")
     lookupPayment.setPKFields(parameters)
     GenericValue payment = from("Payment").where("paymentId", lookupPayment.paymentId).queryOne()
     if (!security.hasEntityPermission("ACCOUNTING", "_UPDATE", parameters.userLogin) &&
@@ -72,8 +72,8 @@ def updatePayment() {
     }
     if ("PMNT_NOT_PAID" != payment.statusId) {
         // check if only status change
-        GenericValue newPayment = delegator.makeValue("Payment")
-        GenericValue oldPayment = delegator.makeValue("Payment")
+        GenericValue newPayment = makeValue("Payment")
+        GenericValue oldPayment = makeValue("Payment")
         newPayment.setNonPKFields(payment)
         oldPayment.setNonPKFields(payment)
         newPayment.setNonPKFields(parameters)
@@ -203,7 +203,7 @@ def getPaymentRunningTotal(){
     return result
 }
 def createPaymentContent() {
-    GenericValue newEntity = delegator.makeValue("PaymentContent")
+    GenericValue newEntity = makeValue("PaymentContent")
     newEntity.setPKFields(parameters, true)
     newEntity.setNonPKFields(parameters, true)
 
@@ -225,7 +225,7 @@ def createPaymentContent() {
 //TODO: This can be converted into entity-auto with a seca rule for updateContent
 def updatePaymentContent() {
     serviceResult = success()
-    GenericValue lookupPKMap = delegator.makeValue("PaymentContent")
+    GenericValue lookupPKMap = makeValue("PaymentContent")
     lookupPKMap.setPKFields(parameters, true)
 
     GenericValue lookedUpValue = findOne("PaymentContent", lookupPKMap, false)
diff --git a/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy b/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy
index 030c10d..bba38c3 100644
--- a/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy
+++ b/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy
@@ -23,11 +23,11 @@ import org.apache.ofbiz.content.data.DataResourceWorker
 import org.apache.ofbiz.minilang.SimpleMapProcessor
 import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler
 
-contentAssocDataResourceViewFrom = delegator.makeValue("ContentAssocDataResourceViewFrom")
+contentAssocDataResourceViewFrom = makeValue("ContentAssocDataResourceViewFrom")
 
 contentId = context.contentId
 
-contentAssocPK = delegator.makeValue("ContentAssoc")
+contentAssocPK = makeValue("ContentAssoc")
 contentAssocPK.setAllFields(context, false, "ca", new Boolean(true))
 logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK)
 
diff --git a/applications/content/groovyScripts/content/GetContentLookupList.groovy b/applications/content/groovyScripts/content/GetContentLookupList.groovy
index 93ce19d..a02f72d 100644
--- a/applications/content/groovyScripts/content/GetContentLookupList.groovy
+++ b/applications/content/groovyScripts/content/GetContentLookupList.groovy
@@ -40,7 +40,7 @@ String curFindString=""
 
 ModelReader reader = delegator.getModelReader()
 ModelEntity modelEntity = reader.getModelEntity("ContentAssocViewTo")
-GenericEntity findByEntity = delegator.makeValue("ContentAssocViewTo")
+GenericEntity findByEntity = makeValue("ContentAssocViewTo")
 List errMsgList = new ArrayList()
 Iterator fieldIterator = modelEntity.getFieldsIterator()
 while (fieldIterator.hasNext()) {
diff --git a/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy b/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy
index 1c4c6ef..380d68f 100644
--- a/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy
+++ b/applications/product/groovyScripts/catalog/price/EditProductPriceRules.groovy
@@ -38,13 +38,13 @@ if (priceRuleId) {
     productPriceActions = productPriceRules[0].getRelated("ProductPriceAction", null, ["productPriceActionSeqId"], true)
     
     productPriceCondAdd = []
-    productPriceCondAdd.add(delegator.makeValue("ProductPriceCond"))
+    productPriceCondAdd.add(makeValue("ProductPriceCond"))
     productPriceCondAdd[0].productPriceRuleId = priceRuleId
     productPriceCondAdd[0].inputParamEnumId = context.inputParamEnums[0].enumId
     productPriceCondAdd[0].operatorEnumId = context.condOperEnums[0].enumId
     
     productPriceActionAdd = []
-    productPriceActionAdd.add(delegator.makeValue("ProductPriceAction"))
+    productPriceActionAdd.add(makeValue("ProductPriceAction"))
     productPriceActionAdd[0].productPriceRuleId = priceRuleId
     productPriceActionAdd[0].productPriceActionTypeId = context.productPriceActionTypes[0].productPriceActionTypeId
     productPriceActionAdd[0].amount = BigDecimal.ZERO
diff --git a/applications/product/groovyScripts/facility/facility/EditFacility.groovy b/applications/product/groovyScripts/facility/facility/EditFacility.groovy
index 5ca182b..dbcea11 100644
--- a/applications/product/groovyScripts/facility/facility/EditFacility.groovy
+++ b/applications/product/groovyScripts/facility/facility/EditFacility.groovy
@@ -25,8 +25,8 @@ if (!facilityId && request.getAttribute("facilityId")) {
 }
 facility = from("Facility").where("facilityId", facilityId).queryOne()
 if (!facility) {
-  facility = delegator.makeValue("Facility")
-  facilityType = delegator.makeValue("FacilityType")
+  facility = makeValue("Facility")
+  facilityType = makeValue("FacilityType")
 } else {
   facilityType = facility.getRelatedOne("FacilityType", false)
 }
diff --git a/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy b/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy
index 3692121..a101d48 100644
--- a/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy
+++ b/applications/product/groovyScripts/facility/facility/ViewContactMechs.groovy
@@ -26,8 +26,8 @@ facilityId = parameters.facilityId
 facility = from("Facility").where("facilityId", facilityId).queryOne()
 facilityType = null
 if (!facility) {
-  context.facility = delegator.makeValue("Facility", null)
-  context.facilityType = delegator.makeValue("FacilityType", null)
+  context.facility = makeValue("Facility", null)
+  context.facilityType = makeValue("FacilityType", null)
 } else {
   facilityType = facility.getRelatedOne("FacilityType", false)
 }
diff --git a/applications/product/groovyScripts/product/category/CategoryContentServices.groovy b/applications/product/groovyScripts/product/category/CategoryContentServices.groovy
index 705cdc5..bf59546 100644
--- a/applications/product/groovyScripts/product/category/CategoryContentServices.groovy
+++ b/applications/product/groovyScripts/product/category/CategoryContentServices.groovy
@@ -29,7 +29,7 @@ import org.apache.ofbiz.service.ModelService
  * Create Content For Product Category
  */
 def createCategoryContent() {
-    GenericValue newEntity = delegator.makeValue("ProductCategoryContent")
+    GenericValue newEntity = makeValue("ProductCategoryContent")
     newEntity.setPKFields(parameters, true)
     newEntity.setNonPKFields(parameters, true)
 
@@ -53,7 +53,7 @@ def createCategoryContent() {
  * Update Content For Category
  */
 def updateCategoryContent() {
-    GenericValue lookupPKMap = delegator.makeValue("ProductCategoryContent")
+    GenericValue lookupPKMap = makeValue("ProductCategoryContent")
     lookupPKMap.setPKFields(parameters, true)
     Map lookedUpValue = from("ProductCategoryContent").where(lookupPKMap).queryOne()
     lookedUpValue.setNonPKFields(parameters, true)
diff --git a/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy b/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
index 7b7d52a..6292b5b 100644
--- a/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
+++ b/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
@@ -102,7 +102,7 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
     calls = 1000
     startTime = System.currentTimeMillis()
     for (int i = 0; i < calls; i++) {
-        dummy = delegator.makeValue("JobSandbox", [poolId : "pool", jobName : "Initial Name" + i, serviceName : "foo", statusId : "SERVICE_FINISHED", jobId : "_~WRITE_TEST~_" + i])
+        dummy = makeValue("JobSandbox", [poolId : "pool", jobName : "Initial Name" + i, serviceName : "foo", statusId : "SERVICE_FINISHED", jobId : "_~WRITE_TEST~_" + i])
         createTestList.add(dummy)
         delegator.create(dummy)
     }
diff --git a/framework/webtools/groovyScripts/entity/ViewGeneric.groovy b/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
index 44de1d6..0649b33 100644
--- a/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
+++ b/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
@@ -64,7 +64,7 @@ if (parameters.pkValues) {
             delegator.getModelEntity(entityName), parameters.pkValues)
     parameters << pkNamesValuesMap
 }
-GenericValue valueFromParameters = delegator.makeValue(entityName)
+GenericValue valueFromParameters = makeValue(entityName)
 valueFromParameters.setPKFields(parameters)
 GenericPK findByPK = valueFromParameters.getPrimaryKey()
 context.currentFindString = UtilFormatOut.encodeQuery(EntityUtil.entityToPath(valueFromParameters))