svn commit: r1767764 [23/33] - in /ofbiz/trunk: applications/accounting/groovyScripts/admin/ applications/accounting/groovyScripts/ap/invoices/ applications/accounting/groovyScripts/ar/ applications/accounting/groovyScripts/chartofaccounts/ application...

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

svn commit: r1767764 [23/33] - in /ofbiz/trunk: applications/accounting/groovyScripts/admin/ applications/accounting/groovyScripts/ap/invoices/ applications/accounting/groovyScripts/ar/ applications/accounting/groovyScripts/chartofaccounts/ application...

Arun Patidar-4
Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy (original)
+++ ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityPerformanceTest.groovy Wed Nov  2 19:09:13 2016
@@ -17,233 +17,233 @@
  * under the License.
  */
 
-import java.text.DecimalFormat;
-import java.util.*;
-import org.apache.ofbiz.base.util.cache.UtilCache;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.security.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
+import java.text.DecimalFormat
+import java.util.*
+import org.apache.ofbiz.base.util.cache.UtilCache
+import org.apache.ofbiz.base.util.UtilValidate
+import org.apache.ofbiz.security.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
 
-DecimalFormat decimalFormat = new DecimalFormat("#,##0.#######");
+DecimalFormat decimalFormat = new DecimalFormat("#,##0.#######")
 
 if (security.hasPermission("ENTITY_MAINT", session)) {
-    performanceList = [];
+    performanceList = []
 
-    calls = 1000;
-    startTime = System.currentTimeMillis();
+    calls = 1000
+    startTime = System.currentTimeMillis()
     for (int i = 0; i < calls; i++) {
-        dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], false);
+        dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], false)
     }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime/1000);
-
-    perfRow = [:];
-    perfRow.operation = "findOne(false)";
-    perfRow.entity = "Large:JobSandbox";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    calls = 10000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], true);
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "findOne(true)";
-    perfRow.entity = "Large:JobSandbox";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    calls = 1000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], false);
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "findOne(false)";
-    perfRow.entity = "Small:DataSourceType";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime/1000)
+
+    perfRow = [:]
+    perfRow.operation = "findOne(false)"
+    perfRow.entity = "Large:JobSandbox"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    calls = 10000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], true)
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "findOne(true)"
+    perfRow.entity = "Large:JobSandbox"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    calls = 1000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], false)
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "findOne(false)"
+    perfRow.entity = "Small:DataSourceType"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
 
-    calls = 10000;
-    startTime = System.currentTimeMillis();
+    calls = 10000
+    startTime = System.currentTimeMillis()
     for (int i=0; i < calls; i++) {
-        dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], true);
+        dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], true)
     }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
 
-    perfRow = [:];
-    perfRow.operation = "findOne(true)";
-    perfRow.entity = "Small:DataSourceType";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    createTestList = [];
-    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]);
-        createTestList.add(dummy);
-        delegator.create(dummy);
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "create";
-    perfRow.entity = "Large:JobSandbox";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    calls = 1000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        dummy = createTestList.get(i);
-        dummy.jobName = "This was a test from the performance groovy script";
-        dummy.store();
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "update";
-    perfRow.entity = "Large:JobSandbox";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    calls = 1000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        dummy = createTestList.get(i);
-        dummy.remove();
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = (double) calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "remove";
-    perfRow.entity = "Large:JobSandbox";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    calls = 100000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        ptyMap = [:];
-        ptyMap.dataSourceTypeId = "ADMIN_ENTRY";
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "new HashMap";
-    perfRow.entity = "N/A";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    calls = 100000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        ptyMap = UtilMisc.toMap("dataSourceTypeId", "ADMIN_ENTRY");
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "UtilMisc.toMap";
-    perfRow.entity = "N/A";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    utilCache = new UtilCache("test-cache", 0, 0, 0, false, null, "test-cache");
-    utilCache.put("testName", "testValue");
-    calls = 1000000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        utilCache.get("testName");
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "UtilCache.get(String) - basic settings";
-    perfRow.entity = "N/A";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    testPk = delegator.makePK("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"]);
-    utilCache.put(testPk, "testValue");
-    calls = 1000000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        utilCache.get(testPk);
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime/1000);
-
-    perfRow = [:];
-    perfRow.operation = "UtilCache.get(GenericPK) - basic settings";
-    perfRow.entity = "N/A";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
-
-    calls = 1000000;
-    startTime = System.currentTimeMillis();
-    for (int i = 0; i < calls; i++) {
-        utilCache.put(testPk, "testValue");
-    }
-    totalTime = System.currentTimeMillis() - startTime;
-    callsPerSecond = calls / (totalTime / 1000);
-
-    perfRow = [:];
-    perfRow.operation = "UtilCache.put(GenericPK) - basic settings";
-    perfRow.entity = "N/A";
-    perfRow.calls = decimalFormat.format(calls);
-    perfRow.seconds = decimalFormat.format(totalTime / 1000);
-    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond);
-    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond);
-    performanceList.add(perfRow);
+    perfRow = [:]
+    perfRow.operation = "findOne(true)"
+    perfRow.entity = "Small:DataSourceType"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    createTestList = []
+    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])
+        createTestList.add(dummy)
+        delegator.create(dummy)
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "create"
+    perfRow.entity = "Large:JobSandbox"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    calls = 1000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        dummy = createTestList.get(i)
+        dummy.jobName = "This was a test from the performance groovy script"
+        dummy.store()
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "update"
+    perfRow.entity = "Large:JobSandbox"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    calls = 1000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        dummy = createTestList.get(i)
+        dummy.remove()
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = (double) calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "remove"
+    perfRow.entity = "Large:JobSandbox"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    calls = 100000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        ptyMap = [:]
+        ptyMap.dataSourceTypeId = "ADMIN_ENTRY"
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "new HashMap"
+    perfRow.entity = "N/A"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    calls = 100000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        ptyMap = UtilMisc.toMap("dataSourceTypeId", "ADMIN_ENTRY")
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "UtilMisc.toMap"
+    perfRow.entity = "N/A"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    utilCache = new UtilCache("test-cache", 0, 0, 0, false, null, "test-cache")
+    utilCache.put("testName", "testValue")
+    calls = 1000000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        utilCache.get("testName")
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "UtilCache.get(String) - basic settings"
+    perfRow.entity = "N/A"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    testPk = delegator.makePK("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"])
+    utilCache.put(testPk, "testValue")
+    calls = 1000000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        utilCache.get(testPk)
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime/1000)
+
+    perfRow = [:]
+    perfRow.operation = "UtilCache.get(GenericPK) - basic settings"
+    perfRow.entity = "N/A"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
+
+    calls = 1000000
+    startTime = System.currentTimeMillis()
+    for (int i = 0; i < calls; i++) {
+        utilCache.put(testPk, "testValue")
+    }
+    totalTime = System.currentTimeMillis() - startTime
+    callsPerSecond = calls / (totalTime / 1000)
+
+    perfRow = [:]
+    perfRow.operation = "UtilCache.put(GenericPK) - basic settings"
+    perfRow.entity = "N/A"
+    perfRow.calls = decimalFormat.format(calls)
+    perfRow.seconds = decimalFormat.format(totalTime / 1000)
+    perfRow.secsPerCall = decimalFormat.format(1 / callsPerSecond)
+    perfRow.callsPerSecond = decimalFormat.format(callsPerSecond)
+    performanceList.add(perfRow)
 
-    context.performanceList = performanceList;
+    context.performanceList = performanceList
 }

Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRef.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRef.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRef.groovy (original)
+++ ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRef.groovy Wed Nov  2 19:09:13 2016
@@ -16,18 +16,18 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-controlPath = parameters._CONTROL_PATH_;
-list = "$controlPath/view/entityref_list";
-main = "$controlPath/view/entityref_main";
-search = parameters.search;
-forstatic = parameters.forstatic;
+controlPath = parameters._CONTROL_PATH_
+list = "$controlPath/view/entityref_list"
+main = "$controlPath/view/entityref_main"
+search = parameters.search
+forstatic = parameters.forstatic
 
 if (search) {
-    list = "$list?search=$search";
-    main = "$main?search=$search";
+    list = "$list?search=$search"
+    main = "$main?search=$search"
 } else if (forstatic) {
-    list = "$list?forstatic=$forstatic";
-    main = "$main?forstatic=$forstatic";
+    list = "$list?forstatic=$forstatic"
+    main = "$main?forstatic=$forstatic"
 }
-context.encodeUrlList = response.encodeURL(list);
-context.encodeUrlMain = response.encodeURL(main);
+context.encodeUrlList = response.encodeURL(list)
+context.encodeUrlMain = response.encodeURL(main)

Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRefList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRefList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRefList.groovy (original)
+++ ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityRefList.groovy Wed Nov  2 19:09:13 2016
@@ -16,40 +16,40 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
 
-controlPath = parameters._CONTROL_PATH_;
-context.controlPath = controlPath;
+controlPath = parameters._CONTROL_PATH_
+context.controlPath = controlPath
 
 if (security.hasPermission("ENTITY_MAINT", session)) {
-    forstatic = "true".equals(parameters.forstatic);
-    context.forstatic = forstatic;
+    forstatic = "true".equals(parameters.forstatic)
+    context.forstatic = forstatic
 
-    reader = delegator.getModelReader();
-    ec = reader.getEntityNames();
-    entities = new TreeSet(ec);
-    search = parameters.search;
+    reader = delegator.getModelReader()
+    ec = reader.getEntityNames()
+    entities = new TreeSet(ec)
+    search = parameters.search
 
-    packageNames = new TreeSet();
+    packageNames = new TreeSet()
     ec.each { eName ->
-        ent = reader.getModelEntity(eName);
-        packageNames.add(ent.getPackageName());
+        ent = reader.getModelEntity(eName)
+        packageNames.add(ent.getPackageName())
     }
-    context.packageNames = packageNames;
+    context.packageNames = packageNames
 
-    entitiesList = [];
+    entitiesList = []
     entities.each { entityName ->
-        entityMap = [:];
+        entityMap = [:]
         if (!search || entityName.toLowerCase().indexOf(search.toLowerCase()) != -1 ) {
-            url = search ? "?search=$search" : "";
-            entityMap.url = url;
+            url = search ? "?search=$search" : ""
+            entityMap.url = url
         }
-        entityMap.entityName = entityName;
+        entityMap.entityName = entityName
 
-        entitiesList.add(entityMap);
+        entitiesList.add(entityMap)
     }
-    context.entitiesList = entitiesList;
+    context.entitiesList = entitiesList
 }

Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy (original)
+++ ofbiz/trunk/framework/webtools/groovyScripts/entity/EntitySQLProcessor.groovy Wed Nov  2 19:09:13 2016
@@ -17,63 +17,63 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.jdbc.SQLProcessor;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.model.ModelGroupReader;
+import org.apache.ofbiz.entity.jdbc.SQLProcessor
+import java.sql.ResultSet
+import java.sql.ResultSetMetaData
+import java.sql.SQLException
+import java.util.ArrayList
+import java.util.Iterator
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.model.ModelGroupReader
 
-sqlCommand = context.request.getParameter("sqlCommand");
+sqlCommand = context.request.getParameter("sqlCommand")
 
-resultMessage = "";
-rs = null;
-columns = [];
-records = [];
-mgr = delegator.getModelGroupReader();
-groups = [];
-for (String group : mgr.getGroupNames(delegator.getDelegatorName())) groups.add(0,["group":group]); //use for list-option in widget drop-down
+resultMessage = ""
+rs = null
+columns = []
+records = []
+mgr = delegator.getModelGroupReader()
+groups = []
+for (String group : mgr.getGroupNames(delegator.getDelegatorName())) groups.add(0,["group":group]) //use for list-option in widget drop-down
 
 if (sqlCommand && selGroup) {
-    du = new SQLProcessor(delegator, delegator.getGroupHelperInfo(selGroup));
+    du = new SQLProcessor(delegator, delegator.getGroupHelperInfo(selGroup))
     try {
         if (sqlCommand.toUpperCase().startsWith("SELECT")) {
-            rs = du.executeQuery(sqlCommand);
+            rs = du.executeQuery(sqlCommand)
             if (rs) {
-                rsmd = rs.getMetaData();
-                numberOfColumns = rsmd.getColumnCount();
+                rsmd = rs.getMetaData()
+                numberOfColumns = rsmd.getColumnCount()
                 for (i = 1; i <= numberOfColumns; i++) {
-                    columns.add(rsmd.getColumnName(i));
+                    columns.add(rsmd.getColumnName(i))
                 }
-                rowLimitReached = false;
+                rowLimitReached = false
                 while (rs.next()) {
                     if (records.size() >= rowLimit) {
-                        resultMessage = "Returned top $rowLimit rows.";
-                        rowLimitReached = true;
-                        break;
+                        resultMessage = "Returned top $rowLimit rows."
+                        rowLimitReached = true
+                        break
                     }
-                    record = [];
+                    record = []
                     for (i = 1; i <= numberOfColumns; i++) {
-                        record.add(rs.getObject(i));
+                        record.add(rs.getObject(i))
                     }
-                    records.add(record);
+                    records.add(record)
                 }
-                resultMessage = "Returned " + (rowLimitReached? "top " + rowLimit : "" + records.size()) + " rows.";
-                rs.close();
+                resultMessage = "Returned " + (rowLimitReached? "top " + rowLimit : "" + records.size()) + " rows."
+                rs.close()
             }
         } else {
-            du.prepareStatement(sqlCommand);
-            numOfAffectedRows = du.executeUpdate();
-            resultMessage = "Affected $numOfAffectedRows rows.";
+            du.prepareStatement(sqlCommand)
+            numOfAffectedRows = du.executeUpdate()
+            resultMessage = "Affected $numOfAffectedRows rows."
         }
     } catch (Exception exc) {
-        resultMessage = exc.getMessage();
+        resultMessage = exc.getMessage()
     }
 }
-context.groups = groups;
-context.resultMessage = resultMessage;
-context.columns = columns;
-context.records = records;
-context.sqlCommand = sqlCommand; // (see OFBIZ-6567)
+context.groups = groups
+context.resultMessage = resultMessage
+context.columns = columns
+context.records = records
+context.sqlCommand = sqlCommand // (see OFBIZ-6567)

Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy (original)
+++ ofbiz/trunk/framework/webtools/groovyScripts/entity/FindGeneric.groovy Wed Nov  2 19:09:13 2016
@@ -18,239 +18,239 @@
  */
 
 import org.apache.ofbiz.base.util.UtilMisc
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.GenericEntityException;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
-import org.apache.ofbiz.entity.model.ModelViewEntity;
-import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias;
-import org.apache.ofbiz.entity.model.ModelField;
-import org.apache.ofbiz.entity.model.ModelFieldType;
-import org.apache.ofbiz.entity.GenericEntity;
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.base.util.UtilProperties;
-import org.apache.ofbiz.entity.condition.EntityExpr;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.condition.EntityConditionList;
-import org.apache.ofbiz.entity.condition.EntityFieldMap;
-import org.apache.ofbiz.entity.condition.EntityOperator;
-import org.apache.ofbiz.entity.transaction.TransactionUtil;
-import org.apache.ofbiz.entity.util.EntityFindOptions;
-import org.apache.ofbiz.entity.util.EntityListIterator;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.base.util.Debug;
-import java.sql.Timestamp;
-import java.sql.Date;
-import java.sql.Time;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.GenericEntityException
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
+import org.apache.ofbiz.entity.model.ModelViewEntity
+import org.apache.ofbiz.entity.model.ModelViewEntity.ModelAlias
+import org.apache.ofbiz.entity.model.ModelField
+import org.apache.ofbiz.entity.model.ModelFieldType
+import org.apache.ofbiz.entity.GenericEntity
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.base.util.UtilProperties
+import org.apache.ofbiz.entity.condition.EntityExpr
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.condition.EntityConditionList
+import org.apache.ofbiz.entity.condition.EntityFieldMap
+import org.apache.ofbiz.entity.condition.EntityOperator
+import org.apache.ofbiz.entity.transaction.TransactionUtil
+import org.apache.ofbiz.entity.util.EntityFindOptions
+import org.apache.ofbiz.entity.util.EntityListIterator
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.base.util.Debug
+import java.sql.Timestamp
+import java.sql.Date
+import java.sql.Time
 
-entityName = parameters.entityName;
+entityName = parameters.entityName
 
-ModelReader reader = delegator.getModelReader();
-ModelEntity modelEntity = reader.getModelEntity(entityName);
+ModelReader reader = delegator.getModelReader()
+ModelEntity modelEntity = reader.getModelEntity(entityName)
 
-groupByFields = [];
-functionFields = [];
+groupByFields = []
+functionFields = []
 
 if (modelEntity instanceof ModelViewEntity) {
     aliases = modelEntity.getAliasesCopy()
     for (ModelAlias alias : aliases) {
         if (alias.getGroupBy()) {
-            groupByFields.add(alias.getName());
+            groupByFields.add(alias.getName())
         } else if (alias.getFunction()) {
-            functionFields.add(alias.getName());
+            functionFields.add(alias.getName())
         }
     }
 }
 
-context.entityName = modelEntity.getEntityName();
-context.plainTableName = modelEntity.getPlainTableName();
+context.entityName = modelEntity.getEntityName()
+context.plainTableName = modelEntity.getPlainTableName()
 
-String hasViewPermission = (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)) == true ? "Y" : "N";
-String hasCreatePermission = (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session)) == true ? "Y" : "N";
-String hasUpdatePermission = (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session)) == true ? "Y" : "N";
-String hasDeletePermission = (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session)) == true ? "Y" : "N";
-
-context.hasViewPermission = hasViewPermission;
-context.hasCreatePermission = hasCreatePermission;
-context.hasUpdatePermission = hasUpdatePermission;
-context.hasDeletePermission = hasDeletePermission;
+String hasViewPermission = (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_VIEW", session)) == true ? "Y" : "N"
+String hasCreatePermission = (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_CREATE", session)) == true ? "Y" : "N"
+String hasUpdatePermission = (security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_UPDATE", session)) == true ? "Y" : "N"
+String hasDeletePermission = (security.hasEntityPermission("ENTITY_DATA", "_DELETE", session) || security.hasEntityPermission(modelEntity.getPlainTableName(), "_DELETE", session)) == true ? "Y" : "N"
+
+context.hasViewPermission = hasViewPermission
+context.hasCreatePermission = hasCreatePermission
+context.hasUpdatePermission = hasUpdatePermission
+context.hasDeletePermission = hasDeletePermission
 
-String find = parameters.find;
+String find = parameters.find
 if (find == null) {
-    find = "false";
+    find = "false"
 }
 
-String curFindString = "entityName=" + entityName + "&find=" + find;
+String curFindString = "entityName=" + entityName + "&find=" + find
 
-GenericEntity findByEntity = delegator.makeValue(entityName);
-List errMsgList = [];
-Iterator fieldIterator = modelEntity.getFieldsIterator();
+GenericEntity findByEntity = delegator.makeValue(entityName)
+List errMsgList = []
+Iterator fieldIterator = modelEntity.getFieldsIterator()
 while (fieldIterator.hasNext()) {
-    ModelField field = fieldIterator.next();
-    String fval = parameters.get(field.getName());
+    ModelField field = fieldIterator.next()
+    String fval = parameters.get(field.getName())
     if (fval != null) {
         if (fval.length() > 0) {
-            curFindString = curFindString + "&" + field.getName() + "=" + fval;
+            curFindString = curFindString + "&" + field.getName() + "=" + fval
             try {
-                findByEntity.setString(field.getName(), fval);
+                findByEntity.setString(field.getName(), fval)
             } catch (NumberFormatException nfe) {
-                Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "FindGeneric.groovy");
-                errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName());
+                Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "FindGeneric.groovy")
+                errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName())
             }
         }
     }
 }
 if (errMsgList) {
-    request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList);
+    request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList)
 }
 
-curFindString = UtilFormatOut.encodeQuery(curFindString);
-context.curFindString = curFindString;
+curFindString = UtilFormatOut.encodeQuery(curFindString)
+context.curFindString = curFindString
 
 try {
-    viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue();
+    viewIndex = Integer.valueOf((String)parameters.get("VIEW_INDEX")).intValue()
 } catch (NumberFormatException nfe) {
-    viewIndex = 0;
+    viewIndex = 0
 }
 
-context.viewIndexFirst = 0;
-context.viewIndex = viewIndex;
-context.viewIndexPrevious = viewIndex-1;
-context.viewIndexNext = viewIndex+1;
+context.viewIndexFirst = 0
+context.viewIndex = viewIndex
+context.viewIndexPrevious = viewIndex-1
+context.viewIndexNext = viewIndex+1
 
 try {
-    viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue();
+    viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue()
 } catch (NumberFormatException nfe) {
-    viewSize = (EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 0)).intValue();
+    viewSize = (EntityUtilProperties.getPropertyAsInteger("widget", "widget.form.defaultViewSize", 0)).intValue()
 }
 
-context.viewSize = viewSize;
+context.viewSize = viewSize
 
-int lowIndex = viewIndex*viewSize+1;
-int highIndex = (viewIndex+1)*viewSize;
-context.lowIndex = lowIndex;
+int lowIndex = viewIndex*viewSize+1
+int highIndex = (viewIndex+1)*viewSize
+context.lowIndex = lowIndex
 
-int arraySize = 0;
-List resultPartialList = null;
+int arraySize = 0
+List resultPartialList = null
 
 if ("true".equals(find)) {
-    //EntityCondition condition = EntityCondition.makeCondition(findByEntity, EntityOperator.AND);
+    //EntityCondition condition = EntityCondition.makeCondition(findByEntity, EntityOperator.AND)
 
     // small variation to support LIKE if a wildcard (%) is found in a String
-    conditionList = [];
-    findByKeySet = findByEntity.keySet();
-    fbksIter = findByKeySet.iterator();
+    conditionList = []
+    findByKeySet = findByEntity.keySet()
+    fbksIter = findByKeySet.iterator()
     while (fbksIter.hasNext()) {
-        findByKey = fbksIter.next();
+        findByKey = fbksIter.next()
         if (findByEntity.getString(findByKey).indexOf("%") >= 0) {
-            conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.LIKE, findByEntity.getString(findByKey)));
+            conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.LIKE, findByEntity.getString(findByKey)))
         } else {
-            conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.EQUALS, findByEntity.get(findByKey)));
+            conditionList.add(EntityCondition.makeCondition(findByKey, EntityOperator.EQUALS, findByEntity.get(findByKey)))
         }
     }
-    condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND);
+    condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND)
 
     if ((highIndex - lowIndex + 1) > 0) {
-        boolean beganTransaction = false;
+        boolean beganTransaction = false
         try {
-            beganTransaction = TransactionUtil.begin();
+            beganTransaction = TransactionUtil.begin()
 
-            EntityFindOptions efo = new EntityFindOptions();
-            efo.setMaxRows(highIndex);
-            efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE);
-            EntityListIterator resultEli = null;
-            fieldsToSelect = null;
+            EntityFindOptions efo = new EntityFindOptions()
+            efo.setMaxRows(highIndex)
+            efo.setResultSetType(EntityFindOptions.TYPE_SCROLL_INSENSITIVE)
+            EntityListIterator resultEli = null
+            fieldsToSelect = null
 
             if (groupByFields || functionFields) {
-                fieldsToSelect = [] as Set;
+                fieldsToSelect = [] as Set
 
                 for (String groupByField : groupByFields) {
-                    fieldsToSelect.add(groupByField);
+                    fieldsToSelect.add(groupByField)
                 }
 
                 for (String functionField : functionFields) {
                     fieldsToSelect.add(functionField)
                 }
             }
-            Collection pkNames = [];
-            Iterator iter = modelEntity.getPksIterator();
+            Collection pkNames = []
+            Iterator iter = modelEntity.getPksIterator()
             while (iter != null && iter.hasNext()) {
-                ModelField curField = (ModelField) iter.next();
-                pkNames.add(curField.getName());
+                ModelField curField = (ModelField) iter.next()
+                pkNames.add(curField.getName())
             }
-            resultEli = delegator.find(entityName, condition, null, fieldsToSelect, pkNames, efo);
-            resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1);
+            resultEli = delegator.find(entityName, condition, null, fieldsToSelect, pkNames, efo)
+            resultPartialList = resultEli.getPartialList(lowIndex, highIndex - lowIndex + 1)
 
-            arraySize = resultEli.getResultsSizeAfterPartialList();
+            arraySize = resultEli.getResultsSizeAfterPartialList()
             if (arraySize < highIndex) {
-                highIndex = arraySize;
+                highIndex = arraySize
             }
 
-            resultEli.close();
+            resultEli.close()
         } catch (GenericEntityException e) {
-            Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.groovy");
+            Debug.logError(e, "Failure in operation, rolling back transaction", "FindGeneric.groovy")
             try {
                 // only rollback the transaction if we started one...
-                TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e);
+                TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e)
             } catch (GenericEntityException e2) {
-                Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.groovy");
+                Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "FindGeneric.groovy")
             }
             // after rolling back, rethrow the exception
-            throw e;
+            throw e
         } finally {
             // only commit the transaction if we started one... this will throw an exception if it fails
-            TransactionUtil.commit(beganTransaction);
+            TransactionUtil.commit(beganTransaction)
         }
     }
 }
-context.highIndex = highIndex;
-context.arraySize = arraySize;
-context.resultPartialList = resultPartialList;
+context.highIndex = highIndex
+context.arraySize = arraySize
+context.resultPartialList = resultPartialList
 
-viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize);
-context.viewIndexLast = viewIndexLast;
+viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize)
+context.viewIndexLast = viewIndexLast
 
-List fieldList = [];
-fieldIterator = modelEntity.getFieldsIterator();
+List fieldList = []
+fieldIterator = modelEntity.getFieldsIterator()
 while (fieldIterator.hasNext()) {
-    ModelField field = fieldIterator.next();
-    ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType());
+    ModelField field = fieldIterator.next()
+    ModelFieldType type = delegator.getEntityFieldType(modelEntity, field.getType())
 
-    Map fieldMap = [:];
-    fieldMap.put("name", field.getName());
-    fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N");
-    fieldMap.put("javaType", type.getJavaType());
-    fieldMap.put("sqlType", type.getSqlType());
-    fieldMap.put("param", (parameters.get(field.getName()) != null ? parameters.get(field.getName()) : ""));
+    Map fieldMap = [:]
+    fieldMap.put("name", field.getName())
+    fieldMap.put("isPk", (field.getIsPk() == true) ? "Y" : "N")
+    fieldMap.put("javaType", type.getJavaType())
+    fieldMap.put("sqlType", type.getSqlType())
+    fieldMap.put("param", (parameters.get(field.getName()) != null ? parameters.get(field.getName()) : ""))
 
-    fieldList.add(fieldMap);
+    fieldList.add(fieldMap)
 }
-context.fieldList = fieldList;
-context.columnCount = fieldList.size()+2;
+context.fieldList = fieldList
+context.columnCount = fieldList.size()+2
 
-List records = [];
+List records = []
 if (resultPartialList != null) {
-    Iterator resultPartialIter = resultPartialList.iterator();
+    Iterator resultPartialIter = resultPartialList.iterator()
     while (resultPartialIter.hasNext()) {
-        Map record = [:];
+        Map record = [:]
 
-        GenericValue value = (GenericValue)resultPartialIter.next();
-        String findString = "entityName=" + entityName;
-        Iterator pkIterator = modelEntity.getPksIterator();
+        GenericValue value = (GenericValue)resultPartialIter.next()
+        String findString = "entityName=" + entityName
+        Iterator pkIterator = modelEntity.getPksIterator()
         while (pkIterator.hasNext()) {
-            ModelField pkField = pkIterator.next();
-            ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType());
-            findString += "&" + pkField.getName() + "=" + value.get(pkField.getName());
+            ModelField pkField = pkIterator.next()
+            ModelFieldType type = delegator.getEntityFieldType(modelEntity, pkField.getType())
+            findString += "&" + pkField.getName() + "=" + value.get(pkField.getName())
         }
-        record.put("findString", findString);
+        record.put("findString", findString)
 
-        record.put("fields", value);
-        records.add(record);
+        record.put("fields", value)
+        records.add(record)
     }
 }
-context.records = records;
-context.lowCount = lowIndex;
-context.highCount = lowIndex + records.size() - 1;
-context.total = arraySize;
+context.records = records
+context.lowCount = lowIndex
+context.highCount = lowIndex + records.size() - 1
+context.total = arraySize

Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/ProgramExport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/ProgramExport.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/groovyScripts/entity/ProgramExport.groovy (original)
+++ ofbiz/trunk/framework/webtools/groovyScripts/entity/ProgramExport.groovy Wed Nov  2 19:09:13 2016
@@ -16,20 +16,20 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.entity.model.ModelEntity;
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.entity.model.ModelEntity
 import org.apache.ofbiz.base.util.*
-import org.w3c.dom.Document;
+import org.w3c.dom.Document
 
-import org.codehaus.groovy.control.customizers.ImportCustomizer;
-import org.codehaus.groovy.control.CompilerConfiguration;
-import org.codehaus.groovy.control.MultipleCompilationErrorsException;
-import org.codehaus.groovy.control.ErrorCollector;
-
-String groovyProgram = null;
-recordValues = [];
-errMsgList = [];
+import org.codehaus.groovy.control.customizers.ImportCustomizer
+import org.codehaus.groovy.control.CompilerConfiguration
+import org.codehaus.groovy.control.MultipleCompilationErrorsException
+import org.codehaus.groovy.control.ErrorCollector
+
+String groovyProgram = null
+recordValues = []
+errMsgList = []
 
 if (UtilValidate.isEmpty(parameters.groovyProgram)) {
     
@@ -37,61 +37,61 @@ if (UtilValidate.isEmpty(parameters.groo
 // Use the List variable recordValues to fill it with GenericValue maps.
 // full groovy syntaxt is available
 
-import org.apache.ofbiz.entity.util.EntityFindOptions;
+import org.apache.ofbiz.entity.util.EntityFindOptions
 
 // example:
 
 // find the first three record in the product entity (if any)
-EntityFindOptions findOptions = new EntityFindOptions();
-findOptions.setMaxRows(3);
+EntityFindOptions findOptions = new EntityFindOptions()
+findOptions.setMaxRows(3)
 
-List products = delegator.findList("Product", null, null, null, findOptions, false);
+List products = delegator.findList("Product", null, null, null, findOptions, false)
 if (products != null) {  
-    recordValues.addAll(products);
+    recordValues.addAll(products)
 }
 
 
 '''
-    parameters.groovyProgram = groovyProgram;
+    parameters.groovyProgram = groovyProgram
 } else {
-    groovyProgram = parameters.groovyProgram;
+    groovyProgram = parameters.groovyProgram
 }
 
 // Add imports for script.
 def importCustomizer = new ImportCustomizer()
-importCustomizer.addImport("org.apache.ofbiz.entity.GenericValue");
-importCustomizer.addImport("org.apache.ofbiz.entity.model.ModelEntity");
+importCustomizer.addImport("org.apache.ofbiz.entity.GenericValue")
+importCustomizer.addImport("org.apache.ofbiz.entity.model.ModelEntity")
 def configuration = new CompilerConfiguration()
 configuration.addCompilationCustomizers(importCustomizer)
 
-Binding binding = new Binding();
-binding.setVariable("delegator", delegator);
-binding.setVariable("recordValues", recordValues);
+Binding binding = new Binding()
+binding.setVariable("delegator", delegator)
+binding.setVariable("recordValues", recordValues)
 
-ClassLoader loader = Thread.currentThread().getContextClassLoader();
-def shell = new GroovyShell(loader, binding, configuration);
+ClassLoader loader = Thread.currentThread().getContextClassLoader()
+def shell = new GroovyShell(loader, binding, configuration)
 
 if (UtilValidate.isNotEmpty(groovyProgram)) {
     try {
-        shell.parse(groovyProgram);
+        shell.parse(groovyProgram)
         shell.evaluate(groovyProgram)
-        recordValues = shell.getVariable("recordValues");
-        xmlDoc = GenericValue.makeXmlDocument(recordValues);
-        context.put("xmlDoc", xmlDoc);
+        recordValues = shell.getVariable("recordValues")
+        xmlDoc = GenericValue.makeXmlDocument(recordValues)
+        context.put("xmlDoc", xmlDoc)
     } catch(MultipleCompilationErrorsException e) {
-        request.setAttribute("_ERROR_MESSAGE_", e);
-        return;
+        request.setAttribute("_ERROR_MESSAGE_", e)
+        return
     } catch(groovy.lang.MissingPropertyException e) {
-        request.setAttribute("_ERROR_MESSAGE_", e);
-        return;
+        request.setAttribute("_ERROR_MESSAGE_", e)
+        return
     } catch(IllegalArgumentException e) {
-        request.setAttribute("_ERROR_MESSAGE_", e);
-        return;
+        request.setAttribute("_ERROR_MESSAGE_", e)
+        return
     } catch(NullPointerException e) {
-        request.setAttribute("_ERROR_MESSAGE_", e);
-        return;
+        request.setAttribute("_ERROR_MESSAGE_", e)
+        return
     } catch(Exception e) {
-        request.setAttribute("_ERROR_MESSAGE_", e);
-        return;
+        request.setAttribute("_ERROR_MESSAGE_", e)
+        return
     }
 }

Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy (original)
+++ ofbiz/trunk/framework/webtools/groovyScripts/entity/ViewGeneric.groovy Wed Nov  2 19:09:13 2016
@@ -16,419 +16,419 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericPK;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.security.Security;
-import org.apache.ofbiz.entity.model.ModelReader;
-import org.apache.ofbiz.entity.model.ModelEntity;
-import org.apache.ofbiz.entity.model.ModelField;
-import org.apache.ofbiz.entity.model.ModelFieldType;
-import org.apache.ofbiz.entity.model.ModelRelation;
-import org.apache.ofbiz.entity.model.ModelKeyMap;
-import org.apache.ofbiz.base.util.UtilFormatOut;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.base.util.UtilValidate;
-import java.sql.Timestamp;
-import java.sql.Date;
-import java.sql.Time;
-
-String entityName = parameters.get("entityName");
-context.put("entityName", entityName);
-
-ModelReader reader = delegator.getModelReader();
-ModelEntity entity = reader.getModelEntity(entityName);
-
-context.put("entity", entity);
-context.put("plainTableName", entity.getPlainTableName());
-
-boolean hasAllView = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session);
-boolean hasAllCreate = security.hasEntityPermission("ENTITY_DATA", "_CREATE", session);
-boolean hasAllUpdate = security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session);
-boolean hasAllDelete = security.hasEntityPermission("ENTITY_DATA", "_DELETE", session);
-boolean hasViewPermission = hasAllView || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session);
-boolean hasCreatePermission = hasAllCreate || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session);
-boolean hasUpdatePermission = hasAllUpdate || security.hasEntityPermission(entity.getPlainTableName(), "_UPDATE", session);
-boolean hasDeletePermission = hasAllDelete || security.hasEntityPermission(entity.getPlainTableName(), "_DELETE", session);
-
-context.put("hasAllView", hasAllView);
-context.put("hasAllCreate", hasAllCreate);
-context.put("hasAllUpdate", hasAllUpdate);
-context.put("hasAllDelete", hasAllDelete);
-context.put("hasViewPermission", hasViewPermission);
-context.put("hasCreatePermission", hasCreatePermission);
-context.put("hasUpdatePermission", hasUpdatePermission);
-context.put("hasDeletePermission" , hasDeletePermission);
-
-boolean useValue = true;
-String curFindString = "entityName=" + entityName;
-GenericPK findByPK = delegator.makePK(entityName);
-Iterator pkIterator = entity.getPksIterator();
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericPK
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.security.Security
+import org.apache.ofbiz.entity.model.ModelReader
+import org.apache.ofbiz.entity.model.ModelEntity
+import org.apache.ofbiz.entity.model.ModelField
+import org.apache.ofbiz.entity.model.ModelFieldType
+import org.apache.ofbiz.entity.model.ModelRelation
+import org.apache.ofbiz.entity.model.ModelKeyMap
+import org.apache.ofbiz.base.util.UtilFormatOut
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.base.util.UtilValidate
+import java.sql.Timestamp
+import java.sql.Date
+import java.sql.Time
+
+String entityName = parameters.get("entityName")
+context.put("entityName", entityName)
+
+ModelReader reader = delegator.getModelReader()
+ModelEntity entity = reader.getModelEntity(entityName)
+
+context.put("entity", entity)
+context.put("plainTableName", entity.getPlainTableName())
+
+boolean hasAllView = security.hasEntityPermission("ENTITY_DATA", "_VIEW", session)
+boolean hasAllCreate = security.hasEntityPermission("ENTITY_DATA", "_CREATE", session)
+boolean hasAllUpdate = security.hasEntityPermission("ENTITY_DATA", "_UPDATE", session)
+boolean hasAllDelete = security.hasEntityPermission("ENTITY_DATA", "_DELETE", session)
+boolean hasViewPermission = hasAllView || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session)
+boolean hasCreatePermission = hasAllCreate || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session)
+boolean hasUpdatePermission = hasAllUpdate || security.hasEntityPermission(entity.getPlainTableName(), "_UPDATE", session)
+boolean hasDeletePermission = hasAllDelete || security.hasEntityPermission(entity.getPlainTableName(), "_DELETE", session)
+
+context.put("hasAllView", hasAllView)
+context.put("hasAllCreate", hasAllCreate)
+context.put("hasAllUpdate", hasAllUpdate)
+context.put("hasAllDelete", hasAllDelete)
+context.put("hasViewPermission", hasViewPermission)
+context.put("hasCreatePermission", hasCreatePermission)
+context.put("hasUpdatePermission", hasUpdatePermission)
+context.put("hasDeletePermission" , hasDeletePermission)
+
+boolean useValue = true
+String curFindString = "entityName=" + entityName
+GenericPK findByPK = delegator.makePK(entityName)
+Iterator pkIterator = entity.getPksIterator()
 while (pkIterator.hasNext()) {
-    ModelField field = pkIterator.next();
-    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
-    String fval = parameters.get(field.getName());
+    ModelField field = pkIterator.next()
+    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
+    String fval = parameters.get(field.getName())
     if (UtilValidate.isNotEmpty(fval)) {
-        curFindString = curFindString + "&" + field.getName() + "=" + fval;
-        findByPK.setString(field.getName(), fval);
+        curFindString = curFindString + "&" + field.getName() + "=" + fval
+        findByPK.setString(field.getName(), fval)
     }
 }
-context.put("findByPk", findByPK.toString());
+context.put("findByPk", findByPK.toString())
 
-curFindString = UtilFormatOut.encodeQuery(curFindString);
-context.put("curFindString", curFindString);
+curFindString = UtilFormatOut.encodeQuery(curFindString)
+context.put("curFindString", curFindString)
 
-GenericValue value = null;
+GenericValue value = null
 //only try to find it if this is a valid primary key...
 if (findByPK.isPrimaryKey()) {
-    value = delegator.findOne(findByPK.getEntityName(), findByPK, false);
+    value = delegator.findOne(findByPK.getEntityName(), findByPK, false)
 }
-context.put("value", value);
+context.put("value", value)
 
 if (value == null) {
-    useValue = false;
+    useValue = false
 }
 
 if (value != null) {
-    List fieldList = [];
-    Iterator fieldIterator = entity.getFieldsIterator();
+    List fieldList = []
+    Iterator fieldIterator = entity.getFieldsIterator()
     while (fieldIterator.hasNext()) {
-        Map mapField = [:];
+        Map mapField = [:]
 
-        ModelField field = fieldIterator.next();
-        ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+        ModelField field = fieldIterator.next()
+        ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
 
-        String fieldValue = "";
+        String fieldValue = ""
         if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
-            Timestamp dtVal = value.getTimestamp(field.getName());
-            fieldValue = (dtVal == null) ? "" : dtVal.toString();
+            Timestamp dtVal = value.getTimestamp(field.getName())
+            fieldValue = (dtVal == null) ? "" : dtVal.toString()
         } else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
-            Date dateVal = value.getDate(field.getName());
-            fieldValue = (dateVal == null) ? "" : dateVal.toString();
+            Date dateVal = value.getDate(field.getName())
+            fieldValue = (dateVal == null) ? "" : dateVal.toString()
         } else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
-            Time timeVal = value.getTime(field.getName());
-            fieldValue = (timeVal == null) ? "" : timeVal.toString();
+            Time timeVal = value.getTime(field.getName())
+            fieldValue = (timeVal == null) ? "" : timeVal.toString()
         } else if (type.getJavaType().indexOf("Integer") >= 0) {
-            fieldValue = UtilFormatOut.safeToString((Integer)value.get(field.getName()));
+            fieldValue = UtilFormatOut.safeToString((Integer)value.get(field.getName()))
         } else if (type.getJavaType().indexOf("Long") >= 0) {
-            fieldValue = UtilFormatOut.safeToString((Long)value.get(field.getName()));
+            fieldValue = UtilFormatOut.safeToString((Long)value.get(field.getName()))
         } else if (type.getJavaType().indexOf("Double") >= 0) {
-            fieldValue = UtilFormatOut.safeToString((Double)value.get(field.getName()));
+            fieldValue = UtilFormatOut.safeToString((Double)value.get(field.getName()))
         } else if (type.getJavaType().indexOf("Float") >= 0) {
-            fieldValue = UtilFormatOut.safeToString((Float)value.get(field.getName()));
+            fieldValue = UtilFormatOut.safeToString((Float)value.get(field.getName()))
         } else if (type.getJavaType().indexOf("BigDecimal") >= 0) {
-            fieldValue = UtilFormatOut.safeToString((BigDecimal)value.get(field.getName()));
+            fieldValue = UtilFormatOut.safeToString((BigDecimal)value.get(field.getName()))
         } else if (type.getJavaType().indexOf("String") >= 0) {
-            fieldValue = UtilFormatOut.checkNull((String)value.get(field.getName()));
+            fieldValue = UtilFormatOut.checkNull((String)value.get(field.getName()))
         }
-        mapField.put("name", field.getName());
-        mapField.put("value", fieldValue);
+        mapField.put("name", field.getName())
+        mapField.put("value", fieldValue)
 
-        fieldList.add(mapField);
+        fieldList.add(mapField)
     }
-    context.put("fields", fieldList);
+    context.put("fields", fieldList)
 }
 
-GenericValue valueSave = value;
-boolean pkNotFound = false;
+GenericValue valueSave = value
+boolean pkNotFound = false
 if (value == null && (findByPK.getAllFields().size() > 0)) {
-    pkNotFound = true;
+    pkNotFound = true
 }
-context.put("pkNotFound", pkNotFound);
+context.put("pkNotFound", pkNotFound)
 
-String lastUpdateMode = parameters.get("UPDATE_MODE");
+String lastUpdateMode = parameters.get("UPDATE_MODE")
 if ((session.getAttribute("_ERROR_MESSAGE_") != null || request.getAttribute("_ERROR_MESSAGE_") != null) &&
     lastUpdateMode != null && !lastUpdateMode.equals("DELETE")) {
     //if we are updating and there is an error, do not use the entity data for the fields, use parameters to get the old value
-    useValue = false;
+    useValue = false
 }
-context.put("useValue", useValue);
+context.put("useValue", useValue)
 
-List newFieldPkList = [];
-pkIterator = entity.getPksIterator();
+List newFieldPkList = []
+pkIterator = entity.getPksIterator()
 while (pkIterator.hasNext()) {
-    Map mapField = [:];
+    Map mapField = [:]
 
-    ModelField field = pkIterator.next();
-    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+    ModelField field = pkIterator.next()
+    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
 
-    String fieldValue = "";
-    String fieldType = "";
-    String stringLength = "";
+    String fieldValue = ""
+    String fieldType = ""
+    String stringLength = ""
     if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
-        String dateTimeString = null;
+        String dateTimeString = null
         if (findByPK != null && useValue) {
-            Timestamp dtVal = findByPK.getTimestamp(field.getName());
+            Timestamp dtVal = findByPK.getTimestamp(field.getName())
             if (dtVal != null) {
-              dateTimeString = dtVal.toString();
+              dateTimeString = dtVal.toString()
             }
         } else if (!useValue) {
-            dateTimeString = parameters.get(field.getName());
+            dateTimeString = parameters.get(field.getName())
         }
-        fieldValue = UtilFormatOut.checkNull(dateTimeString);
-        fieldType = "DateTime";
+        fieldValue = UtilFormatOut.checkNull(dateTimeString)
+        fieldType = "DateTime"
     } else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
-        String dateString = null;
+        String dateString = null
         if (findByPK != null && useValue) {
-            Date dateVal = findByPK.getDate(field.getName());
-            dateString = (dateVal == null) ? "" : dateVal.toString();
+            Date dateVal = findByPK.getDate(field.getName())
+            dateString = (dateVal == null) ? "" : dateVal.toString()
         } else if (!useValue) {
-            dateString = parameters.get(field.getName());
+            dateString = parameters.get(field.getName())
         }
-        fieldValue = UtilFormatOut.checkNull(dateString);
-        fieldType = "Date";
+        fieldValue = UtilFormatOut.checkNull(dateString)
+        fieldType = "Date"
     } else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
-        String timeString = null;
+        String timeString = null
         if (findByPK != null && useValue) {
-            Time timeVal = findByPK.getTime(field.getName());
-            timeString = (timeVal == null) ? "" : timeVal.toString();
+            Time timeVal = findByPK.getTime(field.getName())
+            timeString = (timeVal == null) ? "" : timeVal.toString()
         } else if (!useValue) {
-            timeString = parameters.get(field.getName());
+            timeString = parameters.get(field.getName())
         }
-        fieldValue = UtilFormatOut.checkNull(timeString);
-        fieldType = "Time";
+        fieldValue = UtilFormatOut.checkNull(timeString)
+        fieldType = "Time"
     } else if (type.getJavaType().indexOf("Integer") >= 0) {
-        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Integer)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
-        fieldType = "Integer";
+        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Integer)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+        fieldType = "Integer"
     } else if (type.getJavaType().indexOf("Long") >= 0) {
-        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Long)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
-        fieldType = "Long";
+        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Long)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+        fieldType = "Long"
     } else if (type.getJavaType().indexOf("Double") >= 0) {
-        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Double)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
-        fieldType = "Double";
+        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Double)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+        fieldType = "Double"
     } else if (type.getJavaType().indexOf("Float") >= 0) {
-        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Float)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
-        fieldType = "Float";
+        fieldValue = (findByPK != null && useValue) ? UtilFormatOut.safeToString((Float)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+        fieldType = "Float"
     } else if (type.getJavaType().indexOf("String") >= 0) {
         if (type.stringLength() <= 80) {
-            fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
-            fieldType = "StringOneRow";
+            fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+            fieldType = "StringOneRow"
         } else if (type.stringLength() <= 255) {
-            fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())));
-            fieldType = "String";
+            fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())) : (useValue ? "" : UtilFormatOut.checkNull(parameters.get(field.getName())))
+            fieldType = "String"
         } else {
-            fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(parameters.get(field.getName())));
-            fieldType = "Textarea";
+            fieldValue = (findByPK != null && useValue) ? UtilFormatOut.checkNull((String)findByPK.get(field.getName())):(useValue?"":UtilFormatOut.checkNull(parameters.get(field.getName())))
+            fieldType = "Textarea"
         }
-        stringLength = type.stringLength().toString();
+        stringLength = type.stringLength().toString()
     }
-    mapField.put("name", field.getName());
-    mapField.put("value", fieldValue);
-    mapField.put("fieldType", fieldType);
-    mapField.put("stringLength", stringLength);
+    mapField.put("name", field.getName())
+    mapField.put("value", fieldValue)
+    mapField.put("fieldType", fieldType)
+    mapField.put("stringLength", stringLength)
 
-    newFieldPkList.add(mapField);
+    newFieldPkList.add(mapField)
 }
-context.put("newFieldPkList", newFieldPkList);
+context.put("newFieldPkList", newFieldPkList)
 
-List newFieldNoPkList = [];
-Iterator noPkIterator = entity.getNopksIterator();
+List newFieldNoPkList = []
+Iterator noPkIterator = entity.getNopksIterator()
 while (noPkIterator.hasNext()) {
-    Map mapField = [:];
+    Map mapField = [:]
 
-    ModelField field = noPkIterator.next();
-    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+    ModelField field = noPkIterator.next()
+    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
 
-    String fieldValue = "";
-    String fieldType = "";
-    String stringLength = "";
+    String fieldValue = ""
+    String fieldType = ""
+    String stringLength = ""
     if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
-        String dateTimeString = null;
+        String dateTimeString = null
         if (value != null && useValue) {
-            Timestamp dtVal = value.getTimestamp(field.getName());
+            Timestamp dtVal = value.getTimestamp(field.getName())
             if (dtVal != null) {
-              dateTimeString = dtVal.toString();
+              dateTimeString = dtVal.toString()
             }
         } else if (!useValue) {
-            dateTimeString = parameters.get(field.getName());
+            dateTimeString = parameters.get(field.getName())
         }
-        fieldValue = UtilFormatOut.checkNull(dateTimeString);
-        fieldType = "DateTime";
+        fieldValue = UtilFormatOut.checkNull(dateTimeString)
+        fieldType = "DateTime"
     } else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
-        String dateString = null;
+        String dateString = null
         if (value != null && useValue) {
-            Date dateVal = value.getDate(field.getName());
-            dateString = (dateVal == null) ? "" : dateVal.toString();
+            Date dateVal = value.getDate(field.getName())
+            dateString = (dateVal == null) ? "" : dateVal.toString()
         } else if (!useValue) {
-            dateString = parameters.get(field.getName());
+            dateString = parameters.get(field.getName())
         }
-        fieldValue = UtilFormatOut.checkNull(dateString);
-        fieldType = "Date";
+        fieldValue = UtilFormatOut.checkNull(dateString)
+        fieldType = "Date"
     } else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
-        String timeString = null;
+        String timeString = null
         if (value != null && useValue) {
-            Time timeVal = value.getTime(field.getName());
-            timeString = (timeVal == null) ? "" : timeVal.toString();
+            Time timeVal = value.getTime(field.getName())
+            timeString = (timeVal == null) ? "" : timeVal.toString()
         } else if (!useValue) {
-            timeString = parameters.get(field.getName());
+            timeString = parameters.get(field.getName())
         }
-        fieldValue = UtilFormatOut.checkNull(timeString);
-        fieldType = "Time";
+        fieldValue = UtilFormatOut.checkNull(timeString)
+        fieldType = "Time"
     } else if (type.getJavaType().indexOf("Integer") >= 0) {
-        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Integer)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-        fieldType = "Integer";
+        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Integer)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+        fieldType = "Integer"
     } else if (type.getJavaType().indexOf("Long") >= 0) {
-        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Long)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-        fieldType = "Long";
+        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Long)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+        fieldType = "Long"
     } else if (type.getJavaType().indexOf("Double") >= 0) {
-        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Double)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-        fieldType = "Double";
+        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Double)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+        fieldType = "Double"
     } else if (type.getJavaType().indexOf("Float") >= 0) {
-        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Float)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-        fieldType = "Float";
+        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((Float)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+        fieldType = "Float"
     } else if (type.getJavaType().indexOf("BigDecimal") >= 0) {
-        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((BigDecimal)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-        fieldType = "BigDecimal";
+        fieldValue = (value != null && useValue) ? UtilFormatOut.safeToString((BigDecimal)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+        fieldType = "BigDecimal"
     } else if (type.getJavaType().indexOf("String") >= 0) {
         if (type.stringLength() <= 80) {
-            fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-            fieldType = "StringOneRow";
+            fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+            fieldType = "StringOneRow"
         } else if (type.stringLength() <= 255) {
-            fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-            fieldType = "String";
+            fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+            fieldType = "String"
         } else {
-            fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()));
-            fieldType = "Textarea";
+            fieldValue = (value != null && useValue) ? UtilFormatOut.checkNull((String)value.get(field.getName())):UtilFormatOut.checkNull(parameters.get(field.getName()))
+            fieldType = "Textarea"
         }
-        stringLength = type.stringLength().toString();
+        stringLength = type.stringLength().toString()
     }
-    mapField.put("name", field.getName());
-    mapField.put("value", fieldValue);
-    mapField.put("fieldType", fieldType);
-    mapField.put("stringLength", stringLength);
+    mapField.put("name", field.getName())
+    mapField.put("value", fieldValue)
+    mapField.put("fieldType", fieldType)
+    mapField.put("stringLength", stringLength)
 
-    newFieldNoPkList.add(mapField);
+    newFieldNoPkList.add(mapField)
 }
-context.put("newFieldNoPkList", newFieldNoPkList);
+context.put("newFieldNoPkList", newFieldNoPkList)
 
-List relationFieldList = [];
+List relationFieldList = []
 for (int relIndex = 0; relIndex < entity.getRelationsSize(); relIndex++) {
-    Map mapRelation = [:];
+    Map mapRelation = [:]
 
-    ModelRelation relation = entity.getRelation(relIndex);
-    ModelEntity relatedEntity = reader.getModelEntity(relation.getRelEntityName());
+    ModelRelation relation = entity.getRelation(relIndex)
+    ModelEntity relatedEntity = reader.getModelEntity(relation.getRelEntityName())
 
-    boolean relCreate = false;
+    boolean relCreate = false
     if (security.hasEntityPermission(relatedEntity.getPlainTableName(), "_CREATE", session)) {
-        relCreate = true;
+        relCreate = true
     }
 
-    mapRelation.put("type", relation.getType());
-    mapRelation.put("title", relation.getTitle());
-    mapRelation.put("relEntityName", relation.getRelEntityName());
-    mapRelation.put("sortName", relation.getTitle() + relation.getRelEntityName());
-    mapRelation.put("relatedTable", relatedEntity.getEntityName());
-    mapRelation.put("relCreate", relCreate);
+    mapRelation.put("type", relation.getType())
+    mapRelation.put("title", relation.getTitle())
+    mapRelation.put("relEntityName", relation.getRelEntityName())
+    mapRelation.put("sortName", relation.getTitle() + relation.getRelEntityName())
+    mapRelation.put("relatedTable", relatedEntity.getEntityName())
+    mapRelation.put("relCreate", relCreate)
 
     if ("one".equals(relation.getType()) || "one-nofk".equals(relation.getType())) {
         if (value != null) {
             if (hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)) {
-                Iterator tempIter = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName(), null, null, false));
-                GenericValue valueRelated = null;
+                Iterator tempIter = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName(), null, null, false))
+                GenericValue valueRelated = null
                 if (tempIter != null && tempIter.hasNext()) {
-                    valueRelated = (GenericValue) tempIter.next();
+                    valueRelated = (GenericValue) tempIter.next()
                 }
 
-                List relatedFieldsList = [];
-                Iterator relFieldIterator = relatedEntity.getFieldsIterator();
+                List relatedFieldsList = []
+                Iterator relFieldIterator = relatedEntity.getFieldsIterator()
                 while (relFieldIterator.hasNext()) {
-                    Map mapRelatedFields = [:];
-                    ModelField field = relFieldIterator.next();
-                    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType());
+                    Map mapRelatedFields = [:]
+                    ModelField field = relFieldIterator.next()
+                    ModelFieldType type = delegator.getEntityFieldType(entity, field.getType())
 
-                    String fieldValue = "";
-                    String fieldType = "";
+                    String fieldValue = ""
+                    String fieldType = ""
                     if (type.getJavaType().equals("Timestamp") || type.getJavaType().equals("java.sql.Timestamp")) {
-                        Timestamp dtVal = null;
+                        Timestamp dtVal = null
                         if (valueRelated != null) {
-                            dtVal = valueRelated.getTimestamp(field.getName());
+                            dtVal = valueRelated.getTimestamp(field.getName())
                         }
-                        fieldValue = (dtVal == null) ? "" : dtVal.toString();
-                        fieldType = "DateTime";
+                        fieldValue = (dtVal == null) ? "" : dtVal.toString()
+                        fieldType = "DateTime"
                     } else if (type.getJavaType().equals("Date") || type.getJavaType().equals("java.sql.Date")) {
-                        Date dateVal = null;
+                        Date dateVal = null
                         if (valueRelated != null) {
-                            dateVal = valueRelated.getDate(field.getName());
+                            dateVal = valueRelated.getDate(field.getName())
                         }
-                        fieldValue = (dateVal == null) ? "" : dateVal.toString();
-                        fieldType = "Date";
+                        fieldValue = (dateVal == null) ? "" : dateVal.toString()
+                        fieldType = "Date"
                     } else if (type.getJavaType().equals("Time") || type.getJavaType().equals("java.sql.Time")) {
-                        Time timeVal = null;
+                        Time timeVal = null
                         if (valueRelated != null) {
-                            timeVal = valueRelated.getTime(field.getName());
+                            timeVal = valueRelated.getTime(field.getName())
                         }
-                        fieldValue = (timeVal == null) ? "" : timeVal.toString();
-                        fieldType = "Time";
+                        fieldValue = (timeVal == null) ? "" : timeVal.toString()
+                        fieldType = "Time"
                     } else if (type.getJavaType().indexOf("Integer") >= 0) {
                         if (valueRelated != null) {
-                            fieldValue = UtilFormatOut.safeToString((Integer)valueRelated.get(field.getName()));
+                            fieldValue = UtilFormatOut.safeToString((Integer)valueRelated.get(field.getName()))
                         }
-                        fieldType = "Integer";
+                        fieldType = "Integer"
                     } else if (type.getJavaType().indexOf("Long") >= 0) {
                         if (valueRelated != null) {
-                            fieldValue = UtilFormatOut.safeToString((Long)valueRelated.get(field.getName()));
+                            fieldValue = UtilFormatOut.safeToString((Long)valueRelated.get(field.getName()))
                         }
-                        fieldType = "Long";
+                        fieldType = "Long"
                     } else if (type.getJavaType().indexOf("Double") >= 0) {
                         if (valueRelated != null) {
-                            fieldValue = UtilFormatOut.safeToString((Double)valueRelated.get(field.getName()));
+                            fieldValue = UtilFormatOut.safeToString((Double)valueRelated.get(field.getName()))
                         }
-                        fieldType = "Double";
+                        fieldType = "Double"
                     } else if (type.getJavaType().indexOf("Float") >= 0) {
                         if (valueRelated != null) {
-                            fieldValue = UtilFormatOut.safeToString((Float)valueRelated.get(field.getName()));
+                            fieldValue = UtilFormatOut.safeToString((Float)valueRelated.get(field.getName()))
                         }
-                        fieldType = "Float";
+                        fieldType = "Float"
                     } else if (type.getJavaType().indexOf("String") >= 0) {
                         if (valueRelated != null) {
-                            fieldValue = UtilFormatOut.checkNull((String)valueRelated.get(field.getName()));
+                            fieldValue = UtilFormatOut.checkNull((String)valueRelated.get(field.getName()))
                         }
-                        fieldType = "String";
+                        fieldType = "String"
                     }
 
-                    mapRelatedFields.put("name", field.getName());
-                    mapRelatedFields.put("type", fieldType);
-                    mapRelatedFields.put("value", fieldValue);
-                    relatedFieldsList.add(mapRelatedFields);
+                    mapRelatedFields.put("name", field.getName())
+                    mapRelatedFields.put("type", fieldType)
+                    mapRelatedFields.put("value", fieldValue)
+                    relatedFieldsList.add(mapRelatedFields)
                 }
 
-                mapRelation.put("valueRelated", valueRelated);
+                mapRelation.put("valueRelated", valueRelated)
                 if (valueRelated != null) {
-                    mapRelation.put("valueRelatedPk", valueRelated.getPrimaryKey().toString());
+                    mapRelation.put("valueRelatedPk", valueRelated.getPrimaryKey().toString())
                 }
-                mapRelation.put("relatedFieldsList", relatedFieldsList);
-                mapRelation.put("relType", "one");
+                mapRelation.put("relatedFieldsList", relatedFieldsList)
+                mapRelation.put("relType", "one")
 
-                String findString = "entityName=" + relatedEntity.getEntityName();
+                String findString = "entityName=" + relatedEntity.getEntityName()
                 for (ModelKeyMap keyMap : relation.getKeyMaps()) {
                     if (value.get(keyMap.getFieldName()) != null) {
-                        findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName());
+                        findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName())
                     }
                 }
-                String encodeFindString = UtilFormatOut.encodeQuery(findString);
-                mapRelation.put("encodeRelatedEntityFindString", encodeFindString);
+                String encodeFindString = UtilFormatOut.encodeQuery(findString)
+                mapRelation.put("encodeRelatedEntityFindString", encodeFindString)
 
-                relationFieldList.add(mapRelation);
+                relationFieldList.add(mapRelation)
             }
         }
     } else if (relation.getType().equalsIgnoreCase("many")) {
         if (value != null) {
             if (hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)) {
-                mapRelation.put("relType", "many");
+                mapRelation.put("relType", "many")
 
-                String findString = "entityName=" + relatedEntity.getEntityName();
+                String findString = "entityName=" + relatedEntity.getEntityName()
                 for (ModelKeyMap keyMap : relation.getKeyMaps()) {
                     if (value.get(keyMap.getFieldName()) != null) {
-                        findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName());
+                        findString += "&" + keyMap.getRelFieldName() + "=" + value.get(keyMap.getFieldName())
                     }
                 }
-                String encodeFindString = UtilFormatOut.encodeQuery(findString);
-                mapRelation.put("encodeRelatedEntityFindString", encodeFindString);
+                String encodeFindString = UtilFormatOut.encodeQuery(findString)
+                mapRelation.put("encodeRelatedEntityFindString", encodeFindString)
 
-                relationFieldList.add(mapRelation);
+                relationFieldList.add(mapRelation)
             }
         }
     }
 }
-context.put("relationFieldList", UtilMisc.sortMaps(relationFieldList, UtilMisc.toList("sortName")));
-context.put("relSize", relationFieldList.size() + 2);
+context.put("relationFieldList", UtilMisc.sortMaps(relationFieldList, UtilMisc.toList("sortName")))
+context.put("relSize", relationFieldList.size() + 2)