Modified: ofbiz/trunk/framework/common/groovyScripts/FindAutocompleteOptions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/FindAutocompleteOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/FindAutocompleteOptions.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/FindAutocompleteOptions.groovy Wed Nov 2 19:09:13 2016 @@ -17,78 +17,78 @@ * under the License. */ -import org.apache.ofbiz.base.util.StringUtil; -import org.apache.ofbiz.base.util.UtilDateTime; -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.entity.util.EntityFindOptions; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityConditionList; -import org.apache.ofbiz.entity.condition.EntityExpr; -import org.apache.ofbiz.entity.condition.EntityFieldValue; -import org.apache.ofbiz.entity.condition.EntityFunction; -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.entity.util.EntityUtilProperties; - -def mainAndConds = []; -def orExprs = []; -def entityName = context.entityName; -def searchFields = context.searchFields; -def displayFields = context.displayFields ?: searchFields; -def searchDistinct = Boolean.valueOf(context.searchDistinct ?: false); +import org.apache.ofbiz.base.util.StringUtil +import org.apache.ofbiz.base.util.UtilDateTime +import org.apache.ofbiz.base.util.Debug +import org.apache.ofbiz.entity.util.EntityFindOptions +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityConditionList +import org.apache.ofbiz.entity.condition.EntityExpr +import org.apache.ofbiz.entity.condition.EntityFieldValue +import org.apache.ofbiz.entity.condition.EntityFunction +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.entity.util.EntityUtilProperties + +def mainAndConds = [] +def orExprs = [] +def entityName = context.entityName +def searchFields = context.searchFields +def displayFields = context.displayFields ?: searchFields +def searchDistinct = Boolean.valueOf(context.searchDistinct ?: false) -def searchValueFieldName = parameters.term; -def fieldValue = null; +def searchValueFieldName = parameters.term +def fieldValue = null if (searchValueFieldName) { - fieldValue = searchValueFieldName; + fieldValue = searchValueFieldName } else if (parameters.searchValueFieldName) { // This is to find the description of a lookup value on initialization. - fieldValue = parameters.get(parameters.searchValueFieldName); - context.description = "true"; + fieldValue = parameters.get(parameters.searchValueFieldName) + context.description = "true" } -def searchType = context.searchType; -def displayFieldsSet = null; +def searchType = context.searchType +def displayFieldsSet = null -def conditionDates = context.conditionDates; -def fromDateName = null; -def thruDateName = null; -def filterByDateValue = null; +def conditionDates = context.conditionDates +def fromDateName = null +def thruDateName = null +def filterByDateValue = null //If conditionDates is present on context, resolve values use add condition date to the condition search if (conditionDates) { - filterByDateValue = conditionDates.filterByDateValue ?: UtilDateTime.nowTimestamp(); - fromDateName = conditionDates.fromDateName ?: null; - thruDateName = conditionDates.thruDateName ?: null; + filterByDateValue = conditionDates.filterByDateValue ?: UtilDateTime.nowTimestamp() + fromDateName = conditionDates.fromDateName ?: null + thruDateName = conditionDates.thruDateName ?: null //if the field filterByDate is present, init default value for fromDate and thruDate if (!fromDateName && !thruDateName) { - fromDateName = "fromDate"; - thruDateName = "thruDate"; + fromDateName = "fromDate" + thruDateName = "thruDate" } } if (searchFields && fieldValue) { - def searchFieldsList = StringUtil.toList(searchFields); - displayFieldsSet = StringUtil.toSet(displayFields); + def searchFieldsList = StringUtil.toList(searchFields) + displayFieldsSet = StringUtil.toSet(displayFields) if (context.description && fieldValue instanceof java.lang.String) { - returnField = parameters.searchValueFieldName; + returnField = parameters.searchValueFieldName } else { - returnField = searchFieldsList[0]; //default to first element of searchFields - displayFieldsSet.add(returnField); //add it to select fields, in case it is missing + returnField = searchFieldsList[0] //default to first element of searchFields + displayFieldsSet.add(returnField) //add it to select fields, in case it is missing } - context.returnField = returnField; - context.displayFieldsSet = displayFieldsSet; + context.returnField = returnField + context.displayFieldsSet = displayFieldsSet if ("STARTS_WITH".equals(searchType)) { - searchValue = fieldValue.toUpperCase() + "%"; + searchValue = fieldValue.toUpperCase() + "%" } else if ("EQUALS".equals(searchType)) { - searchValue = fieldValue; + searchValue = fieldValue } else {//default is CONTAINS - searchValue = "%" + fieldValue.toUpperCase() + "%"; + searchValue = "%" + fieldValue.toUpperCase() + "%" } searchFieldsList.each { fieldName -> if ("EQUALS".equals(searchType)) { - orExprs.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(searchFieldsList[0]), EntityOperator.EQUALS, searchValue)); - return;//in case of EQUALS, we search only a match for the returned field + orExprs.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(searchFieldsList[0]), EntityOperator.EQUALS, searchValue)) + return //in case of EQUALS, we search only a match for the returned field } else { - orExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)), EntityOperator.LIKE, searchValue)); + orExprs.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue(fieldName)), EntityOperator.LIKE, searchValue)) } } } @@ -97,61 +97,61 @@ if (searchFields && fieldValue) { * but that is not supported by the Jquery Autocompleter, but this is still useful to pass parameters from the * lookup screen definition: */ -def conditionFields = context.conditionFields; +def conditionFields = context.conditionFields if (conditionFields) { // these fields are for additonal conditions, this is a Map of name/value pairs for (conditionFieldEntry in conditionFields.entrySet()) { if (conditionFieldEntry.getValue() instanceof java.util.List) { - def orCondFields = []; + def orCondFields = [] for (entry in conditionFieldEntry.getValue()) { - orCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, entry)); + orCondFields.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, entry)) } - mainAndConds.add(EntityCondition.makeCondition(orCondFields, EntityOperator.OR)); + mainAndConds.add(EntityCondition.makeCondition(orCondFields, EntityOperator.OR)) } else { - mainAndConds.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, conditionFieldEntry.getValue())); + mainAndConds.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(conditionFieldEntry.getKey()), EntityOperator.EQUALS, conditionFieldEntry.getValue())) } } } if (orExprs && entityName && displayFieldsSet) { - mainAndConds.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)); + mainAndConds.add(EntityCondition.makeCondition(orExprs, EntityOperator.OR)) //if there is an extra condition, add it to main condition list if (context.andCondition && context.andCondition instanceof EntityCondition) { - mainAndConds.add(context.andCondition); + mainAndConds.add(context.andCondition) } if (conditionDates) { - def condsDateList = []; + def condsDateList = [] if (thruDateName) { - def condsByThruDate = []; - condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.GREATER_THAN, filterByDateValue)); - condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.EQUALS, null)); - condsDateList.add(EntityCondition.makeCondition(condsByThruDate, EntityOperator.OR)); + def condsByThruDate = [] + condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.GREATER_THAN, filterByDateValue)) + condsByThruDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(thruDateName), EntityOperator.EQUALS, null)) + condsDateList.add(EntityCondition.makeCondition(condsByThruDate, EntityOperator.OR)) } if (fromDateName) { - def condsByFromDate = []; - condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.LESS_THAN_EQUAL_TO, filterByDateValue)); - condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.EQUALS, null)); - condsDateList.add(EntityCondition.makeCondition(condsByFromDate, EntityOperator.OR)); + def condsByFromDate = [] + condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.LESS_THAN_EQUAL_TO, filterByDateValue)) + condsByFromDate.add(EntityCondition.makeCondition(EntityFieldValue.makeFieldValue(fromDateName), EntityOperator.EQUALS, null)) + condsDateList.add(EntityCondition.makeCondition(condsByFromDate, EntityOperator.OR)) } - mainAndConds.add(EntityCondition.makeCondition(condsDateList, EntityOperator.AND)); + mainAndConds.add(EntityCondition.makeCondition(condsDateList, EntityOperator.AND)) } - def entityConditionList = EntityCondition.makeCondition(mainAndConds, EntityOperator.AND); + def entityConditionList = EntityCondition.makeCondition(mainAndConds, EntityOperator.AND) - String viewSizeStr = context.autocompleterViewSize; + String viewSizeStr = context.autocompleterViewSize if (viewSizeStr == null) { - viewSizeStr = EntityUtilProperties.getPropertyValue("widget", "widget.autocompleter.defaultViewSize", delegator); + viewSizeStr = EntityUtilProperties.getPropertyValue("widget", "widget.autocompleter.defaultViewSize", delegator) } - Integer autocompleterViewSize = Integer.valueOf(viewSizeStr ?: 10); - EntityFindOptions findOptions = new EntityFindOptions(); - findOptions.setMaxRows(autocompleterViewSize); - findOptions.setDistinct(searchDistinct); + Integer autocompleterViewSize = Integer.valueOf(viewSizeStr ?: 10) + EntityFindOptions findOptions = new EntityFindOptions() + findOptions.setMaxRows(autocompleterViewSize) + findOptions.setDistinct(searchDistinct) - autocompleteOptions = delegator.findList(entityName, entityConditionList, displayFieldsSet, StringUtil.toList(displayFields), findOptions, false); + autocompleteOptions = delegator.findList(entityName, entityConditionList, displayFieldsSet, StringUtil.toList(displayFields), findOptions, false) if (autocompleteOptions) { - context.autocompleteOptions = autocompleteOptions; + context.autocompleteOptions = autocompleteOptions } } Modified: ofbiz/trunk/framework/common/groovyScripts/GeoLocation.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/GeoLocation.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/GeoLocation.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/GeoLocation.groovy Wed Nov 2 19:09:13 2016 @@ -18,6 +18,6 @@ */ if (geoPoint && geoPoint.elevationUomId) { - elevationUom = delegator.findOne("Uom", [uomId : geoPoint.elevationUomId], false); - context.elevationUomAbbr = elevationUom.abbreviation; + elevationUom = delegator.findOne("Uom", [uomId : geoPoint.elevationUomId], false) + context.elevationUomAbbr = elevationUom.abbreviation } Modified: ofbiz/trunk/framework/common/groovyScripts/GetLocaleList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/GetLocaleList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/GetLocaleList.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/GetLocaleList.groovy Wed Nov 2 19:09:13 2016 @@ -17,35 +17,35 @@ * under the License. */ -import java.util.List; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.base.util.string.*; -import org.apache.ofbiz.base.util.UtilMisc; +import java.util.List +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.base.util.string.* +import org.apache.ofbiz.base.util.UtilMisc -locales = [] as LinkedList; +locales = [] as LinkedList availableLocales = UtilMisc.availableLocales() -// Debug.logInfo(parameters.localeString + "==" + parameters.localeName); +// Debug.logInfo(parameters.localeString + "==" + parameters.localeName) if (availableLocales) { availableLocales.each { availableLocale -> - locale = [:]; - locale.localeName = availableLocale.getDisplayName(availableLocale); - locale.localeString = availableLocale.toString(); + locale = [:] + locale.localeName = availableLocale.getDisplayName(availableLocale) + locale.localeString = availableLocale.toString() if (UtilValidate.isNotEmpty(parameters.localeString)) { if (locale.localeString.toUpperCase().contains(parameters.localeString.toUpperCase())) { - locales.add(locale); + locales.add(locale) } } if (UtilValidate.isNotEmpty(parameters.localeName)) { if (locale.localeName.toUpperCase().contains(parameters.localeName.toUpperCase())) { - locales.add(locale); + locales.add(locale) } } if (UtilValidate.isEmpty(parameters.localeString) && UtilValidate.isEmpty(parameters.localeName)) { - locales.add(locale); + locales.add(locale) } } } -context.locales = locales; +context.locales = locales Modified: ofbiz/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/GetParentPortalPageId.groovy Wed Nov 2 19:09:13 2016 @@ -17,10 +17,10 @@ * under the License. */ -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.EntityUtil // executes only on startup when only the basic parameters.portalPageId (from commonscreens.xml) is available if (userLogin && parameters.parentPortalPageId && !parameters.portalPageId) { @@ -30,43 +30,43 @@ if (userLogin && parameters.parentPortal EntityCondition.makeCondition("portalPageId", EntityOperator.LIKE, parameters.parentPortalPageId + "%"), EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("userLoginId", EntityOperator.EQUALS, userLogin.userLoginId) - ],EntityOperator.AND); - portalMainPages = EntityUtil.filterByDate(delegator.findList("PortalPageAndUserLogin", condSec, null, null, null, false)); + ],EntityOperator.AND) + portalMainPages = EntityUtil.filterByDate(delegator.findList("PortalPageAndUserLogin", condSec, null, null, null, false)) if (!portalMainPages) { // look for a null securityGroup if not found condSec = EntityCondition.makeCondition([ EntityCondition.makeCondition("securityGroupId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("portalPageId", EntityOperator.LIKE, parameters.parentPortalPageId + "%") - ],EntityOperator.AND); - portalMainPages = delegator.findList("PortalPage", condSec, null, null, null, false); + ],EntityOperator.AND) + portalMainPages = delegator.findList("PortalPage", condSec, null, null, null, false) } if (portalMainPages) { - portalPageId = portalMainPages.get(0).portalPageId; + portalPageId = portalMainPages.get(0).portalPageId // check if overridden with a privat page - privatMainPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPageId, ownerUserLoginId : userLogin.userLoginId], null, false); + privatMainPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPageId, ownerUserLoginId : userLogin.userLoginId], null, false) if (privatMainPages) { - context.parameters.portalPageId = privatMainPages.get(0).portalPageId; + context.parameters.portalPageId = privatMainPages.get(0).portalPageId } else { - context.parameters.portalPageId = portalPageId; + context.parameters.portalPageId = portalPageId } } } -// Debug.log('======portalPageId: ' + parameters.portalPageId); +// Debug.log('======portalPageId: ' + parameters.portalPageId) if (userLogin && parameters.portalPageId) { - portalPage = delegator.findOne("PortalPage", [portalPageId : parameters.portalPageId], false); + portalPage = delegator.findOne("PortalPage", [portalPageId : parameters.portalPageId], false) if (portalPage) { if (portalPage.parentPortalPageId) { - context.parameters.parentPortalPageId = portalPage.parentPortalPageId; + context.parameters.parentPortalPageId = portalPage.parentPortalPageId } else { if ("_NA_".equals(portalPage.ownerUserLoginId)) { - context.parameters.parentPortalPageId = portalPage.portalPageId; + context.parameters.parentPortalPageId = portalPage.portalPageId } else { - context.parameters.parentPortalPageId = portalPage.originalPortalPageId; + context.parameters.parentPortalPageId = portalPage.originalPortalPageId } } } } -// Debug.log('======parent portalPageId: ' + parameters.parentPortalPageId); +// Debug.log('======parent portalPageId: ' + parameters.parentPortalPageId) if (!context.headerItem && parameters.portalPageId) { - context.headerItem = parameters.portalPageId; // and the menu item is highlighted + context.headerItem = parameters.portalPageId // and the menu item is highlighted } Modified: ofbiz/trunk/framework/common/groovyScripts/ListPortalPortlets.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/ListPortalPortlets.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/ListPortalPortlets.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/ListPortalPortlets.groovy Wed Nov 2 19:09:13 2016 @@ -17,33 +17,33 @@ * under the License. */ -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.*; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.* -ppCond = EntityCondition.makeCondition("portletCategoryId", EntityOperator.EQUALS, parameters.portletCategoryId); -categories = delegator.findList("PortletPortletCategory", ppCond, null, null, null, false); +ppCond = EntityCondition.makeCondition("portletCategoryId", EntityOperator.EQUALS, parameters.portletCategoryId) +categories = delegator.findList("PortletPortletCategory", ppCond, null, null, null, false) -portalPortlets = []; +portalPortlets = [] categories.each { category -> - pCond = EntityCondition.makeCondition("portalPortletId", EntityOperator.EQUALS, category.get("portalPortletId")); - listPortalPortlets = delegator.findList("PortalPortlet", pCond, null, null, null, false); + pCond = EntityCondition.makeCondition("portalPortletId", EntityOperator.EQUALS, category.get("portalPortletId")) + listPortalPortlets = delegator.findList("PortalPortlet", pCond, null, null, null, false) - inMap = [:]; + inMap = [:] listPortalPortlets.each { listPortalPortlet -> if (listPortalPortlet.securityServiceName && listPortalPortlet.securityMainAction) { - inMap.mainAction = listPortalPortlet.securityMainAction; - inMap.userLogin = context.userLogin; + inMap.mainAction = listPortalPortlet.securityMainAction + inMap.userLogin = context.userLogin result = runService(listPortalPortlet.securityServiceName, inMap) - hasPermission = result.hasPermission; + hasPermission = result.hasPermission } else { - hasPermission = true; + hasPermission = true } if (hasPermission) { - portalPortlets.add(listPortalPortlet); + portalPortlets.add(listPortalPortlet) } } } -context.portletCat = delegator.findList("PortletCategory", null, null, null, null, false); -context.portalPortlets = portalPortlets; \ No newline at end of file +context.portletCat = delegator.findList("PortletCategory", null, null, null, null, false) +context.portalPortlets = portalPortlets \ No newline at end of file Modified: ofbiz/trunk/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy (original) +++ ofbiz/trunk/framework/common/groovyScripts/PrepareDataForFlotGraph.groovy Wed Nov 2 19:09:13 2016 @@ -17,40 +17,40 @@ * under the License. */ -import org.apache.ofbiz.base.util.StringUtil; -chartData = context.chartData; -chartType = context.chartType; -labelFieldName = context.labelFieldName; -dataFieldName = context.dataFieldName; +import org.apache.ofbiz.base.util.StringUtil +chartData = context.chartData +chartType = context.chartType +labelFieldName = context.labelFieldName +dataFieldName = context.dataFieldName if("Pie" == chartType){ - iter = chartData.iterator(); - first = true; - dataText = ""; + iter = chartData.iterator() + first = true + dataText = "" while(iter.hasNext()){ - entry = iter.next(); + entry = iter.next() if(!first){ - dataText = dataText + ","; + dataText = dataText + "," } - first = false; - dataText = dataText + entry.get(labelFieldName) + "," + entry.get(dataFieldName); + first = false + dataText = dataText + entry.get(labelFieldName) + "," + entry.get(dataFieldName) } - context.dataText = dataText; + context.dataText = dataText } else if("Bars" == chartType){ - iter = chartData.iterator(); - i = 1; - dataText = ""; - labels = ""; + iter = chartData.iterator() + i = 1 + dataText = "" + labels = "" while(iter.hasNext()){ - entry = iter.next(); + entry = iter.next() if(i!=1){ - dataText = dataText + ","; - labels = labels + ","; + dataText = dataText + "," + labels = labels + "," } - dataText = dataText + i + "," + entry.get(dataFieldName); - labels = labels + entry.get(labelFieldName); - i++; + dataText = dataText + i + "," + entry.get(dataFieldName) + labels = labels + entry.get(labelFieldName) + i++ } - context.dataText = dataText; - context.labelsText = labels; + context.dataText = dataText + context.labelsText = labels } \ No newline at end of file Modified: ofbiz/trunk/framework/common/minilang/GroovyServiceTest.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/minilang/GroovyServiceTest.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/common/minilang/GroovyServiceTest.groovy (original) +++ ofbiz/trunk/framework/common/minilang/GroovyServiceTest.groovy Wed Nov 2 19:09:13 2016 @@ -17,53 +17,53 @@ * under the License. */ -import org.apache.ofbiz.service.ServiceUtil; -import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.service.ServiceUtil +import org.apache.ofbiz.base.util.Debug -Debug.logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-", ""); -result = ServiceUtil.returnSuccess(); +Debug.logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-", "") +result = ServiceUtil.returnSuccess() if (context.message) { - String message = context.message; - result.successMessage = (String) "Got message [$message] and finished fine"; - result.result = message; - Debug.logInfo("----- Message is: $message -----", ""); + String message = context.message + result.successMessage = (String) "Got message [$message] and finished fine" + result.result = message + Debug.logInfo("----- Message is: $message -----", "") } else { - result.successMessage = (String) "Got no message but finished fine anyway"; - result.result = (String) "[no message received]"; - Debug.logInfo("----- No message received -----", ""); + result.successMessage = (String) "Got no message but finished fine anyway" + result.result = (String) "[no message received]" + Debug.logInfo("----- No message received -----", "") } -return result; +return result // GroovyEngine will invoke the no-arg method. public Map testMethod() { - Debug.logInfo("----- no-arg testMethod invoked -----", ""); - result = ServiceUtil.returnSuccess(); + Debug.logInfo("----- no-arg testMethod invoked -----", "") + result = ServiceUtil.returnSuccess() if (context.message) { - String message = context.message; - result.successMessage = (String) "Got message [$message] and finished fine"; - result.result = message; - Debug.logInfo("----- Message is: $message -----", ""); + String message = context.message + result.successMessage = (String) "Got message [$message] and finished fine" + result.result = message + Debug.logInfo("----- Message is: $message -----", "") } else { - result.successMessage = (String) "Got no message but finished fine anyway"; - result.result = (String) "[no message received]"; - Debug.logInfo("----- No message received -----", ""); + result.successMessage = (String) "Got no message but finished fine anyway" + result.result = (String) "[no message received]" + Debug.logInfo("----- No message received -----", "") } - return result; + return result } // ScriptEngine (JSR-223) will invoke the arg method. public Map testMethod(Map context) { - Debug.logInfo("----- arg testMethod invoked -----", ""); - result = ServiceUtil.returnSuccess(); + Debug.logInfo("----- arg testMethod invoked -----", "") + result = ServiceUtil.returnSuccess() if (context.message) { - String message = context.message; - result.successMessage = (String) "Got message [$message] and finished fine"; - result.result = message; - Debug.logInfo("----- Message is: $message -----", ""); + String message = context.message + result.successMessage = (String) "Got message [$message] and finished fine" + result.result = message + Debug.logInfo("----- Message is: $message -----", "") } else { - result.successMessage = (String) "Got no message but finished fine anyway"; - result.result = (String) "[no message received]"; - Debug.logInfo("----- No message received -----", ""); + result.successMessage = (String) "Got no message but finished fine anyway" + result.result = (String) "[no message received]" + Debug.logInfo("----- No message received -----", "") } - return result; + return result } Modified: ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy (original) +++ ofbiz/trunk/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy Wed Nov 2 19:09:13 2016 @@ -24,43 +24,43 @@ import org.apache.ofbiz.service.ServiceU import org.apache.ofbiz.service.ExecutionServiceException abstract class GroovyBaseScript extends Script { - public static final String module = GroovyBaseScript.class.getName(); + public static final String module = GroovyBaseScript.class.getName() Map runService(String serviceName, Map inputMap) throws ExecutionServiceException { if (!inputMap.userLogin) { - inputMap.userLogin = this.binding.getVariable('parameters').userLogin; + inputMap.userLogin = this.binding.getVariable('parameters').userLogin } if (!inputMap.timeZone) { - inputMap.timeZone = this.binding.getVariable('parameters').timeZone; + inputMap.timeZone = this.binding.getVariable('parameters').timeZone } if (!inputMap.locale) { - inputMap.locale = this.binding.getVariable('parameters').locale; + inputMap.locale = this.binding.getVariable('parameters').locale } - Map result = binding.getVariable('dispatcher').runSync(serviceName, inputMap); + Map result = binding.getVariable('dispatcher').runSync(serviceName, inputMap) if (ServiceUtil.isError(result)) { throw new ExecutionServiceException(ServiceUtil.getErrorMessage(result)) } - return result; + return result } Map run(Map args) throws ExecutionServiceException { - return runService((String)args.get('service'), (Map)args.get('with', new HashMap())); + return runService((String)args.get('service'), (Map)args.get('with', new HashMap())) } Map makeValue(String entityName) throws ExecutionServiceException { - return result = binding.getVariable('delegator').makeValue(entityName); + return result = binding.getVariable('delegator').makeValue(entityName) } EntityQuery from(def entity) { - return EntityQuery.use(binding.getVariable('delegator')).from(entity); + return EntityQuery.use(binding.getVariable('delegator')).from(entity) } EntityQuery select(String... fields) { - return EntityQuery.use(binding.getVariable('delegator')).select(fields); + return EntityQuery.use(binding.getVariable('delegator')).select(fields) } EntityQuery select(Set<String> fields) { - return EntityQuery.use(binding.getVariable('delegator')).select(fields); + return EntityQuery.use(binding.getVariable('delegator')).select(fields) } def success(String message) { @@ -70,22 +70,22 @@ abstract class GroovyBaseScript extends if (message) { this.binding.getVariable('request').setAttribute("_EVENT_MESSAGE_", message) } - return 'success'; + return 'success' } else { // the script is invoked as a "service" if (message) { - return ServiceUtil.returnSuccess(message); + return ServiceUtil.returnSuccess(message) } else { - return ServiceUtil.returnSuccess(); + return ServiceUtil.returnSuccess() } } } Map failure(String message) { // TODO: implement some clever i18n mechanism based on the userLogin and locale in the binding if (message) { - return ServiceUtil.returnFailure(message); + return ServiceUtil.returnFailure(message) } else { - return ServiceUtil.returnFailure(); + return ServiceUtil.returnFailure() } } def error(String message) { @@ -95,22 +95,22 @@ abstract class GroovyBaseScript extends if (message) { this.binding.getVariable('request').setAttribute("_ERROR_MESSAGE_", message) } - return 'error'; + return 'error' } else { if (message) { - return ServiceUtil.returnError(message); + return ServiceUtil.returnError(message) } else { - return ServiceUtil.returnError(); + return ServiceUtil.returnError() } } } def logInfo(String message) { - Debug.logInfo(message, module); + Debug.logInfo(message, module) } def logWarning(String message) { - Debug.logWarning(message, module); + Debug.logWarning(message, module) } def logError(String message) { - Debug.logError(message, module); + Debug.logError(message, module) } } Modified: ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ArtifactInfo.groovy Wed Nov 2 19:09:13 2016 @@ -17,50 +17,50 @@ * under the License. */ -import org.apache.ofbiz.entity.Delegator; -import org.apache.ofbiz.webtools.artifactinfo.*; -import org.apache.ofbiz.base.util.*; +import org.apache.ofbiz.entity.Delegator +import org.apache.ofbiz.webtools.artifactinfo.* +import org.apache.ofbiz.base.util.* -name = parameters.name; -location = parameters.location; -type = parameters.type; -uniqueId = parameters.uniqueId; +name = parameters.name +location = parameters.location +type = parameters.type +uniqueId = parameters.uniqueId delegatorName = delegator.getDelegatorName() if (delegatorName.contains("default#")) { - delegatorName = "default"; + delegatorName = "default" } -aif = ArtifactInfoFactory.getArtifactInfoFactory(delegatorName); -context.aif = aif; -artifactInfo = null; +aif = ArtifactInfoFactory.getArtifactInfoFactory(delegatorName) +context.aif = aif +artifactInfo = null if ("search".equals(parameters.findType)) { - artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name, type); + artifactInfoSet = aif.getAllArtifactInfosByNamePartial(name, type) if (artifactInfoSet.size() == 1) { - artifactInfo = artifactInfoSet.iterator().next(); - context.artifactInfo = artifactInfo; + artifactInfo = artifactInfoSet.iterator().next() + context.artifactInfo = artifactInfo } else { - context.artifactInfoSet = new TreeSet(artifactInfoSet); + context.artifactInfoSet = new TreeSet(artifactInfoSet) } } else { if (name) { - artifactInfo = aif.getArtifactInfoByNameAndType(name, location, type); - context.artifactInfo = artifactInfo; + artifactInfo = aif.getArtifactInfoByNameAndType(name, location, type) + context.artifactInfo = artifactInfo } else if (uniqueId) { - artifactInfo = aif.getArtifactInfoByUniqueIdAndType(uniqueId, type); - context.artifactInfo = artifactInfo; + artifactInfo = aif.getArtifactInfoByUniqueIdAndType(uniqueId, type) + context.artifactInfo = artifactInfo } } if (artifactInfo) { - artifactInfoMap = [type : artifactInfo.getType(), uniqueId : artifactInfo.getUniqueId(), displayName : artifactInfo.getDisplayName()]; + artifactInfoMap = [type : artifactInfo.getType(), uniqueId : artifactInfo.getUniqueId(), displayName : artifactInfo.getDisplayName()] // add to the recently viewed list - recentArtifactInfoList = session.getAttribute("recentArtifactInfoList"); + recentArtifactInfoList = session.getAttribute("recentArtifactInfoList") if (!recentArtifactInfoList) { - recentArtifactInfoList = []; - session.setAttribute("recentArtifactInfoList", recentArtifactInfoList); + recentArtifactInfoList = [] + session.setAttribute("recentArtifactInfoList", recentArtifactInfoList) } if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfoMap)) { // hmmm, I guess do nothing if it's already there } else { - recentArtifactInfoList.add(0, artifactInfoMap); + recentArtifactInfoList.add(0, artifactInfoMap) } } Modified: ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/ComponentList.groovy Wed Nov 2 19:09:13 2016 @@ -17,59 +17,59 @@ * under the License. */ -import java.util.Collection; -import java.util.List; +import java.util.Collection +import java.util.List -import org.apache.ofbiz.base.component.ComponentConfig; -import org.apache.ofbiz.base.component.ComponentConfig.WebappInfo; +import org.apache.ofbiz.base.component.ComponentConfig +import org.apache.ofbiz.base.component.ComponentConfig.WebappInfo import org.apache.ofbiz.base.util.* -Collection <ComponentConfig> components = ComponentConfig.getAllComponents(); -List componentList = []; +Collection <ComponentConfig> components = ComponentConfig.getAllComponents() +List componentList = [] components.each { component -> - List<WebappInfo> webApps = component.getWebappInfos(); + List<WebappInfo> webApps = component.getWebappInfos() webApps.each { webApp -> - componentMap = [:]; - componentMap.compName = component.getComponentName(); - componentMap.rootLocation = component.getRootLocation(); - componentMap.enabled = (component.enabled() == true? "Y" : "N"); - componentMap.webAppName = webApp.getName(); - componentMap.contextRoot = webApp.getContextRoot(); - componentMap.location = webApp.getLocation(); - componentMap.webAppName = webApp.getName(); - componentMap.contextRoot = webApp.getContextRoot(); - componentMap.location = webApp.getLocation(); - componentList.add(componentMap); + componentMap = [:] + componentMap.compName = component.getComponentName() + componentMap.rootLocation = component.getRootLocation() + componentMap.enabled = (component.enabled() == true? "Y" : "N") + componentMap.webAppName = webApp.getName() + componentMap.contextRoot = webApp.getContextRoot() + componentMap.location = webApp.getLocation() + componentMap.webAppName = webApp.getName() + componentMap.contextRoot = webApp.getContextRoot() + componentMap.location = webApp.getLocation() + componentList.add(componentMap) } if (UtilValidate.isEmpty(webApps)) { - componentMap = [:]; - componentMap.compName = component.getComponentName(); - componentMap.rootLocation = component.getRootLocation(); - componentMap.enabled = (component.enabled() == true? "Y" : "N"); - componentList.add(componentMap); - componentMap.webAppName = ""; - componentMap.contextRoot = ""; - componentMap.location = ""; - componentMap.webAppName = ""; - componentMap.contextRoot = ""; - componentMap.location = ""; + componentMap = [:] + componentMap.compName = component.getComponentName() + componentMap.rootLocation = component.getRootLocation() + componentMap.enabled = (component.enabled() == true? "Y" : "N") + componentList.add(componentMap) + componentMap.webAppName = "" + componentMap.contextRoot = "" + componentMap.location = "" + componentMap.webAppName = "" + componentMap.contextRoot = "" + componentMap.location = "" } } // sort the entries -componentList = UtilMisc.sortMaps(componentList, UtilMisc.toList("+compName")); +componentList = UtilMisc.sortMaps(componentList, UtilMisc.toList("+compName")) // make the list more readable -lastComp = null; +lastComp = null for (int entry = 0; entry < componentList.size(); entry++) { - compSave = componentList[entry].compName; + compSave = componentList[entry].compName if (lastComp != null && compSave.equals(lastComp)) { - componentList[entry].compName = ""; - componentList[entry].rootLocation = ""; - componentList[entry].enabled = ""; + componentList[entry].compName = "" + componentList[entry].rootLocation = "" + componentList[entry].enabled = "" } - lastComp = compSave; + lastComp = compSave } -context.componentList = componentList; +context.componentList = componentList Modified: ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy Wed Nov 2 19:09:13 2016 @@ -17,45 +17,45 @@ * under the License. */ -import org.apache.ofbiz.base.component.ComponentConfig; -import org.apache.ofbiz.base.config.GenericConfigException; -import org.apache.ofbiz.base.config.ResourceHandler; -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.base.util.UtilXml; -import org.apache.ofbiz.base.util.UtilMisc; +import org.apache.ofbiz.base.component.ComponentConfig +import org.apache.ofbiz.base.config.GenericConfigException +import org.apache.ofbiz.base.config.ResourceHandler +import org.apache.ofbiz.base.util.Debug +import org.apache.ofbiz.base.util.UtilXml +import org.apache.ofbiz.base.util.UtilMisc -import org.w3c.dom.Document; -import org.w3c.dom.Element; +import org.w3c.dom.Document +import org.w3c.dom.Element -List testList = []; +List testList = [] for (ComponentConfig.TestSuiteInfo testSuiteInfo: ComponentConfig.getAllTestSuiteInfos(parameters.compName)) { - String componentName = testSuiteInfo.componentConfig.getComponentName(); - ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler(); + String componentName = testSuiteInfo.componentConfig.getComponentName() + ResourceHandler testSuiteResource = testSuiteInfo.createResourceHandler() try { - Document testSuiteDocument = testSuiteResource.getDocument(); - Element documentElement = testSuiteDocument.getDocumentElement(); + Document testSuiteDocument = testSuiteResource.getDocument() + Element documentElement = testSuiteDocument.getDocumentElement() suiteName = documentElement.getAttribute("suite-name") - firstLine = true; + firstLine = true for (Element testCaseElement : UtilXml.childElementList(documentElement, UtilMisc.toSet("test-case", "test-group"))) { - testMap = [:]; - String caseName = testCaseElement.getAttribute("case-name"); + testMap = [:] + String caseName = testCaseElement.getAttribute("case-name") if (firstLine == true) { - testMap = UtilMisc.toMap("suiteName", suiteName, "suiteNameSave", suiteName, "caseName", caseName); - firstLine = false; + testMap = UtilMisc.toMap("suiteName", suiteName, "suiteNameSave", suiteName, "caseName", caseName) + firstLine = false } else { - testMap = UtilMisc.toMap("suiteNameSave", suiteName, "caseName", caseName); + testMap = UtilMisc.toMap("suiteNameSave", suiteName, "caseName", caseName) } - testList.add(testMap); + testList.add(testMap) } } catch (GenericConfigException e) { - String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]"; - Debug.logError(e, errMsg, module); - throw new IllegalArgumentException(errMsg); + String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]" + Debug.logError(e, errMsg, module) + throw new IllegalArgumentException(errMsg) } } -context.suits = testList; +context.suits = testList Modified: ofbiz/trunk/framework/webtools/groovyScripts/cache/EditUtilCache.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/cache/EditUtilCache.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/cache/EditUtilCache.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/cache/EditUtilCache.groovy Wed Nov 2 19:09:13 2016 @@ -16,42 +16,42 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.base.util.cache.UtilCache; -import org.apache.ofbiz.base.util.cache.CacheLine; -import org.apache.ofbiz.base.util.UtilFormatOut; -import org.apache.ofbiz.security.Security; +import org.apache.ofbiz.base.util.cache.UtilCache +import org.apache.ofbiz.base.util.cache.CacheLine +import org.apache.ofbiz.base.util.UtilFormatOut +import org.apache.ofbiz.security.Security -cacheName = parameters.UTIL_CACHE_NAME; -context.cacheName = cacheName; +cacheName = parameters.UTIL_CACHE_NAME +context.cacheName = cacheName if (cacheName) { - utilCache = UtilCache.findCache(cacheName); + utilCache = UtilCache.findCache(cacheName) if (utilCache) { - cache = [:]; + cache = [:] - cache.cacheName = utilCache.getName(); - cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size()); - cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount()); - cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal()); - cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound()); - cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired()); - cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef()); - cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount()); - cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount()); - cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory()); - cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime()); - cache.useSoftReference = utilCache.getUseSoftReference().toString(); + cache.cacheName = utilCache.getName() + cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size()) + cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount()) + cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal()) + cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound()) + cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired()) + cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef()) + cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount()) + cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount()) + cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory()) + cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime()) + cache.useSoftReference = utilCache.getUseSoftReference().toString() - exp = utilCache.getExpireTime(); - hrs = Math.floor(exp / (60 * 60 * 1000)); - exp = exp % (60 * 60 * 1000); - mins = Math.floor(exp / (60 * 1000)); - exp = exp % (60 * 1000); - secs = exp / 1000; - cache.hrs = hrs; - cache.mins = mins; - cache.secs = UtilFormatOut.formatPrice(secs); + exp = utilCache.getExpireTime() + hrs = Math.floor(exp / (60 * 60 * 1000)) + exp = exp % (60 * 60 * 1000) + mins = Math.floor(exp / (60 * 1000)) + exp = exp % (60 * 1000) + secs = exp / 1000 + cache.hrs = hrs + cache.mins = mins + cache.secs = UtilFormatOut.formatPrice(secs) - context.cache = cache; + context.cache = cache } } Modified: ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCache.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCache.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCache.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCache.groovy Wed Nov 2 19:09:13 2016 @@ -16,49 +16,49 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.base.util.cache.UtilCache; -import org.apache.ofbiz.base.util.UtilFormatOut; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.security.Security; +import org.apache.ofbiz.base.util.cache.UtilCache +import org.apache.ofbiz.base.util.UtilFormatOut +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.security.Security -context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session); +context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session) -cacheList = []; -totalCacheMemory = 0.0; -names = new TreeSet(UtilCache.getUtilCacheTableKeySet()); +cacheList = [] +totalCacheMemory = 0.0 +names = new TreeSet(UtilCache.getUtilCacheTableKeySet()) names.each { cacheName -> - utilCache = UtilCache.findCache(cacheName); - cache = [:]; + utilCache = UtilCache.findCache(cacheName) + cache = [:] - cache.cacheName = utilCache.getName(); - cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size()); - cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount()); - cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal()); - cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound()); - cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired()); - cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef()); - cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount()); - cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount()); - cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory()); - cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime()); - cache.useSoftReference = utilCache.getUseSoftReference().toString(); - cache.cacheMemory = utilCache.getSizeInBytes(); - totalCacheMemory += cache.cacheMemory; - cacheList.add(cache); + cache.cacheName = utilCache.getName() + cache.cacheSize = UtilFormatOut.formatQuantity(utilCache.size()) + cache.hitCount = UtilFormatOut.formatQuantity(utilCache.getHitCount()) + cache.missCountTot = UtilFormatOut.formatQuantity(utilCache.getMissCountTotal()) + cache.missCountNotFound = UtilFormatOut.formatQuantity(utilCache.getMissCountNotFound()) + cache.missCountExpired = UtilFormatOut.formatQuantity(utilCache.getMissCountExpired()) + cache.missCountSoftRef = UtilFormatOut.formatQuantity(utilCache.getMissCountSoftRef()) + cache.removeHitCount = UtilFormatOut.formatQuantity(utilCache.getRemoveHitCount()) + cache.removeMissCount = UtilFormatOut.formatQuantity(utilCache.getRemoveMissCount()) + cache.maxInMemory = UtilFormatOut.formatQuantity(utilCache.getMaxInMemory()) + cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime()) + cache.useSoftReference = utilCache.getUseSoftReference().toString() + cache.cacheMemory = utilCache.getSizeInBytes() + totalCacheMemory += cache.cacheMemory + cacheList.add(cache) } -sortField = parameters.sortField; +sortField = parameters.sortField if (sortField) { - context.cacheList = UtilMisc.sortMaps(cacheList, UtilMisc.toList(sortField)); + context.cacheList = UtilMisc.sortMaps(cacheList, UtilMisc.toList(sortField)) } else { - context.cacheList = cacheList; + context.cacheList = cacheList } -context.totalCacheMemory = totalCacheMemory; +context.totalCacheMemory = totalCacheMemory -rt = Runtime.getRuntime(); -memoryInfo = [:]; -memoryInfo.memory = UtilFormatOut.formatQuantity(rt.totalMemory()); -memoryInfo.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory()); -memoryInfo.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory())); -memoryInfo.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory()); -memoryInfo.totalCacheMemory = totalCacheMemory; -context.memoryInfo = memoryInfo; +rt = Runtime.getRuntime() +memoryInfo = [:] +memoryInfo.memory = UtilFormatOut.formatQuantity(rt.totalMemory()) +memoryInfo.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory()) +memoryInfo.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory())) +memoryInfo.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory()) +memoryInfo.totalCacheMemory = totalCacheMemory +context.memoryInfo = memoryInfo Modified: ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/cache/FindUtilCacheElements.groovy Wed Nov 2 19:09:13 2016 @@ -16,38 +16,38 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.base.util.cache.UtilCache; -import org.apache.ofbiz.base.util.cache.CacheLine; -import org.apache.ofbiz.base.util.UtilFormatOut; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.security.Security; +import org.apache.ofbiz.base.util.cache.UtilCache +import org.apache.ofbiz.base.util.cache.CacheLine +import org.apache.ofbiz.base.util.UtilFormatOut +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.security.Security -context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session); +context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session) -cacheName = parameters.UTIL_CACHE_NAME; -context.cacheName = cacheName; -context.now = (new Date()).toString(); +cacheName = parameters.UTIL_CACHE_NAME +context.cacheName = cacheName +context.now = (new Date()).toString() -totalSize = 0; +totalSize = 0 -cacheElementsList = []; +cacheElementsList = [] if (cacheName) { - utilCache = UtilCache.findCache(cacheName); + utilCache = UtilCache.findCache(cacheName) if (utilCache) { cacheElementsList = utilCache.getLineInfos() cacheElementsList.each { if (it.expireTimeMillis != null) { - it.expireTimeMillis = (it.expireTimeMillis / 1000) .toString(); + it.expireTimeMillis = (it.expireTimeMillis / 1000) .toString() } - totalSize += it.lineSize; - it.lineSize = UtilFormatOut.formatQuantity(it.lineSize); + totalSize += it.lineSize + it.lineSize = UtilFormatOut.formatQuantity(it.lineSize) } } } -context.totalSize = UtilFormatOut.formatQuantity(totalSize); -sortField = parameters.sortField; +context.totalSize = UtilFormatOut.formatQuantity(totalSize) +sortField = parameters.sortField if (sortField) { - context.cacheElementsList = UtilMisc.sortMaps(cacheElementsList, UtilMisc.toList(sortField)); + context.cacheElementsList = UtilMisc.sortMaps(cacheElementsList, UtilMisc.toList(sortField)) } else { - context.cacheElementsList = cacheElementsList; + context.cacheElementsList = cacheElementsList } Modified: ofbiz/trunk/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/datafile/ViewDataFile.groovy Wed Nov 2 19:09:13 2016 @@ -17,87 +17,87 @@ * under the License. */ -import java.util.*; -import java.net.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.datafile.*; - -uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale); -messages = []; - -dataFileSave = request.getParameter("DATAFILE_SAVE"); - -entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE"); - -dataFileLoc = request.getParameter("DATAFILE_LOCATION"); -definitionLoc = request.getParameter("DEFINITION_LOCATION"); -definitionName = request.getParameter("DEFINITION_NAME"); -dataFileIsUrl = null != request.getParameter("DATAFILE_IS_URL"); -definitionIsUrl = null != request.getParameter("DEFINITION_IS_URL"); +import java.util.* +import java.net.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.datafile.* + +uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale) +messages = [] + +dataFileSave = request.getParameter("DATAFILE_SAVE") + +entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE") + +dataFileLoc = request.getParameter("DATAFILE_LOCATION") +definitionLoc = request.getParameter("DEFINITION_LOCATION") +definitionName = request.getParameter("DEFINITION_NAME") +dataFileIsUrl = null != request.getParameter("DATAFILE_IS_URL") +definitionIsUrl = null != request.getParameter("DEFINITION_IS_URL") try { - dataFileUrl = dataFileIsUrl?new URL(dataFileLoc):UtilURL.fromFilename(dataFileLoc); + dataFileUrl = dataFileIsUrl?new URL(dataFileLoc):UtilURL.fromFilename(dataFileLoc) } catch (java.net.MalformedURLException e) { - messages.add(e.getMessage()); + messages.add(e.getMessage()) } try { - definitionUrl = definitionIsUrl?new URL(definitionLoc):UtilURL.fromFilename(definitionLoc); + definitionUrl = definitionIsUrl?new URL(definitionLoc):UtilURL.fromFilename(definitionLoc) } catch (java.net.MalformedURLException e) { - messages.add(e.getMessage()); + messages.add(e.getMessage()) } -definitionNames = null; +definitionNames = null if (definitionUrl) { try { - ModelDataFileReader reader = ModelDataFileReader.getModelDataFileReader(definitionUrl); + ModelDataFileReader reader = ModelDataFileReader.getModelDataFileReader(definitionUrl) if (reader) { - definitionNames = ((Collection)reader.getDataFileNames()).iterator(); - context.put("definitionNames", definitionNames); + definitionNames = ((Collection)reader.getDataFileNames()).iterator() + context.put("definitionNames", definitionNames) } } catch (Exception e) { - messages.add(e.getMessage()); + messages.add(e.getMessage()) } } -dataFile = null; +dataFile = null if (dataFileUrl && definitionUrl && definitionNames) { try { - dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName); - context.put("dataFile", dataFile); + dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName) + context.put("dataFile", dataFile) } catch (Exception e) { - messages.add(e.toString()); Debug.log(e); + messages.add(e.toString()); Debug.log(e) } } if (dataFile) { - modelDataFile = dataFile.getModelDataFile(); - context.put("modelDataFile", modelDataFile); + modelDataFile = dataFile.getModelDataFile() + context.put("modelDataFile", modelDataFile) } if (dataFile && dataFileSave) { try { - dataFile.writeDataFile(dataFileSave); - messages.add(uiLabelMap.get("WebtoolsDataFileSavedTo") + dataFileSave); + dataFile.writeDataFile(dataFileSave) + messages.add(uiLabelMap.get("WebtoolsDataFileSavedTo") + dataFileSave) } catch (Exception e) { - messages.add(e.getMessage()); + messages.add(e.getMessage()) } } if (dataFile && entityXmlFileSave) { try { - //dataFile.writeDataFile(entityXmlFileSave); - DataFile2EntityXml.writeToEntityXml(entityXmlFileSave, dataFile); - messages.add(uiLabelMap.get("WebtoolsDataEntityFileSavedTo") + entityXmlFileSave); + //dataFile.writeDataFile(entityXmlFileSave) + DataFile2EntityXml.writeToEntityXml(entityXmlFileSave, dataFile) + messages.add(uiLabelMap.get("WebtoolsDataEntityFileSavedTo") + entityXmlFileSave) } catch (Exception e) { - messages.add(e.getMessage()); + messages.add(e.getMessage()) } } -context.messages = messages; +context.messages = messages Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/CheckDb.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/CheckDb.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/entity/CheckDb.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/entity/CheckDb.groovy Wed Nov 2 19:09:13 2016 @@ -16,105 +16,105 @@ * 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.jdbc.DatabaseUtil; -import org.apache.ofbiz.entity.model.ModelEntity; +import org.apache.ofbiz.entity.Delegator +import org.apache.ofbiz.security.Security +import org.apache.ofbiz.entity.jdbc.DatabaseUtil +import org.apache.ofbiz.entity.model.ModelEntity -controlPath = parameters._CONTROL_PATH_; +controlPath = parameters._CONTROL_PATH_ if (security.hasPermission("ENTITY_MAINT", session)) { - addMissing = "true".equals(parameters.addMissing); - checkFkIdx = "true".equals(parameters.checkFkIdx); - checkFks = "true".equals(parameters.checkFks); - checkPks = "true".equals(parameters.checkPks); - repair = "true".equals(parameters.repair); - option = parameters.option; - groupName = parameters.groupName; - entityName = parameters.entityName; + addMissing = "true".equals(parameters.addMissing) + checkFkIdx = "true".equals(parameters.checkFkIdx) + checkFks = "true".equals(parameters.checkFks) + checkPks = "true".equals(parameters.checkPks) + repair = "true".equals(parameters.repair) + option = parameters.option + groupName = parameters.groupName + entityName = parameters.entityName if (groupName) { - helperInfo = delegator.getGroupHelperInfo(groupName); + helperInfo = delegator.getGroupHelperInfo(groupName) - messages = []; - //helper = GenericHelperFactory.getHelper(helperName); - dbUtil = new DatabaseUtil(helperInfo); - modelEntities = delegator.getModelEntityMapByGroup(groupName); - modelEntityNames = new TreeSet(modelEntities.keySet()); + messages = [] + //helper = GenericHelperFactory.getHelper(helperName) + dbUtil = new DatabaseUtil(helperInfo) + modelEntities = delegator.getModelEntityMapByGroup(groupName) + modelEntityNames = new TreeSet(modelEntities.keySet()) if ("checkupdatetables".equals(option)) { - fieldsToRepair = null; + fieldsToRepair = null if (repair) { - fieldsToRepair = []; + fieldsToRepair = [] } - dbUtil.checkDb(modelEntities, fieldsToRepair, messages, checkPks, checkFks, checkFkIdx, addMissing); + dbUtil.checkDb(modelEntities, fieldsToRepair, messages, checkPks, checkFks, checkFkIdx, addMissing) if (fieldsToRepair) { - dbUtil.repairColumnSizeChanges(modelEntities, fieldsToRepair, messages); + dbUtil.repairColumnSizeChanges(modelEntities, fieldsToRepair, messages) } } else if ("removetables".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.deleteTable(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.deleteTable(modelEntity, messages) } } else if ("removetable".equals(option)) { - modelEntity = modelEntities[entityName]; - dbUtil.deleteTable(modelEntity, messages); + modelEntity = modelEntities[entityName] + dbUtil.deleteTable(modelEntity, messages) } else if ("removepks".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.deletePrimaryKey(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.deletePrimaryKey(modelEntity, messages) } } else if ("removepk".equals(option)) { - modelEntity = modelEntities[entityName]; - dbUtil.deletePrimaryKey(modelEntity, messages); + modelEntity = modelEntities[entityName] + dbUtil.deletePrimaryKey(modelEntity, messages) } else if ("createpks".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.createPrimaryKey(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.createPrimaryKey(modelEntity, messages) } } else if ("createpk".equals(option)) { - modelEntity = modelEntities[entityName]; - dbUtil.createPrimaryKey(modelEntity, messages); + modelEntity = modelEntities[entityName] + dbUtil.createPrimaryKey(modelEntity, messages) } else if ("createfkidxs".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.createForeignKeyIndices(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.createForeignKeyIndices(modelEntity, messages) } } else if ("removefkidxs".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.deleteForeignKeyIndices(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.deleteForeignKeyIndices(modelEntity, messages) } } else if ("createfks".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.createForeignKeys(modelEntity, modelEntities, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.createForeignKeys(modelEntity, modelEntities, messages) } } else if ("removefks".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.deleteForeignKeys(modelEntity, modelEntities, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.deleteForeignKeys(modelEntity, modelEntities, messages) } } else if ("createidx".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.createDeclaredIndices(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.createDeclaredIndices(modelEntity, messages) } } else if ("removeidx".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.deleteDeclaredIndices(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.deleteDeclaredIndices(modelEntity, messages) } } else if ("updateCharsetCollate".equals(option)) { modelEntityNames.each { modelEntityName -> - modelEntity = modelEntities[modelEntityName]; - dbUtil.updateCharacterSetAndCollation(modelEntity, messages); + modelEntity = modelEntities[modelEntityName] + dbUtil.updateCharacterSetAndCollation(modelEntity, messages) } } - miter = messages.iterator(); - context.miters = miter; + miter = messages.iterator() + context.miters = miter } - context.encodeURLCheckDb = response.encodeURL(controlPath + "/view/checkdb"); - context.groupName = groupName ?: "org.apache.ofbiz"; - context.entityName = entityName ?: ""; + context.encodeURLCheckDb = response.encodeURL(controlPath + "/view/checkdb") + context.groupName = groupName ?: "org.apache.ofbiz" + context.entityName = entityName ?: "" } Modified: ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityMaint.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityMaint.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityMaint.groovy (original) +++ ofbiz/trunk/framework/webtools/groovyScripts/entity/EntityMaint.groovy Wed Nov 2 19:09:13 2016 @@ -16,85 +16,85 @@ * specific language governing permissions and limitations * under the License. */ -import org.apache.ofbiz.base.util.UtilValidate; +import org.apache.ofbiz.base.util.UtilValidate import org.apache.ofbiz.entity.Delegator import org.apache.ofbiz.entity.DelegatorFactory import org.apache.ofbiz.entity.GenericValue import org.apache.ofbiz.entity.condition.EntityComparisonOperator -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.model.ModelGroupReader; -import org.apache.ofbiz.entity.model.ModelReader; -import org.apache.ofbiz.entity.model.ModelEntity; +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.model.ModelGroupReader +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.util.EntityUtil; -import org.apache.ofbiz.base.util.UtilProperties; +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.base.util.UtilProperties if (delegator.getDelegatorTenantId() == null) { - mgr = delegator.getModelGroupReader(); - entityGroups = mgr.getGroupNames(delegator.getDelegatorName()).toArray().sort(); + mgr = delegator.getModelGroupReader() + entityGroups = mgr.getGroupNames(delegator.getDelegatorName()).toArray().sort() } else { - Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName()); - entityGroups = EntityUtil.getFieldListFromEntityList(baseDelegator.findList("TenantDataSource", EntityCondition.makeCondition("tenantId", EntityComparisonOperator.EQUALS, delegator.getDelegatorTenantId()), ['entityGroupName'] as Set, ['entityGroupName'], null, false), 'entityGroupName', false); + Delegator baseDelegator = DelegatorFactory.getDelegator(delegator.getDelegatorBaseName()) + entityGroups = EntityUtil.getFieldListFromEntityList(baseDelegator.findList("TenantDataSource", EntityCondition.makeCondition("tenantId", EntityComparisonOperator.EQUALS, delegator.getDelegatorTenantId()), ['entityGroupName'] as Set, ['entityGroupName'], null, false), 'entityGroupName', false) } -context.entityGroups = []; -context.entityGroups.add(["name" : UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsAll", locale), "value" : ""]); +context.entityGroups = [] +context.entityGroups.add(["name" : UtilProperties.getMessage("WebtoolsUiLabels", "WebtoolsAll", locale), "value" : ""]) for (String entityGroup : entityGroups) { - context.entityGroups.add(["name" : entityGroup, "value" : entityGroup]); + context.entityGroups.add(["name" : entityGroup, "value" : entityGroup]) } -filterByGroupName = parameters.filterByGroupName; -context.filterByGroupName = filterByGroupName; +filterByGroupName = parameters.filterByGroupName +context.filterByGroupName = filterByGroupName -filterByEntityName = parameters.filterByEntityName; -context.filterByEntityName = filterByEntityName; +filterByEntityName = parameters.filterByEntityName +context.filterByEntityName = filterByEntityName -reader = delegator.getModelReader(); -entities = new TreeSet(reader.getEntityNames()); +reader = delegator.getModelReader() +entities = new TreeSet(reader.getEntityNames()) -entitiesList = []; -firstChars = []; -firstChar = ""; +entitiesList = [] +firstChars = [] +firstChar = "" entities.each { entityName -> - entity = reader.getModelEntity(entityName); - entityGroupName = delegator.getEntityGroupName(entity.getEntityName()); + entity = reader.getModelEntity(entityName) + entityGroupName = delegator.getEntityGroupName(entity.getEntityName()) if (!entityGroups.contains(entityGroupName)) { - return; + return } if (filterByGroupName && !filterByGroupName.equals(entityGroupName)) { - return; + return } if (filterByEntityName && !((String)entity.getEntityName()).toUpperCase().contains(filterByEntityName.toUpperCase().replace(" ", ""))) { - return; + return } - viewEntity = "N"; + viewEntity = "N" if (entity instanceof ModelViewEntity) { - viewEntity = "Y"; + viewEntity = "Y" } - entityPermissionView = "N"; + entityPermissionView = "N" if (security.hasEntityPermission("ENTITY_DATA", "_VIEW", session) || security.hasEntityPermission(entity.getPlainTableName(), "_VIEW", session)) { - entityPermissionView = "Y"; + entityPermissionView = "Y" } - entityPermissionCreate = "N"; + entityPermissionCreate = "N" if (security.hasEntityPermission("ENTITY_DATA", "_CREATE", session) || security.hasEntityPermission(entity.getPlainTableName(), "_CREATE", session)) { - entityPermissionCreate = "Y"; + entityPermissionCreate = "Y" } - entityMap = [:]; - entityMap.entityName = entity.getEntityName(); - entityMap.entityPermissionView = entityPermissionView; - entityMap.entityPermissionCreate = entityPermissionCreate; - entityMap.viewEntity = viewEntity; + entityMap = [:] + entityMap.entityName = entity.getEntityName() + entityMap.entityPermissionView = entityPermissionView + entityMap.entityPermissionCreate = entityPermissionCreate + entityMap.viewEntity = viewEntity if (firstChar != entityName.substring(0, 1)) { - firstChar = entityName.substring(0, 1); - firstChars.add(firstChar); + firstChar = entityName.substring(0, 1) + firstChars.add(firstChar) } - entitiesList.add(entityMap); + entitiesList.add(entityMap) } -context.firstChars = firstChars; -context.entitiesList = entitiesList; \ No newline at end of file +context.firstChars = firstChars +context.entitiesList = entitiesList \ No newline at end of file |
Free forum by Nabble | Edit this page |