Modified: ofbiz/trunk/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy Wed Nov 2 19:09:13 2016 @@ -24,71 +24,71 @@ import org.apache.ofbiz.content.content. import org.apache.ofbiz.content.data.DataResourceWorker import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler -userLogin = session.getAttribute("userLogin"); -contentAssocDataResourceViewFrom = delegator.makeValue("ContentAssocDataResourceViewFrom"); +userLogin = session.getAttribute("userLogin") +contentAssocDataResourceViewFrom = delegator.makeValue("ContentAssocDataResourceViewFrom") -contentId = context.contentId; +contentId = context.contentId -contentAssocPK = delegator.makeValue("ContentAssoc"); -contentAssocPK.setAllFields(context, false, "ca", new Boolean(true)); -Debug.logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK,""); +contentAssocPK = delegator.makeValue("ContentAssoc") +contentAssocPK.setAllFields(context, false, "ca", new Boolean(true)) +Debug.logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK,"") -contentAssoc = null; +contentAssoc = null if (contentAssocPK.isPrimaryKey()) { - contentAssoc = from("ContentAssoc").where(contentAssocPK).queryOne(); + contentAssoc = from("ContentAssoc").where(contentAssocPK).queryOne() } if (contentAssoc) { - SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()); + SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()) } else { - contentAssocPK.setAllFields(context, false, "ca", null); //set all field, pk and non - SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssocPK, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()); + contentAssocPK.setAllFields(context, false, "ca", null) //set all field, pk and non + SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssocPK, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()) } -Debug.logInfo("in cmseditaddprep, contentAssocDataResourceViewFrom:" + contentAssocDataResourceViewFrom,""); +Debug.logInfo("in cmseditaddprep, contentAssocDataResourceViewFrom:" + contentAssocDataResourceViewFrom,"") -dataResourceId = ""; -textData = ""; -content = null; +dataResourceId = "" +textData = "" +content = null if (contentId) { - content = from("Content").where("contentId", contentId).cache(true).queryOne(); + content = from("Content").where("contentId", contentId).cache(true).queryOne() if (content) { - contentAssocDataResourceViewFrom.setAllFields(content, false, null, null); + contentAssocDataResourceViewFrom.setAllFields(content, false, null, null) } } else { - contentAssocDataResourceViewFrom.set("contentTypeId", "DOCUMENT"); + contentAssocDataResourceViewFrom.set("contentTypeId", "DOCUMENT") } if (content) { - dataResourceId = content.dataResourceId; + dataResourceId = content.dataResourceId } if (!dataResourceId) { - dataResourceId = context.drDataResourceId; + dataResourceId = context.drDataResourceId if (!dataResourceId) { - dataResourceId = context.dataResourceId; + dataResourceId = context.dataResourceId } } if (dataResourceId) { - dataResource = from("DataResource").where("dataResourceId", dataResourceId).cache(true).queryOne(); - SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()); - templateRoot = [:]; - FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response); - txt = DataResourceWorker.getDataResourceText(dataResource, "text/html", Locale.getDefault(), templateRoot, delegator, true); + dataResource = from("DataResource").where("dataResourceId", dataResourceId).cache(true).queryOne() + SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()) + templateRoot = [:] + FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response) + txt = DataResourceWorker.getDataResourceText(dataResource, "text/html", Locale.getDefault(), templateRoot, delegator, true) if (txt) { - textData = UtilFormatOut.encodeXmlValue(txt); + textData = UtilFormatOut.encodeXmlValue(txt) } } -Debug.logInfo("in cmseditaddprep, textData:" + textData,""); +Debug.logInfo("in cmseditaddprep, textData:" + textData,"") -currentValue = new HashMap(contentAssocDataResourceViewFrom); -currentValue.textData = textData; -currentValue.nowTimestamp = UtilDateTime.nowTimestamp(); -context.currentValue = currentValue; +currentValue = new HashMap(contentAssocDataResourceViewFrom) +currentValue.textData = textData +currentValue.nowTimestamp = UtilDateTime.nowTimestamp() +context.currentValue = currentValue -request.setAttribute("previousParams", currentValue); +request.setAttribute("previousParams", currentValue) -persistAction = context.persistAction; +persistAction = context.persistAction if (!persistAction) { - persistAction = "persistContent"; + persistAction = "persistContent" } context.persistAction = persistAction; \ No newline at end of file Modified: ofbiz/trunk/applications/content/groovyScripts/cms/FeaturePrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/cms/FeaturePrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/cms/FeaturePrep.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/cms/FeaturePrep.groovy Wed Nov 2 19:09:13 2016 @@ -19,26 +19,26 @@ import org.apache.ofbiz.base.util.UtilHttp -paramMap = UtilHttp.getParameterMap(request); +paramMap = UtilHttp.getParameterMap(request) -contentId = context.contentId; -dataResourceId = context.dataResourceId; +contentId = context.contentId +dataResourceId = context.dataResourceId -productFeatureList = from("ProductFeature").cache(true).queryList(); -featureList = [] as ArrayList; +productFeatureList = from("ProductFeature").cache(true).queryList() +featureList = [] as ArrayList if (dataResourceId) { productFeatureList.each { productFeature -> - productFeatureId = productFeature.productFeatureId; - description = productFeature.description; - productFeatureDataResource = from("ProductFeatureDataResource").where("productFeatureId", productFeatureId, "dataResourceId", dataResourceId).cache(true).queryOne(); + productFeatureId = productFeature.productFeatureId + description = productFeature.description + productFeatureDataResource = from("ProductFeatureDataResource").where("productFeatureId", productFeatureId, "dataResourceId", dataResourceId).cache(true).queryOne() if (productFeatureDataResource) { - feature = []; - feature.productFeatureId = productFeatureId; - feature.dataResourceId = dataResourceId; - feature.action = "Y"; - feature.description = description; - featureList.add(feature); + feature = [] + feature.productFeatureId = productFeatureId + feature.dataResourceId = dataResourceId + feature.action = "Y" + feature.description = description + featureList.add(feature) } } - context.featureList = featureList; + context.featureList = featureList } Modified: ofbiz/trunk/applications/content/groovyScripts/cms/GetMenuContext.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/cms/GetMenuContext.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/cms/GetMenuContext.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/cms/GetMenuContext.groovy Wed Nov 2 19:09:13 2016 @@ -17,16 +17,16 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.base.util.Debug -Debug.logInfo("In getMenuContext.", ""); +Debug.logInfo("In getMenuContext.", "") -session = context.session; -menuContext = session.getAttribute("menuContext"); -Debug.logInfo("menuContext(0):" + menuContext, ""); +session = context.session +menuContext = session.getAttribute("menuContext") +Debug.logInfo("menuContext(0):" + menuContext, "") if (!menuContext) { - menuContext = [:]; - session.setAttribute("menuContext", menuContext); + menuContext = [:] + session.setAttribute("menuContext", menuContext) } context.menuContext = menuContext; \ No newline at end of file Modified: ofbiz/trunk/applications/content/groovyScripts/cms/MostRecentPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/cms/MostRecentPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/cms/MostRecentPrep.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/cms/MostRecentPrep.groovy Wed Nov 2 19:09:13 2016 @@ -19,28 +19,28 @@ import org.apache.ofbiz.base.util.* import org.apache.ofbiz.entity.util.* -import org.apache.ofbiz.content.ContentManagementWorker; -import org.apache.ofbiz.content.content.ContentWorker; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.content.ContentManagementWorker +import org.apache.ofbiz.content.content.ContentWorker +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator -Debug.logInfo("in mostrecentprep(1):",""); -paramMap = UtilHttp.getParameterMap(request); -forumId = ContentManagementWorker.getFromSomewhere("moderatedSiteId", paramMap, request, context); +Debug.logInfo("in mostrecentprep(1):","") +paramMap = UtilHttp.getParameterMap(request) +forumId = ContentManagementWorker.getFromSomewhere("moderatedSiteId", paramMap, request, context) if (forumId) { - exprList = [] as ArrayList; - fromDate = UtilDateTime.nowTimestamp(); - thruExpr2 = EntityCondition.makeCondition("caThruDate", EntityOperator.EQUALS, null); - exprList.add(thruExpr2); - statusIdExpr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CTNT_IN_PROGRESS"); - exprList.add(statusIdExpr); - contentIdToExpr = EntityCondition.makeCondition("caContentId", EntityOperator.EQUALS, forumId); - exprList.add(contentIdToExpr); - expr = EntityCondition.makeCondition(exprList, EntityOperator.AND); - entityList = from("ContentAssocViewFrom").where(exprList).orderBy("-caFromDate").queryList(); + exprList = [] as ArrayList + fromDate = UtilDateTime.nowTimestamp() + thruExpr2 = EntityCondition.makeCondition("caThruDate", EntityOperator.EQUALS, null) + exprList.add(thruExpr2) + statusIdExpr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CTNT_IN_PROGRESS") + exprList.add(statusIdExpr) + contentIdToExpr = EntityCondition.makeCondition("caContentId", EntityOperator.EQUALS, forumId) + exprList.add(contentIdToExpr) + expr = EntityCondition.makeCondition(exprList, EntityOperator.AND) + entityList = from("ContentAssocViewFrom").where(exprList).orderBy("-caFromDate").queryList() - Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),""); - Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,""); - context.mostRecentList = entityList; + Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),"") + Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,"") + context.mostRecentList = entityList } Modified: ofbiz/trunk/applications/content/groovyScripts/cms/UserPermPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/cms/UserPermPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/cms/UserPermPrep.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/cms/UserPermPrep.groovy Wed Nov 2 19:09:13 2016 @@ -21,37 +21,37 @@ import org.apache.ofbiz.base.util.* import org.apache.ofbiz.entity.condition.* import org.apache.ofbiz.content.ContentManagementWorker -paramMap = UtilHttp.getParameterMap(request); -forumId = ContentManagementWorker.getFromSomewhere("permRoleSiteId", paramMap, request, context); -blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList(); +paramMap = UtilHttp.getParameterMap(request) +forumId = ContentManagementWorker.getFromSomewhere("permRoleSiteId", paramMap, request, context) +blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList() if (forumId) { - siteRoleMap = [:]; + siteRoleMap = [:] for (int i=0; i < blogRoles.size(); i++) { - roleType = blogRoles.get(i); - roleTypeId = roleType.roleTypeId; - filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList(); - cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId); + roleType = blogRoles.get(i) + roleTypeId = roleType.roleTypeId + filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList() + cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId) filteredRoleList.each { contentRole -> - partyId = contentRole.partyId; - fromDate = contentRole.fromDate; - map = siteRoleMap.get(partyId); + partyId = contentRole.partyId + fromDate = contentRole.fromDate + map = siteRoleMap.get(partyId) if (!map) { - map = [:]; - map.partyId = partyId; - siteRoleMap.put(partyId, map); + map = [:] + map.partyId = partyId + siteRoleMap.put(partyId, map) } - map.put(cappedBlogRoleName, "Y"); - map.put(cappedBlogRoleName + "FromDate", fromDate); + map.put(cappedBlogRoleName, "Y") + map.put(cappedBlogRoleName + "FromDate", fromDate) } } - siteList = new ArrayList(siteRoleMap.values()); - context.siteList = siteList; - context.rowCount = siteList.size(); - blogRoleList = [] as ArrayList; + siteList = new ArrayList(siteRoleMap.values()) + context.siteList = siteList + context.rowCount = siteList.size() + blogRoleList = [] as ArrayList blogRoles.each { roleType -> - blogRoleList.add(roleType.roleTypeId); + blogRoleList.add(roleType.roleTypeId) } - context.blogRoleIdList = blogRoleList; + context.blogRoleIdList = blogRoleList } Modified: ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchOptions.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchOptions.groovy Wed Nov 2 19:09:13 2016 @@ -17,45 +17,45 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import java.sql.Timestamp; -import org.apache.ofbiz.content.content.*; +import org.apache.ofbiz.base.util.* +import java.sql.Timestamp +import org.apache.ofbiz.content.content.* -searchOperator = parameters.get("SEARCH_OPERATOR"); +searchOperator = parameters.get("SEARCH_OPERATOR") if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) { - searchOperator = "OR"; + searchOperator = "OR" } //create the fromDate for calendar -fromCal = Calendar.getInstance(); -fromCal.setTime(new java.util.Date()); -fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)); -fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)); -fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)); -fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)); -fromTs = new Timestamp(fromCal.getTimeInMillis()); -fromStr = fromTs.toString(); -fromStr = fromStr.substring(0, fromStr.indexOf('.')); -context.put("fromDateStr", fromStr); +fromCal = Calendar.getInstance() +fromCal.setTime(new java.util.Date()) +fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)) +fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)) +fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)) +fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)) +fromTs = new Timestamp(fromCal.getTimeInMillis()) +fromStr = fromTs.toString() +fromStr = fromStr.substring(0, fromStr.indexOf('.')) +context.put("fromDateStr", fromStr) // create the thruDate for calendar -toCal = Calendar.getInstance(); -toCal.setTime(new java.util.Date()); -toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)); -toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)); -toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)); -toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)); -toTs = new Timestamp(toCal.getTimeInMillis()); -toStr = toTs.toString(); -context.put("thruDateStr", toStr); - -searchConstraintStrings = ContentSearchSession.searchGetConstraintStrings(false, session, delegator); -searchSortOrderString = ContentSearchSession.searchGetSortOrderString(false, request); -contentAssocTypes = from("ContentAssocType").queryList(); -roleTypes = from("RoleType").queryList(); - -context.put("searchOperator", searchOperator); -context.put("searchConstraintStrings", searchConstraintStrings); -context.put("searchSortOrderString", searchSortOrderString); -context.put("contentAssocTypes", contentAssocTypes); -context.put("roleTypes", roleTypes); +toCal = Calendar.getInstance() +toCal.setTime(new java.util.Date()) +toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)) +toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)) +toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)) +toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)) +toTs = new Timestamp(toCal.getTimeInMillis()) +toStr = toTs.toString() +context.put("thruDateStr", toStr) + +searchConstraintStrings = ContentSearchSession.searchGetConstraintStrings(false, session, delegator) +searchSortOrderString = ContentSearchSession.searchGetSortOrderString(false, request) +contentAssocTypes = from("ContentAssocType").queryList() +roleTypes = from("RoleType").queryList() + +context.put("searchOperator", searchOperator) +context.put("searchConstraintStrings", searchConstraintStrings) +context.put("searchSortOrderString", searchSortOrderString) +context.put("contentAssocTypes", contentAssocTypes) +context.put("roleTypes", roleTypes) Modified: ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchResults.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchResults.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchResults.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/content/ContentSearchResults.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.content.content.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.content.content.* // note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again -ContentSearchSession.processSearchParameters(parameters, request); -Map result = ContentSearchEvents.getContentSearchResult(request, delegator); +ContentSearchSession.processSearchParameters(parameters, request) +Map result = ContentSearchEvents.getContentSearchResult(request, delegator) -context.put("contentIds", result.get("contentIds")); -context.put("viewIndex", result.get("viewIndex")); -context.put("viewSize", result.get("viewSize")); -context.put("listSize", result.get("listSize")); -context.put("lowIndex", result.get("lowIndex")); -context.put("highIndex", result.get("highIndex")); -context.put("searchConstraintStrings", result.get("searchConstraintStrings")); -context.put("searchSortOrderString", result.get("searchSortOrderString")); +context.put("contentIds", result.get("contentIds")) +context.put("viewIndex", result.get("viewIndex")) +context.put("viewSize", result.get("viewSize")) +context.put("listSize", result.get("listSize")) +context.put("lowIndex", result.get("lowIndex")) +context.put("highIndex", result.get("highIndex")) +context.put("searchConstraintStrings", result.get("searchConstraintStrings")) +context.put("searchSortOrderString", result.get("searchSortOrderString")) Modified: ofbiz/trunk/applications/content/groovyScripts/content/GetContentLookupList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/content/GetContentLookupList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/content/GetContentLookupList.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/content/GetContentLookupList.groovy Wed Nov 2 19:09:13 2016 @@ -17,104 +17,104 @@ * under the License. */ - import org.apache.ofbiz.entity.condition.*; - import org.apache.ofbiz.entity.util.*; - import org.apache.ofbiz.entity.*; - import org.apache.ofbiz.base.util.*; - import org.apache.ofbiz.entity.transaction.TransactionUtil; - import org.apache.ofbiz.entity.util.EntityListIterator; - import org.apache.ofbiz.entity.GenericEntity; - import org.apache.ofbiz.entity.model.ModelField; - import org.apache.ofbiz.entity.model.ModelEntity; - import org.apache.ofbiz.entity.model.ModelReader; + import org.apache.ofbiz.entity.condition.* + import org.apache.ofbiz.entity.util.* + import org.apache.ofbiz.entity.* + import org.apache.ofbiz.base.util.* + import org.apache.ofbiz.entity.transaction.TransactionUtil + import org.apache.ofbiz.entity.util.EntityListIterator + import org.apache.ofbiz.entity.GenericEntity + import org.apache.ofbiz.entity.model.ModelField + import org.apache.ofbiz.entity.model.ModelEntity + import org.apache.ofbiz.entity.model.ModelReader 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; -String curFindString=""; - -ModelReader reader = delegator.getModelReader(); -ModelEntity modelEntity = reader.getModelEntity("ContentAssocViewTo"); -GenericEntity findByEntity = delegator.makeValue("ContentAssocViewTo"); -List errMsgList = new ArrayList(); -Iterator fieldIterator = modelEntity.getFieldsIterator(); +context.viewIndexFirst = 0 +context.viewIndex = viewIndex +context.viewIndexPrevious = viewIndex-1 +context.viewIndexNext = viewIndex+1 +String curFindString="" + +ModelReader reader = delegator.getModelReader() +ModelEntity modelEntity = reader.getModelEntity("ContentAssocViewTo") +GenericEntity findByEntity = delegator.makeValue("ContentAssocViewTo") +List errMsgList = new ArrayList() +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(), "GetContentLookupList.groovy"); - errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName()); + Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "GetContentLookupList.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 { - viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue(); + viewSize = Integer.valueOf((String)parameters.get("VIEW_SIZE")).intValue() } catch (NumberFormatException nfe) { } -context.viewSize = viewSize; +context.viewSize = viewSize -int lowIndex = viewIndex*viewSize+1; -int highIndex = (viewIndex+1)*viewSize; +int lowIndex = viewIndex*viewSize+1 +int highIndex = (viewIndex+1)*viewSize -context.lowIndex = lowIndex; -int arraySize = 0; -List resultPartialList = null; +context.lowIndex = lowIndex +int arraySize = 0 +List resultPartialList = null if ((highIndex - lowIndex + 1) > 0) { // get the results as an entity list iterator - boolean beganTransaction = false; + boolean beganTransaction = false if(resultPartialList==null){ try { - beganTransaction = TransactionUtil.begin(); - EntityListIterator listIt = from("ContentAssocViewTo").where("contentIdStart", (String)parameters.get("contentId")).orderBy("contentId ASC").cursorScrollInsensitive().cache(true).queryIterator(); - resultPartialList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1); + beganTransaction = TransactionUtil.begin() + EntityListIterator listIt = from("ContentAssocViewTo").where("contentIdStart", (String)parameters.get("contentId")).orderBy("contentId ASC").cursorScrollInsensitive().cache(true).queryIterator() + resultPartialList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1) - arraySize = listIt.getResultsSizeAfterPartialList(); + arraySize = listIt.getResultsSizeAfterPartialList() if (arraySize < highIndex) { - highIndex = arraySize; + highIndex = arraySize } - listIt.close(); + listIt.close() } catch (GenericEntityException e) { - Debug.logError(e, "Failure in operation, rolling back transaction", "GetContentLookupList.groovy"); + Debug.logError(e, "Failure in operation, rolling back transaction", "GetContentLookupList.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(), "GetContentLookupList.groovy"); + Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "GetContentLookupList.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; - -viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize); -context.viewIndexLast = viewIndexLast; -context.contentAssoc=resultPartialList; +context.highIndex = highIndex +context.arraySize = arraySize +context.resultPartialList = resultPartialList + +viewIndexLast = UtilMisc.getViewLastIndex(arraySize, viewSize) +context.viewIndexLast = viewIndexLast +context.contentAssoc=resultPartialList Modified: ofbiz/trunk/applications/content/groovyScripts/content/PrepSeqNo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/content/PrepSeqNo.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/content/PrepSeqNo.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/content/PrepSeqNo.groovy Wed Nov 2 19:09:13 2016 @@ -19,15 +19,15 @@ import org.apache.ofbiz.base.util.Debug -seqNo = context.caSequenceNum; +seqNo = context.caSequenceNum if (!seqNo) { - seqNo = context.sequenceNum; + seqNo = context.sequenceNum } -Debug.logInfo("caSequenceNum:" + seqNo, ""); +Debug.logInfo("caSequenceNum:" + seqNo, "") if (seqNo) { - seqNumBefore = seqNo - 1; - context.seqNumBefore = seqNumBefore; - seqNumAfter = seqNo + 1; - context.seqNumAfter = seqNumAfter; + seqNumBefore = seqNo - 1 + context.seqNumBefore = seqNumBefore + seqNumAfter = seqNo + 1 + context.seqNumAfter = seqNumAfter } Modified: ofbiz/trunk/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/contentsetup/UserPermPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,46 +17,46 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.content.ContentManagementWorker; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.content.ContentManagementWorker -paramMap = UtilHttp.getParameterMap(request); -forumId = ContentManagementWorker.getFromSomewhere("webSitePublishPoint", paramMap, request, context); -blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList(); +paramMap = UtilHttp.getParameterMap(request) +forumId = ContentManagementWorker.getFromSomewhere("webSitePublishPoint", paramMap, request, context) +blogRoles = from("RoleType").where("parentTypeId", "BLOG").cache(true).queryList() if (forumId) { - siteRoleMap = [:]; + siteRoleMap = [:] for (int i=0; i < blogRoles.size(); i++) { - roleType = blogRoles.get(i); - roleTypeId = roleType.roleTypeId; - filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList(); - cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId); + roleType = blogRoles.get(i) + roleTypeId = roleType.roleTypeId + filteredRoleList = from("ContentRole").where("contentId", forumId, "roleTypeId", roleTypeId).filterByDate().queryList() + cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId) filteredRoleList.each { contentRole -> - partyId = contentRole.partyId; - fromDate = contentRole.fromDate; - map = siteRoleMap.get(partyId); + partyId = contentRole.partyId + fromDate = contentRole.fromDate + map = siteRoleMap.get(partyId) if (!map) { - map = [:]; - map.partyId = partyId; - siteRoleMap.put(partyId, map); + map = [:] + map.partyId = partyId + siteRoleMap.put(partyId, map) } - map.put( cappedBlogRoleName, "Y"); - map.put( cappedBlogRoleName + "FromDate", fromDate); + map.put( cappedBlogRoleName, "Y") + map.put( cappedBlogRoleName + "FromDate", fromDate) } } - siteList = new ArrayList(siteRoleMap.values()); - context.siteList = siteList; - context.rowCount = siteList.size(); - blogRoleList = [] as ArrayList; + siteList = new ArrayList(siteRoleMap.values()) + context.siteList = siteList + context.rowCount = siteList.size() + blogRoleList = [] as ArrayList blogRoles.each { roleType -> - blogRoleList.add(roleType.roleTypeId); + blogRoleList.add(roleType.roleTypeId) } - context.blogRoleIdList = blogRoleList; + context.blogRoleIdList = blogRoleList } Modified: ofbiz/trunk/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/datasetup/DataCategoryPrep.groovy Wed Nov 2 19:09:13 2016 @@ -25,12 +25,12 @@ import org.apache.ofbiz.content.data.Dat * DataCategory picklist. */ -dataCategoryTrail = [] as ArrayList; -rootNode = [:]; -rootNode.id = "ROOT"; -DataResourceWorker.getDataCategoryMap(delegator, 0, rootNode, dataCategoryTrail, true); +dataCategoryTrail = [] as ArrayList +rootNode = [:] +rootNode.id = "ROOT" +DataResourceWorker.getDataCategoryMap(delegator, 0, rootNode, dataCategoryTrail, true) -dataCategoryList = [] as ArrayList; -DataResourceWorker.buildList(rootNode, dataCategoryList, 0); +dataCategoryList = [] as ArrayList +DataResourceWorker.buildList(rootNode, dataCategoryList, 0) -context.dataCategoryList = dataCategoryList; +context.dataCategoryList = dataCategoryList Modified: ofbiz/trunk/applications/content/groovyScripts/layout/EditSubContent.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/layout/EditSubContent.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/layout/EditSubContent.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/layout/EditSubContent.groovy Wed Nov 2 19:09:13 2016 @@ -30,25 +30,25 @@ import freemarker.template.WrappingTempl import javax.servlet.* import javax.servlet.http.* -Locale locale = UtilHttp.getLocale(request); +Locale locale = UtilHttp.getLocale(request) if (currentValue) { - dataResourceId = currentValue.drDataResourceId; - dataResourceTypeId = currentValue.drDataResourceTypeId; + dataResourceId = currentValue.drDataResourceId + dataResourceTypeId = currentValue.drDataResourceTypeId if (dataResourceTypeId) { - mimeTypeId = currentValue.drMimeTypeId; - rootDir = request.getSession().getServletContext().getRealPath("/"); - wrapper = FreeMarkerWorker.getDefaultOfbizWrapper(); - WrappingTemplateModel.setDefaultObjectWrapper(wrapper); - templateRoot = [:]; - FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response); - ctx = [:]; - ctx.rootDir = rootDir; + mimeTypeId = currentValue.drMimeTypeId + rootDir = request.getSession().getServletContext().getRealPath("/") + wrapper = FreeMarkerWorker.getDefaultOfbizWrapper() + WrappingTemplateModel.setDefaultObjectWrapper(wrapper) + templateRoot = [:] + FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response) + ctx = [:] + ctx.rootDir = rootDir // webSiteId and https need to go here, too - templateRoot.context = ctx; - out = new StringWriter(); - currentValue.drDataTemplateTypeId = "NONE"; - DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateRoot, locale, null, false); - textData = out.toString(); - context.textData = textData; + templateRoot.context = ctx + out = new StringWriter() + currentValue.drDataTemplateTypeId = "NONE" + DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateRoot, locale, null, false) + textData = out.toString() + context.textData = textData } } Modified: ofbiz/trunk/applications/content/groovyScripts/print/FindPrinters.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/print/FindPrinters.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/print/FindPrinters.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/print/FindPrinters.groovy Wed Nov 2 19:09:13 2016 @@ -19,6 +19,6 @@ import javax.print.PrintServiceLookup -printServices = PrintServiceLookup.lookupPrintServices(null, null); +printServices = PrintServiceLookup.lookupPrintServices(null, null) printServiceNames = printServices.collect { it.getName() } -context.printers = printServiceNames; +context.printers = printServiceNames Modified: ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy Wed Nov 2 19:09:13 2016 @@ -21,70 +21,70 @@ import org.apache.ofbiz.entity.* import org.apache.ofbiz.entity.condition.* import org.apache.ofbiz.base.util.* -surveyQuestionId = parameters.surveyQuestionId; -context.surveyQuestionId = surveyQuestionId; +surveyQuestionId = parameters.surveyQuestionId +context.surveyQuestionId = surveyQuestionId -surveyQuestion = from("SurveyQuestion").where("surveyQuestionId", surveyQuestionId).queryOne(); +surveyQuestion = from("SurveyQuestion").where("surveyQuestionId", surveyQuestionId).queryOne() -viewIndex = parameters.VIEW_INDEX ? Integer.valueOf(parameters.VIEW_INDEX) : 0; -viewSize = parameters.VIEW_SIZE ? Integer.valueOf(parameters.VIEW_SIZE) : 20; +viewIndex = parameters.VIEW_INDEX ? Integer.valueOf(parameters.VIEW_INDEX) : 0 +viewSize = parameters.VIEW_SIZE ? Integer.valueOf(parameters.VIEW_SIZE) : 20 -int lowIndex = viewIndex * viewSize + 1; -int highIndex = (viewIndex + 1) * viewSize; +int lowIndex = viewIndex * viewSize + 1 +int highIndex = (viewIndex + 1) * viewSize -context.viewIndexFirst = 0; -context.viewIndex = viewIndex; -context.viewIndexPrevious = viewIndex - 1; -context.viewIndexNext = viewIndex + 1; -context.viewSize = viewSize; -context.lowIndex = lowIndex; -int listSize = 0; +context.viewIndexFirst = 0 +context.viewIndex = viewIndex +context.viewIndexPrevious = viewIndex - 1 +context.viewIndexNext = viewIndex + 1 +context.viewSize = viewSize +context.lowIndex = lowIndex +int listSize = 0 -listIt = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").cursorScrollInsensitive().cache(true).queryIterator(); -surveyQuestionAndApplList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1); +listIt = from("SurveyQuestionAndAppl").where("surveyId", surveyId).orderBy("sequenceNum").cursorScrollInsensitive().cache(true).queryIterator() +surveyQuestionAndApplList = listIt.getPartialList(lowIndex, highIndex - lowIndex + 1) -listSize = listIt.getResultsSizeAfterPartialList(); +listSize = listIt.getResultsSizeAfterPartialList() if (listSize < highIndex) { - highIndex = listSize; + highIndex = listSize } -context.viewIndexLast = (int) (listSize / viewSize); -context.highIndex = highIndex; -context.listSize = listSize; -listIt.close(); +context.viewIndexLast = (int) (listSize / viewSize) +context.highIndex = highIndex +context.listSize = listSize +listIt.close() -surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList(); -surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList(); +surveyPageList = from("SurveyPage").where("surveyId", surveyId).orderBy("sequenceNum").queryList() +surveyMultiRespList = from("SurveyMultiResp").where("surveyId", surveyId).orderBy("multiRespTitle").queryList() if (surveyQuestion && surveyQuestion.surveyQuestionTypeId && "OPTION".equals(surveyQuestion.surveyQuestionTypeId)) { // get the options - questionOptions = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId).orderBy("sequenceNum").queryList(); - context.questionOptions = questionOptions; + questionOptions = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId).orderBy("sequenceNum").queryList() + context.questionOptions = questionOptions // survey question option - optionSeqId = parameters.surveyOptionSeqId; - surveyQuestionOption = null; + optionSeqId = parameters.surveyOptionSeqId + surveyQuestionOption = null if (optionSeqId) { - surveyQuestionOption = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId).queryOne(); + surveyQuestionOption = from("SurveyQuestionOption").where("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId).queryOne() } - context.surveyQuestionOption = surveyQuestionOption; + context.surveyQuestionOption = surveyQuestionOption } -surveyQuestionCategoryId = parameters.surveyQuestionCategoryId; -surveyQuestionCategory = null; -categoryQuestions = null; +surveyQuestionCategoryId = parameters.surveyQuestionCategoryId +surveyQuestionCategory = null +categoryQuestions = null if (surveyQuestionCategoryId && "Y".equals(parameters.applyQuestionFromCategory)) { - surveyQuestionCategory = from("SurveyQuestionCategory").where("surveyQuestionCategoryId", surveyQuestionCategoryId).queryOne(); + surveyQuestionCategory = from("SurveyQuestionCategory").where("surveyQuestionCategoryId", surveyQuestionCategoryId).queryOne() if (surveyQuestionCategory) { - categoryQuestions = surveyQuestionCategory.getRelated("SurveyQuestion", null, null, false); + categoryQuestions = surveyQuestionCategory.getRelated("SurveyQuestion", null, null, false) } } -questionCategories = from("SurveyQuestionCategory").orderBy("description").queryList(); -context.surveyQuestion = surveyQuestion; +questionCategories = from("SurveyQuestionCategory").orderBy("description").queryList() +context.surveyQuestion = surveyQuestion -context.surveyQuestionAndApplList = surveyQuestionAndApplList; -context.surveyPageList = surveyPageList; -context.surveyMultiRespList = surveyMultiRespList; -context.surveyQuestionCategory = surveyQuestionCategory; -context.categoryQuestions = categoryQuestions; -context.questionCategories = questionCategories; +context.surveyQuestionAndApplList = surveyQuestionAndApplList +context.surveyPageList = surveyPageList +context.surveyMultiRespList = surveyMultiRespList +context.surveyQuestionCategory = surveyQuestionCategory +context.categoryQuestions = categoryQuestions +context.questionCategories = questionCategories Modified: ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyResponse.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyResponse.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyResponse.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/survey/EditSurveyResponse.groovy Wed Nov 2 19:09:13 2016 @@ -20,21 +20,21 @@ import org.apache.ofbiz.content.survey.* import org.apache.ofbiz.base.util.* -surveyResponseId = parameters.surveyResponseId; -partyId = null; +surveyResponseId = parameters.surveyResponseId +partyId = null if (!surveyId && surveyResponseId) { - surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne(); - surveyId = surveyResponse.surveyId; - context.surveyPartyId = surveyResponse.partyId; - context.surveyId = surveyId; + surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne() + surveyId = surveyResponse.surveyId + context.surveyPartyId = surveyResponse.partyId + context.surveyId = surveyId } -surveyWrapper = new SurveyWrapper(delegator, surveyResponseId, partyId, surveyId, null); -surveyWrapper.setEdit(true); +surveyWrapper = new SurveyWrapper(delegator, surveyResponseId, partyId, surveyId, null) +surveyWrapper.setEdit(true) -templateUrl = UtilURL.fromOfbizHomePath("applications/content/template/survey/GenericSurvey.ftl"); +templateUrl = UtilURL.fromOfbizHomePath("applications/content/template/survey/GenericSurvey.ftl") if (templateUrl) { - writer = new StringWriter(); - surveyWrapper.render(templateUrl, writer); - context.surveyString = writer.toString(); + writer = new StringWriter() + surveyWrapper.render(templateUrl, writer) + context.surveyString = writer.toString() } Modified: ofbiz/trunk/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/survey/ViewSurveyResponses.groovy Wed Nov 2 19:09:13 2016 @@ -17,25 +17,25 @@ * under the License. */ -import org.apache.ofbiz.content.survey.SurveyWrapper; +import org.apache.ofbiz.content.survey.SurveyWrapper if (!survey) { - surveyResponseId = parameters.surveyResponseId; + surveyResponseId = parameters.surveyResponseId if (surveyResponseId) { - surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne(); + surveyResponse = from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne() if (surveyResponse) { - surveyId = surveyResponse.surveyId; + surveyId = surveyResponse.surveyId if (surveyId) { - survey = from("Survey").where("surveyId", surveyId).queryOne(); - context.survey = survey; - context.surveyId = surveyId; + survey = from("Survey").where("surveyId", surveyId).queryOne() + context.survey = survey + context.surveyId = surveyId } } } } if (survey) { - surveyWrapper = new SurveyWrapper(delegator, surveyId); - context.surveyWrapper = surveyWrapper; - context.sequenceSort = ['sequenceNum']; + surveyWrapper = new SurveyWrapper(delegator, surveyId) + context.surveyWrapper = surveyWrapper + context.sequenceSort = ['sequenceNum'] } Modified: ofbiz/trunk/applications/content/groovyScripts/website/EditWebSiteParties.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/website/EditWebSiteParties.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/website/EditWebSiteParties.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/website/EditWebSiteParties.groovy Wed Nov 2 19:09:13 2016 @@ -17,16 +17,16 @@ * under the License. */ -webSiteRoleDatas = [] as LinkedList; +webSiteRoleDatas = [] as LinkedList if (webSite) { - webSiteRoles = webSite.getRelated("WebSiteRole", null, ['sequenceNum', 'partyId'], false); + webSiteRoles = webSite.getRelated("WebSiteRole", null, ['sequenceNum', 'partyId'], false) webSiteRoles.each { webSiteRole -> - Map webSiteRoleData = [:]; - webSiteRoleData.webSiteRole = webSiteRole; - webSiteRoleData.person = webSiteRole.getRelatedOne("Person", false); - webSiteRoleData.partyGroup = webSiteRole.getRelatedOne("PartyGroup", false); - webSiteRoleData.roleType = webSiteRole.getRelatedOne("RoleType", true); - webSiteRoleDatas.add(webSiteRoleData); + Map webSiteRoleData = [:] + webSiteRoleData.webSiteRole = webSiteRole + webSiteRoleData.person = webSiteRole.getRelatedOne("Person", false) + webSiteRoleData.partyGroup = webSiteRole.getRelatedOne("PartyGroup", false) + webSiteRoleData.roleType = webSiteRole.getRelatedOne("RoleType", true) + webSiteRoleDatas.add(webSiteRoleData) } } -context.webSiteRoleDatas = webSiteRoleDatas; +context.webSiteRoleDatas = webSiteRoleDatas Modified: ofbiz/trunk/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/website/WebSiteCMSMetaInfo.groovy Wed Nov 2 19:09:13 2016 @@ -23,31 +23,31 @@ import org.apache.ofbiz.entity.util.* if (content) { // lookup assoc content - title = from("ContentAssoc").where("contentId", contentId, "mapKey", "title").orderBy("-fromDate").filterByDate().queryFirst(); + title = from("ContentAssoc").where("contentId", contentId, "mapKey", "title").orderBy("-fromDate").filterByDate().queryFirst() if (title) { - tc = title.getRelatedOne("ToContent", false); - tcdr = tc.getRelatedOne("DataResource", false); - context.title = tcdr; + tc = title.getRelatedOne("ToContent", false) + tcdr = tc.getRelatedOne("DataResource", false) + context.title = tcdr } - titleProp = from("ContentAssoc").where("contentId", contentId, "mapKey", "titleProperty").orderBy("-fromDate").filterByDate().queryFirst(); + titleProp = from("ContentAssoc").where("contentId", contentId, "mapKey", "titleProperty").orderBy("-fromDate").filterByDate().queryFirst() if (titleProp) { - tpc = titleProp.getRelatedOne("ToContent", false); - tpcdr = tpc.getRelatedOne("DataResource", false); - context.titleProperty = tpcdr; + tpc = titleProp.getRelatedOne("ToContent", false) + tpcdr = tpc.getRelatedOne("DataResource", false) + context.titleProperty = tpcdr } - metaDesc = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaDescription").orderBy("-fromDate").filterByDate().queryFirst(); + metaDesc = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaDescription").orderBy("-fromDate").filterByDate().queryFirst() if (metaDesc) { - mdc = metaDesc.getRelatedOne("ToContent", false); - mdcdr = mdc.getRelatedOne("DataResource", false); - context.metaDescription = mdcdr; + mdc = metaDesc.getRelatedOne("ToContent", false) + mdcdr = mdc.getRelatedOne("DataResource", false) + context.metaDescription = mdcdr } - metaKey = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaKeywords").orderBy("-fromDate").filterByDate().queryFirst(); + metaKey = from("ContentAssoc").where("contentId", contentId, "mapKey", "metaKeywords").orderBy("-fromDate").filterByDate().queryFirst() if (metaKey) { - mkc = metaKey.getRelatedOne("ToContent", false); - mkcdr = mkc.getRelatedOne("DataResource", false); - context.metaKeywords = mkcdr; + mkc = metaKey.getRelatedOne("ToContent", false) + mkcdr = mkc.getRelatedOne("DataResource", false) + context.metaKeywords = mkcdr } } Modified: ofbiz/trunk/applications/content/groovyScripts/website/WebSitePublishPoint.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/groovyScripts/website/WebSitePublishPoint.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/content/groovyScripts/website/WebSitePublishPoint.groovy (original) +++ ofbiz/trunk/applications/content/groovyScripts/website/WebSitePublishPoint.groovy Wed Nov 2 19:09:13 2016 @@ -20,26 +20,26 @@ import org.apache.ofbiz.entity.condition.* import org.apache.ofbiz.entity.util.* -webSiteContent = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT").orderBy("-fromDate").cache().filterByDate().queryFirst(); +webSiteContent = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT").orderBy("-fromDate").cache().filterByDate().queryFirst() if (webSiteContent) { - content = webSiteContent.getRelatedOne("Content", false); - contentRoot = content.contentId; - context.content = content; - context.contentRoot = contentRoot; + content = webSiteContent.getRelatedOne("Content", false) + contentRoot = content.contentId + context.content = content + context.contentRoot = contentRoot } -webSiteMenu = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT").orderBy("-fromDate").cache().queryFirst(); +webSiteMenu = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT").orderBy("-fromDate").cache().queryFirst() if (webSiteMenu) { - menu = webSiteMenu.getRelatedOne("Content", false); - menuRoot = menu.contentId; - context.menu = menu; - context.menuRoot = menuRoot; + menu = webSiteMenu.getRelatedOne("Content", false) + menuRoot = menu.contentId + context.menu = menu + context.menuRoot = menuRoot } -webSiteError = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "ERROR_ROOT").orderBy("-fromDate").cache().queryFirst(); +webSiteError = from("WebSiteContent").where("webSiteId", webSiteId, "webSiteContentTypeId", "ERROR_ROOT").orderBy("-fromDate").cache().queryFirst() if (webSiteError) { - error = webSiteError.getRelatedOne("Content", false); - errorRoot = error.contentId; - context.error = error; - context.errorRoot = errorRoot; + error = webSiteError.getRelatedOne("Content", false) + errorRoot = error.contentId + context.error = error + context.errorRoot = errorRoot } Modified: ofbiz/trunk/applications/humanres/groovyScripts/category/CategoryTree.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/humanres/groovyScripts/category/CategoryTree.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/humanres/groovyScripts/category/CategoryTree.groovy (original) +++ ofbiz/trunk/applications/humanres/groovyScripts/category/CategoryTree.groovy Wed Nov 2 19:09:13 2016 @@ -21,39 +21,39 @@ * This script is also referenced by the ecommerce's screens and * should not contain order component's specific code. */ -import org.apache.ofbiz.party.party.PartyHelper; +import org.apache.ofbiz.party.party.PartyHelper // Put the result of CategoryWorker.getRelatedCategories into the separateRootType function as attribute. // The separateRootType function will return the list of category of given catalog. // PLEASE NOTE : The structure of the list of separateRootType function is according to the JSON_DATA plugin of the jsTree. -completedTree = []; -completedTreeContext = []; -subtopLists = []; +completedTree = [] +completedTreeContext = [] +subtopLists = [] //internalOrg list -partyRelationships = from("PartyRelationship").where("partyIdFrom", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").filterByDate().queryList(); +partyRelationships = from("PartyRelationship").where("partyIdFrom", partyId, "partyRelationshipTypeId", "GROUP_ROLLUP").filterByDate().queryList() if (partyRelationships) { //root - partyRoot = from("PartyGroup").where("partyId", partyId).queryOne(); - partyRootMap = [:]; - partyRootMap.put("partyId", partyId); - partyRootMap.put("groupName", partyRoot.getString("groupName")); + partyRoot = from("PartyGroup").where("partyId", partyId).queryOne() + partyRootMap = [:] + partyRootMap.put("partyId", partyId) + partyRootMap.put("groupName", partyRoot.getString("groupName")) //child for(partyRelationship in partyRelationships) { - partyGroupMap = [:]; - partyGroupMap.put("partyId", partyRelationship.getString("partyIdTo")); - partyGroupMap.put("groupName", PartyHelper.getPartyName(delegator, partyRelationship.getString("partyIdTo"), false)); - completedTreeContext.add(partyGroupMap); + partyGroupMap = [:] + partyGroupMap.put("partyId", partyRelationship.getString("partyIdTo")) + partyGroupMap.put("groupName", PartyHelper.getPartyName(delegator, partyRelationship.getString("partyIdTo"), false)) + completedTreeContext.add(partyGroupMap) - subtopLists.addAll(partyRelationship.getString("partyIdTo")); + subtopLists.addAll(partyRelationship.getString("partyIdTo")) } - partyRootMap.put("child", completedTreeContext); - completedTree.add(partyRootMap); + partyRootMap.put("child", completedTreeContext) + completedTree.add(partyRootMap) } // The complete tree list for the category tree -context.completedTree = completedTree; -context.subtopLists = subtopLists; +context.completedTree = completedTree +context.subtopLists = subtopLists Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy Wed Nov 2 19:09:13 2016 @@ -17,52 +17,52 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.manufacturing.bom.BOMNode; +import org.apache.ofbiz.base.util.Debug +import org.apache.ofbiz.manufacturing.bom.BOMNode -tree = request.getAttribute("tree"); -currencyUomId = parameters.currencyUomId; -facilityId = parameters.facilityId; +tree = request.getAttribute("tree") +currencyUomId = parameters.currencyUomId +facilityId = parameters.facilityId if (tree) { - treeArray = []; - treeQty = [:]; + treeArray = [] + treeQty = [:] - tree.print(treeArray); - tree.sumQuantities(treeQty); + tree.print(treeArray) + tree.sumQuantities(treeQty) - context.tree = treeArray; - Iterator treeQtyIt = treeQty.values().iterator(); - productsData = []; - grandTotalCost = 0.0; + context.tree = treeArray + Iterator treeQtyIt = treeQty.values().iterator() + productsData = [] + grandTotalCost = 0.0 while (treeQtyIt) { - BOMNode node = (BOMNode)treeQtyIt.next(); - unitCost = null; - totalCost = null; - qoh = null; + BOMNode node = (BOMNode)treeQtyIt.next() + unitCost = null + totalCost = null + qoh = null // The standard cost is retrieved try { - outMap = [:]; + outMap = [:] if (currencyUomId) { outMap = runService('getProductCost', [productId : node.getProduct().productId, currencyUomId : currencyUomId, costComponentTypePrefix : "EST_STD", - userLogin : userLogin]); - unitCost = outMap.productCost; - totalCost = unitCost * node.getQuantity(); - grandTotalCost = grandTotalCost + totalCost ?: 0; + userLogin : userLogin]) + unitCost = outMap.productCost + totalCost = unitCost * node.getQuantity() + grandTotalCost = grandTotalCost + totalCost ?: 0 } if (facilityId) { outMap = runService('getInventoryAvailableByFacility', [productId : node.getProduct().productId, facilityId : facilityId, - userLogin : userLogin]); - qoh = outMap.quantityOnHandTotal; + userLogin : userLogin]) + qoh = outMap.quantityOnHandTotal } } catch (Exception e) { - Debug.logError("Error retrieving bom simulation data: " + e.getMessage(), "BomSimulation"); + Debug.logError("Error retrieving bom simulation data: " + e.getMessage(), "BomSimulation") } - productsData.add([node : node, unitCost : unitCost, totalCost : totalCost, qoh : qoh]); + productsData.add([node : node, unitCost : unitCost, totalCost : totalCost, qoh : qoh]) } - context.productsData = productsData; - context.grandTotalCost = grandTotalCost; + context.productsData = productsData + context.grandTotalCost = grandTotalCost } Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/bom/EditProductBom.groovy Wed Nov 2 19:09:13 2016 @@ -17,58 +17,58 @@ * under the License. */ -import java.sql.Timestamp; -import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.base.util.UtilDateTime; +import java.sql.Timestamp +import org.apache.ofbiz.base.util.UtilHttp +import org.apache.ofbiz.base.util.UtilDateTime -context.nowDate = UtilDateTime.nowDate(); -context.nowTimestampString = UtilHttp.encodeBlanks(UtilDateTime.nowTimestamp().toString()); +context.nowDate = UtilDateTime.nowDate() +context.nowTimestampString = UtilHttp.encodeBlanks(UtilDateTime.nowTimestamp().toString()) -boolean useValues = true; -if (request.getAttribute("_ERROR_MESSAGE_")) useValues = false; +boolean useValues = true +if (request.getAttribute("_ERROR_MESSAGE_")) useValues = false -productId = parameters.productId; -if (productId) context.productId = productId; +productId = parameters.productId +if (productId) context.productId = productId -productIdTo = parameters.productIdTo; -updateMode = parameters.UPDATE_MODE; +productIdTo = parameters.productIdTo +updateMode = parameters.UPDATE_MODE -if (productIdTo) context.productIdTo = productIdTo; +if (productIdTo) context.productIdTo = productIdTo -productAssocTypeId = parameters.productAssocTypeId; -if (productAssocTypeId) context.productAssocTypeId = productAssocTypeId; +productAssocTypeId = parameters.productAssocTypeId +if (productAssocTypeId) context.productAssocTypeId = productAssocTypeId -fromDateStr = parameters.fromDate; +fromDateStr = parameters.fromDate -Timestamp fromDate = null; -if (fromDateStr) fromDate = Timestamp.valueOf(fromDateStr) ?: (Timestamp)request.getAttribute("ProductAssocCreateFromDate");; -context.fromDate = fromDate; +Timestamp fromDate = null +if (fromDateStr) fromDate = Timestamp.valueOf(fromDateStr) ?: (Timestamp)request.getAttribute("ProductAssocCreateFromDate") +context.fromDate = fromDate -productAssoc = from("ProductAssoc").where("productId", productId, "productIdTo", productIdTo, "productAssocTypeId", productAssocTypeId, "fromDate", fromDate).queryOne(); +productAssoc = from("ProductAssoc").where("productId", productId, "productIdTo", productIdTo, "productAssocTypeId", productAssocTypeId, "fromDate", fromDate).queryOne() if (updateMode) { - productAssoc = [:]; - context.remove("productIdTo"); + productAssoc = [:] + context.remove("productIdTo") } if (productAssoc) { - context.productAssoc = productAssoc; + context.productAssoc = productAssoc } -if ("true".equalsIgnoreCase((String)request.getParameter("useValues"))) useValues = true; -if (!productAssoc) useValues = false; +if ("true".equalsIgnoreCase((String)request.getParameter("useValues"))) useValues = true +if (!productAssoc) useValues = false -context.useValues = useValues; +context.useValues = useValues -Collection assocTypes = from("ProductAssocType").where("parentTypeId", "PRODUCT_COMPONENT").orderBy("productAssocTypeId", "description").queryList(); -context.assocTypes = assocTypes; +Collection assocTypes = from("ProductAssocType").where("parentTypeId", "PRODUCT_COMPONENT").orderBy("productAssocTypeId", "description").queryList() +context.assocTypes = assocTypes -Collection formulae = from("CustomMethod").where("customMethodTypeId", "BOM_FORMULA").orderBy("customMethodId", "description").queryList(); -context.formulae = formulae; +Collection formulae = from("CustomMethod").where("customMethodTypeId", "BOM_FORMULA").orderBy("customMethodId", "description").queryList() +context.formulae = formulae if (product) { - assocFromProducts = product.getRelated("MainProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false); - if (assocFromProducts) context.assocFromProducts = assocFromProducts; + assocFromProducts = product.getRelated("MainProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false) + if (assocFromProducts) context.assocFromProducts = assocFromProducts - assocToProducts = product.getRelated("AssocProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false); - if (assocToProducts) context.assocToProducts = assocToProducts; + assocToProducts = product.getRelated("AssocProductAssoc", (productAssocTypeId ? [productAssocTypeId : productAssocTypeId]: [:]), ["sequenceNum","productId"], false) + if (assocToProducts) context.assocToProducts = assocToProducts } Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/bom/FindProductBom.groovy Wed Nov 2 19:09:13 2016 @@ -17,26 +17,26 @@ * under the License. */ -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.condition.*; +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.* -condList = []; +condList = [] if (parameters.productId) { - cond = EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId); - condList.add(cond); + cond = EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parameters.productId) + condList.add(cond) } if (parameters.productIdTo) { - cond = EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, parameters.productIdTo); - condList.add(cond); + cond = EntityCondition.makeCondition("productIdTo", EntityOperator.EQUALS, parameters.productIdTo) + condList.add(cond) } if (parameters.productAssocTypeId) { - cond = EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, parameters.productAssocTypeId); - condList.add(cond); + cond = EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, parameters.productAssocTypeId) + condList.add(cond) } else { cond = EntityCondition.makeCondition([EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "ENGINEER_COMPONENT"), EntityCondition.makeCondition("productAssocTypeId", EntityOperator.EQUALS, "MANUF_COMPONENT") - ], EntityOperator.OR); - condList.add(cond); + ], EntityOperator.OR) + condList.add(cond) } bomListIterator = select("productId", "internalName", "productAssocTypeId") .from("ProductAndAssoc") @@ -44,6 +44,6 @@ bomListIterator = select("productId", "i .orderBy("productId", "productAssocTypeId") .cursorScrollInsensitive() .cache(true) - .queryIterator(); + .queryIterator() -context.ListProductBom = bomListIterator; +context.ListProductBom = bomListIterator Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunActualComponents.groovy Wed Nov 2 19:09:13 2016 @@ -17,12 +17,12 @@ * under the License. */ -productionRunId = parameters.productionRunId ?: parameters.workEffortId; +productionRunId = parameters.productionRunId ?: parameters.workEffortId -taskInfos = []; -tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList(); +taskInfos = [] +tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList() tasks.each { task -> - records = from("InventoryItemDetail").where("workEffortId", task.workEffortId).queryList(); - taskInfos.add([task : task, records : records]); + records = from("InventoryItemDetail").where("workEffortId", task.workEffortId).queryList() + taskInfos.add([task : task, records : records]) } -context.taskInfos = taskInfos; +context.taskInfos = taskInfos Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunAllFixedAssets.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun; +import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun -productionRunId = parameters.productionRunId ?: parameters.workEffortId; +productionRunId = parameters.productionRunId ?: parameters.workEffortId if (productionRunId) { - ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); + ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher) if (productionRun.exist()) { - productionRunFixedAssetsData = []; - productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks(); + productionRunFixedAssetsData = [] + productionRunRoutingTasks = productionRun.getProductionRunRoutingTasks() productionRunRoutingTasks.each { prodRunTask -> - taskFixedAssets = prodRunTask.getRelated("WorkEffortFixedAssetAssign", null, null, false); - productionRunFixedAssetsData.addAll(taskFixedAssets); + taskFixedAssets = prodRunTask.getRelated("WorkEffortFixedAssetAssign", null, null, false) + productionRunFixedAssetsData.addAll(taskFixedAssets) } - context.productionRunFixedAssetsData = productionRunFixedAssetsData; + context.productionRunFixedAssetsData = productionRunFixedAssetsData } } Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunComponents.groovy Wed Nov 2 19:09:13 2016 @@ -17,12 +17,12 @@ * under the License. */ -productionRunId = parameters.productionRunId ?: parameters.workEffortId; +productionRunId = parameters.productionRunId ?: parameters.workEffortId -taskInfos = []; -tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList(); +taskInfos = [] +tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList() tasks.each { task -> - records = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId).queryList(); - taskInfos.add([task : task, records : records]); + records = from("WorkEffortGoodStandard").where("workEffortId", task.workEffortId).queryList() + taskInfos.add([task : task, records : records]) } -context.taskInfos = taskInfos; +context.taskInfos = taskInfos Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunContent.groovy Wed Nov 2 19:09:13 2016 @@ -17,29 +17,29 @@ * under the License. */ -import org.apache.ofbiz.content.content.ContentWorker; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.entity.GenericValue; +import org.apache.ofbiz.content.content.ContentWorker +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.entity.GenericValue -productionRunId = parameters.productionRunId ?: parameters.workEffortId; -context.productionRunId = productionRunId; +productionRunId = parameters.productionRunId ?: parameters.workEffortId +context.productionRunId = productionRunId -delivGoodStandard = from("WorkEffortGoodStandard").where("workEffortId", productionRunId, "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED").orderBy("-fromDate").queryFirst(); +delivGoodStandard = from("WorkEffortGoodStandard").where("workEffortId", productionRunId, "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED").orderBy("-fromDate").queryFirst() if (delivGoodStandard) { - context.delivProductId = delivGoodStandard.productId; + context.delivProductId = delivGoodStandard.productId } if (context.delivProductId && (parameters.partyId || parameters.contentLocale)) { - delivProductContents = from("ProductContentAndInfo").where("productId", context.delivProductId).orderBy("-fromDate").filterByDate().queryList(); - context.delivProductContents = delivProductContents; + delivProductContents = from("ProductContentAndInfo").where("productId", context.delivProductId).orderBy("-fromDate").filterByDate().queryList() + context.delivProductContents = delivProductContents - Locale contentLocale = null; + Locale contentLocale = null if (parameters.contentLocale) { - contentLocale = new Locale(parameters.contentLocale); + contentLocale = new Locale(parameters.contentLocale) } - delivProductContentsForLocaleAndUser = []; + delivProductContentsForLocaleAndUser = [] delivProductContents.each { delivProductContent -> - GenericValue content = ContentWorker.findContentForRendering(delegator, delivProductContent.contentId, contentLocale, parameters.partyId, parameters.roleTypeId, true); - delivProductContentsForLocaleAndUser.add(from("ContentDataResourceView").where("contentId", content.contentId).queryFirst()); + GenericValue content = ContentWorker.findContentForRendering(delegator, delivProductContent.contentId, contentLocale, parameters.partyId, parameters.roleTypeId, true) + delivProductContentsForLocaleAndUser.add(from("ContentDataResourceView").where("contentId", content.contentId).queryFirst()) } - context.delivProductContentsForLocaleAndUser = delivProductContentsForLocaleAndUser; + context.delivProductContentsForLocaleAndUser = delivProductContentsForLocaleAndUser } Modified: ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy (original) +++ ofbiz/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunCosts.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.util.EntityUtil -productionRunId = parameters.productionRunId ?: parameters.workEffortId; -taskInfoList = []; -tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList(); +productionRunId = parameters.productionRunId ?: parameters.workEffortId +taskInfoList = [] +tasks = from("WorkEffort").where("workEffortParentId", productionRunId, "workEffortTypeId", "PROD_ORDER_TASK").orderBy("workEffortId").queryList() tasks.each { task -> - costs = from("CostComponent").where("workEffortId", task.workEffortId).filterByDate().queryList(); - taskInfoList.add([task : task, taskCosts : costs]); + costs = from("CostComponent").where("workEffortId", task.workEffortId).filterByDate().queryList() + taskInfoList.add([task : task, taskCosts : costs]) } // get the costs directly associated to the production run (e.g. overhead costs) -productionRun = from("WorkEffort").where("workEffortId", productionRunId).cache(true).queryOne(); -costs = from("CostComponent").where("workEffortId", productionRunId).filterByDate().queryList(); -taskInfoList.add([task : productionRun, taskCosts : costs]); +productionRun = from("WorkEffort").where("workEffortId", productionRunId).cache(true).queryOne() +costs = from("CostComponent").where("workEffortId", productionRunId).filterByDate().queryList() +taskInfoList.add([task : productionRun, taskCosts : costs]) context.taskInfoList = taskInfoList; \ No newline at end of file |
Free forum by Nabble | Edit this page |