Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java Sun Aug 3 20:00:54 2008 @@ -20,6 +20,9 @@ import java.util.*; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.w3c.dom.*; import org.ofbiz.base.util.*; import org.ofbiz.minilang.*; @@ -33,9 +36,9 @@ String xmlResource; String processorName; - ContextAccessor inMapAcsr; - ContextAccessor outMapAcsr; - ContextAccessor errorListAcsr; + ContextAccessor<Map<String, Object>> inMapAcsr; + ContextAccessor<Map<String, Object>> outMapAcsr; + ContextAccessor<List<Object>> errorListAcsr; MapProcessor inlineMapProcessor = null; @@ -43,9 +46,9 @@ super(element, simpleMethod); xmlResource = element.getAttribute("xml-resource"); processorName = element.getAttribute("processor-name"); - inMapAcsr = new ContextAccessor(element.getAttribute("in-map-name")); - outMapAcsr = new ContextAccessor(element.getAttribute("out-map-name")); - errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list"); + inMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("in-map-name")); + outMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("out-map-name")); + errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list"); Element simpleMapProcessorElement = UtilXml.firstChildElement(element, "simple-map-processor"); if (simpleMapProcessorElement != null) { @@ -54,21 +57,21 @@ } public boolean exec(MethodContext methodContext) { - List messages = (List) errorListAcsr.get(methodContext); + List<Object> messages = errorListAcsr.get(methodContext); if (messages == null) { - messages = new LinkedList(); + messages = FastList.newInstance(); errorListAcsr.put(methodContext, messages); } - Map inMap = (Map) inMapAcsr.get(methodContext); + Map<String, Object> inMap = inMapAcsr.get(methodContext); if (inMap == null) { - inMap = new HashMap(); + inMap = FastMap.newInstance(); inMapAcsr.put(methodContext, inMap); } - Map outMap = (Map) outMapAcsr.get(methodContext); + Map<String, Object> outMap = outMapAcsr.get(methodContext); if (outMap == null) { - outMap = new HashMap(); + outMap = FastMap.newInstance(); outMapAcsr.put(methodContext, outMap); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallSimpleMethod.java Sun Aug 3 20:00:54 2008 @@ -114,8 +114,8 @@ if (xmlResource == null || xmlResource.length() == 0) { simpleMethodToCall = this.simpleMethod.getSimpleMethodInSameFile(methodName); } else { - Map simpleMethods = SimpleMethod.getSimpleMethods(xmlResource, loader); - simpleMethodToCall = (SimpleMethod) simpleMethods.get(methodName); + Map<String, SimpleMethod> simpleMethods = SimpleMethod.getSimpleMethods(xmlResource, loader); + simpleMethodToCall = simpleMethods.get(methodName); } return simpleMethodToCall; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CheckErrors.java Sun Aug 3 20:00:54 2008 @@ -32,7 +32,7 @@ */ public class CheckErrors extends MethodOperation { - ContextAccessor errorListAcsr; + ContextAccessor<List<Object>> errorListAcsr; String errorCode; FlexibleMessage errorPrefix; @@ -45,7 +45,7 @@ errorCode = element.getAttribute("error-code"); if (errorCode == null || errorCode.length() == 0) errorCode = "error"; - errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list"); + errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list"); errorPrefix = new FlexibleMessage(UtilXml.firstChildElement(element, "error-prefix"), "check.error.prefix"); errorSuffix = new FlexibleMessage(UtilXml.firstChildElement(element, "error-suffix"), "check.error.suffix"); @@ -54,7 +54,7 @@ } public boolean exec(MethodContext methodContext) { - List messages = (List) errorListAcsr.get(methodContext); + List<Object> messages = errorListAcsr.get(methodContext); if (messages != null && messages.size() > 0) { String errorCode = methodContext.expandString(this.errorCode); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CreateObject.java Sun Aug 3 20:00:54 2008 @@ -21,6 +21,9 @@ import java.lang.reflect.*; import java.util.*; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.w3c.dom.*; import org.ofbiz.base.util.*; @@ -35,30 +38,27 @@ public static final String module = CreateObject.class.getName(); String className; - ContextAccessor fieldAcsr; - ContextAccessor mapAcsr; + ContextAccessor<Object> fieldAcsr; + ContextAccessor<Map<String, Object>> mapAcsr; /** A list of MethodObject objects to use as the method call parameters */ - List parameters; + List<MethodObject<?>> parameters; public CreateObject(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); className = element.getAttribute("class-name"); - fieldAcsr = new ContextAccessor(element.getAttribute("field-name")); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); + fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); + mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name")); - List parameterElements = UtilXml.childElementList(element); + List<? extends Element> parameterElements = UtilXml.childElementList(element); if (parameterElements.size() > 0) { - parameters = new ArrayList(parameterElements.size()); - - Iterator parameterIter = parameterElements.iterator(); - while (parameterIter.hasNext()) { - Element parameterElement = (Element) parameterIter.next(); + parameters = FastList.newInstance(); + for (Element parameterElement: parameterElements) { MethodObject methodObject = null; if ("string".equals(parameterElement.getNodeName())) { methodObject = new StringObject(parameterElement, simpleMethod); } else if ("field".equals(parameterElement.getNodeName())) { - methodObject = new FieldObject(parameterElement, simpleMethod); + methodObject = new FieldObject<Object>(parameterElement, simpleMethod); } else { //whoops, invalid tag here, print warning Debug.logWarning("Found an unsupported tag under the call-object-method tag: " + parameterElement.getNodeName() + "; ignoring", module); @@ -73,7 +73,7 @@ public boolean exec(MethodContext methodContext) { String className = methodContext.expandString(this.className); - Class methodClass = null; + Class<?> methodClass = null; try { methodClass = ObjectType.loadClass(className, methodContext.getLoader()); } catch (ClassNotFoundException e) { @@ -85,18 +85,16 @@ } Object[] args = null; - Class[] parameterTypes = null; + Class<?>[] parameterTypes = null; if (parameters != null) { args = new Object[parameters.size()]; - parameterTypes = new Class[parameters.size()]; + parameterTypes = new Class<?>[parameters.size()]; - Iterator parameterIter = parameters.iterator(); int i = 0; - while (parameterIter.hasNext()) { - MethodObject methodObjectDef = (MethodObject) parameterIter.next(); + for (MethodObject methodObjectDef: parameters) { args[i] = methodObjectDef.getObject(methodContext); - Class typeClass = methodObjectDef.getTypeClass(methodContext.getLoader()); + Class<?> typeClass = methodObjectDef.getTypeClass(methodContext.getLoader()); if (typeClass == null) { String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [Parameter type not found with name " + methodObjectDef.getTypeName() + "]"; Debug.logError(errMsg, module); @@ -117,10 +115,10 @@ //if fieldAcsr is empty, ignore return value if (!fieldAcsr.isEmpty()) { if (!mapAcsr.isEmpty()) { - Map retMap = (Map) mapAcsr.get(methodContext); + Map<String, Object> retMap = mapAcsr.get(methodContext); if (retMap == null) { - retMap = new HashMap(); + retMap = FastMap.newInstance(); mapAcsr.put(methodContext, retMap); } fieldAcsr.put(retMap, newObject, methodContext); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/SetServiceFields.java Sun Aug 3 20:00:54 2008 @@ -18,13 +18,13 @@ *******************************************************************************/ package org.ofbiz.minilang.method.callops; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import javolution.util.FastList; +import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; @@ -48,20 +48,20 @@ public static final String module = CallService.class.getName(); String serviceName; - ContextAccessor mapAcsr; - ContextAccessor toMapAcsr; - ContextAccessor errorListAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<Map<String, Object>> toMapAcsr; + ContextAccessor<List<Object>> errorListAcsr; public SetServiceFields(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); serviceName = element.getAttribute("service-name"); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - toMapAcsr = new ContextAccessor(element.getAttribute("to-map-name")); - errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list"); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + toMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("to-map-name")); + errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list"); } public boolean exec(MethodContext methodContext) { - List messages = (List) errorListAcsr.get(methodContext); + List<Object> messages = errorListAcsr.get(methodContext); if (messages == null) { messages = FastList.newInstance(); errorListAcsr.put(methodContext, messages); @@ -69,15 +69,15 @@ String serviceName = methodContext.expandString(this.serviceName); - Map fromMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext); if (fromMap == null) { Debug.logWarning("The from map in set-service-field was not found with name: " + mapAcsr, module); return true; } - Map toMap = (Map) toMapAcsr.get(methodContext); + Map<String, Object> toMap = toMapAcsr.get(methodContext); if (toMap == null) { - toMap = new HashMap(); + toMap = FastMap.newInstance(); toMapAcsr.put(methodContext, toMap); } @@ -91,10 +91,7 @@ methodContext.setErrorReturn(errMsg, simpleMethod); return false; } - Iterator inModelParamIter = modelService.getInModelParamList().iterator(); - while (inModelParamIter.hasNext()) { - ModelParam modelParam = (ModelParam) inModelParamIter.next(); - + for (ModelParam modelParam: modelService.getInModelParamList()) { if (fromMap.containsKey(modelParam.name)) { Object value = fromMap.get(modelParam.name); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Assert.java Sun Aug 3 20:00:54 2008 @@ -39,28 +39,25 @@ public static final String module = Assert.class.getName(); - protected ContextAccessor errorListAcsr; + protected ContextAccessor<List<Object>> errorListAcsr; protected FlexibleStringExpander titleExdr; /** List of Conditional objects */ - protected List conditionalList = FastList.newInstance(); + protected List<Conditional> conditionalList = FastList.newInstance(); public Assert(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list"); + errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list"); titleExdr = new FlexibleStringExpander(element.getAttribute("title")); - List conditionalElementList = UtilXml.childElementList(element); - Iterator conditionalElementIter = conditionalElementList.iterator(); - while (conditionalElementIter.hasNext()) { - Element conditionalElement = (Element) conditionalElementIter.next(); + for (Element conditionalElement: UtilXml.childElementList(element)) { this.conditionalList.add(ConditionalFactory.makeConditional(conditionalElement, simpleMethod)); } } public boolean exec(MethodContext methodContext) { - List messages = (List) errorListAcsr.get(methodContext); + List<Object> messages = errorListAcsr.get(methodContext); if (messages == null) { messages = FastList.newInstance(); errorListAcsr.put(methodContext, messages); @@ -69,14 +66,12 @@ String title = this.titleExdr.expandString(methodContext.getEnvMap()); // check each conditional and if fails generate a message to add to the error list - Iterator conditionalIter = conditionalList.iterator(); - while (conditionalIter.hasNext()) { - Conditional condition = (Conditional) conditionalIter.next(); + for (Conditional condition: conditionalList) { boolean conditionTrue = condition.checkCondition(methodContext); if (!conditionTrue) { // pretty print condition - StringBuffer messageBuffer = new StringBuffer(); + StringBuilder messageBuffer = new StringBuilder(); messageBuffer.append("Assertion "); if (UtilValidate.isNotEmpty(title)) { messageBuffer.append("["); @@ -99,7 +94,7 @@ public String expandedString(MethodContext methodContext) { String title = this.titleExdr.expandString(methodContext.getEnvMap()); - StringBuffer messageBuf = new StringBuffer(); + StringBuilder messageBuf = new StringBuilder(); messageBuf.append("<assert"); if (UtilValidate.isNotEmpty(title)) { messageBuf.append(" title=\""); @@ -107,9 +102,7 @@ messageBuf.append("\""); } messageBuf.append(">"); - Iterator conditionalIter = conditionalList.iterator(); - while (conditionalIter.hasNext()) { - Conditional condition = (Conditional) conditionalIter.next(); + for (Conditional condition: conditionalList) { condition.prettyPrint(messageBuf, methodContext); } messageBuf.append("</assert>"); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CombinedCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CombinedCondition.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CombinedCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CombinedCondition.java Sun Aug 3 20:00:54 2008 @@ -19,6 +19,7 @@ package org.ofbiz.minilang.method.conditional; import java.util.*; +import javolution.util.FastList; import org.w3c.dom.*; import org.ofbiz.base.util.*; import org.ofbiz.minilang.*; @@ -36,15 +37,12 @@ SimpleMethod simpleMethod; int conditionType; - List subConditions = new LinkedList(); + List<Conditional> subConditions = FastList.newInstance(); public CombinedCondition(Element element, int conditionType, SimpleMethod simpleMethod) { this.simpleMethod = simpleMethod; this.conditionType = conditionType; - List subElements = UtilXml.childElementList(element); - Iterator subElIter = subElements.iterator(); - while (subElIter.hasNext()) { - Element subElement = (Element) subElIter.next(); + for (Element subElement: UtilXml.childElementList(element)) { subConditions.add(ConditionalFactory.makeConditional(subElement, simpleMethod)); } } @@ -52,11 +50,11 @@ public boolean checkCondition(MethodContext methodContext) { if (subConditions.size() == 0) return true; - Iterator subCondIter = subConditions.iterator(); + Iterator<Conditional> subCondIter = subConditions.iterator(); switch (this.conditionType) { case OR: while (subCondIter.hasNext()) { - Conditional subCond = (Conditional) subCondIter.next(); + Conditional subCond = subCondIter.next(); if (subCond.checkCondition(methodContext)) { return true; } @@ -65,7 +63,7 @@ case XOR: boolean trueFound = false; while (subCondIter.hasNext()) { - Conditional subCond = (Conditional) subCondIter.next(); + Conditional subCond = subCondIter.next(); if (subCond.checkCondition(methodContext)) { if (trueFound) { return false; @@ -77,25 +75,25 @@ return trueFound; case AND: while (subCondIter.hasNext()) { - Conditional subCond = (Conditional) subCondIter.next(); + Conditional subCond = subCondIter.next(); if (!subCond.checkCondition(methodContext)) { return false; } } return true; case NOT: - Conditional subCond = (Conditional) subCondIter.next(); + Conditional subCond = subCondIter.next(); return !subCond.checkCondition(methodContext); default: return false; } } - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext) { + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext) { messageBuffer.append("("); - Iterator subCondIter = subConditions.iterator(); + Iterator<Conditional> subCondIter = subConditions.iterator(); while (subCondIter.hasNext()) { - Conditional subCond = (Conditional) subCondIter.next(); + Conditional subCond = subCondIter.next(); subCond.prettyPrint(messageBuffer, methodContext); if (subCondIter.hasNext()) { switch (this.conditionType) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareCondition.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareCondition.java Sun Aug 3 20:00:54 2008 @@ -20,6 +20,7 @@ import java.util.*; +import javolution.util.FastList; import org.w3c.dom.*; import org.ofbiz.base.util.*; import org.ofbiz.minilang.*; @@ -35,8 +36,8 @@ SimpleMethod simpleMethod; - ContextAccessor mapAcsr; - ContextAccessor fieldAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<Object> fieldAcsr; String value; String operator; @@ -47,11 +48,11 @@ this.simpleMethod = simpleMethod; // NOTE: this is still supported, but is deprecated - this.mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - this.fieldAcsr = new ContextAccessor(element.getAttribute("field")); + this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field")); if (this.fieldAcsr.isEmpty()) { // NOTE: this is still supported, but is deprecated - this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); } this.value = element.getAttribute("value"); @@ -68,16 +69,15 @@ Object fieldVal = getFieldVal(methodContext); - List messages = new LinkedList(); + List<Object> messages = FastList.newInstance(); Boolean resultBool = BaseCompare.doRealCompare(fieldVal, value, operator, type, format, messages, null, methodContext.getLoader(), true); if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare between field [" + mapAcsr.toString() + "." + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: "); if (methodContext.getMethodType() == MethodContext.EVENT) { - StringBuffer fullString = new StringBuffer(); + StringBuilder fullString = new StringBuilder(); - Iterator miter = messages.iterator(); - while (miter.hasNext()) { - fullString.append((String) miter.next()); + for (Object message: messages) { + fullString.append(message); } Debug.logWarning(fullString.toString(), module); @@ -98,7 +98,7 @@ protected Object getFieldVal(MethodContext methodContext) { Object fieldVal = null; if (!mapAcsr.isEmpty()) { - Map fromMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext); if (fromMap == null) { if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module); } else { @@ -116,7 +116,7 @@ return fieldVal; } - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext) { + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext) { String value = methodContext.expandString(this.value); String operator = methodContext.expandString(this.operator); String type = methodContext.expandString(this.type); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/CompareFieldCondition.java Sun Aug 3 20:00:54 2008 @@ -19,6 +19,7 @@ package org.ofbiz.minilang.method.conditional; import java.util.*; +import javolution.util.FastList; import org.w3c.dom.*; import org.ofbiz.base.util.*; import org.ofbiz.minilang.*; @@ -34,10 +35,10 @@ SimpleMethod simpleMethod; - ContextAccessor mapAcsr; - ContextAccessor fieldAcsr; - ContextAccessor toMapAcsr; - ContextAccessor toFieldAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<Object> fieldAcsr; + ContextAccessor<Map<String, ? extends Object>> toMapAcsr; + ContextAccessor<Object> toFieldAcsr; String operator; String type; @@ -47,20 +48,20 @@ this.simpleMethod = simpleMethod; // NOTE: this is still supported, but is deprecated - this.mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - this.fieldAcsr = new ContextAccessor(element.getAttribute("field")); + this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field")); if (this.fieldAcsr.isEmpty()) { // NOTE: this is still supported, but is deprecated - this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); } // NOTE: this is still supported, but is deprecated - this.toMapAcsr = new ContextAccessor(element.getAttribute("to-map-name")); + this.toMapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("to-map-name")); // set fieldAcsr to their default value of fieldAcsr if empty - this.toFieldAcsr = new ContextAccessor(element.getAttribute("to-field"), element.getAttribute("field")); + this.toFieldAcsr = new ContextAccessor<Object>(element.getAttribute("to-field"), element.getAttribute("field")); if (this.toFieldAcsr.isEmpty()) { // NOTE: this is still supported, but is deprecated - this.toFieldAcsr = new ContextAccessor(element.getAttribute("to-field-name"), element.getAttribute("field-name")); + this.toFieldAcsr = new ContextAccessor<Object>(element.getAttribute("to-field-name"), element.getAttribute("field-name")); } // do NOT default the to-map-name to the map-name because that @@ -80,17 +81,16 @@ Object fieldVal1 = getFieldVal1(methodContext); Object fieldVal2 = getFieldVal2(methodContext); - List messages = new LinkedList(); + List<Object> messages = FastList.newInstance(); Boolean resultBool = BaseCompare.doRealCompare(fieldVal1, fieldVal2, operator, type, format, messages, null, methodContext.getLoader(), false); if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare-field between fields [" + mapAcsr.toString() + "." + fieldAcsr.toString() + "] with value [" + fieldVal1 + "] and [" + toMapAcsr.toString() + "." + toFieldAcsr.toString() + "] with value [" + fieldVal2 + "] with operator [" + operator + "] and type [" + type + "]: "); if (methodContext.getMethodType() == MethodContext.EVENT) { - StringBuffer fullString = new StringBuffer(); + StringBuilder fullString = new StringBuilder(); - Iterator miter = messages.iterator(); - while (miter.hasNext()) { - fullString.append((String) miter.next()); + for (Object message: messages) { + fullString.append(message); } Debug.logWarning(fullString.toString(), module); @@ -111,7 +111,7 @@ protected Object getFieldVal1(MethodContext methodContext) { Object fieldVal1 = null; if (!mapAcsr.isEmpty()) { - Map fromMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext); if (fromMap == null) { if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using null for comparison", module); } else { @@ -127,7 +127,7 @@ protected Object getFieldVal2(MethodContext methodContext) { Object fieldVal2 = null; if (!toMapAcsr.isEmpty()) { - Map toMap = (Map) toMapAcsr.get(methodContext); + Map<String, ? extends Object> toMap = toMapAcsr.get(methodContext); if (toMap == null) { if (Debug.infoOn()) Debug.logInfo("To Map not found with name " + toMapAcsr + ", using null for comparison", module); } else { @@ -140,7 +140,7 @@ return fieldVal2; } - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext) { + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext) { String operator = methodContext.expandString(this.operator); String type = methodContext.expandString(this.type); String format = methodContext.expandString(this.format); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/Conditional.java Sun Aug 3 20:00:54 2008 @@ -26,5 +26,5 @@ */ public interface Conditional { public boolean checkCondition(MethodContext methodContext); - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext); + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/EmptyCondition.java Sun Aug 3 20:00:54 2008 @@ -33,18 +33,18 @@ SimpleMethod simpleMethod; - ContextAccessor mapAcsr; - ContextAccessor fieldAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<Object> fieldAcsr; public EmptyCondition(Element element, SimpleMethod simpleMethod) { this.simpleMethod = simpleMethod; // NOTE: this is still supported, but is deprecated - this.mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - this.fieldAcsr = new ContextAccessor(element.getAttribute("field")); + this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field")); if (this.fieldAcsr.isEmpty()) { // NOTE: this is still supported, but is deprecated - this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); } } @@ -83,7 +83,7 @@ protected Object getFieldVal(MethodContext methodContext) { Object fieldVal = null; if (!mapAcsr.isEmpty()) { - Map fromMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext); if (fromMap == null) { if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", running operations", module); } else { @@ -96,7 +96,7 @@ return fieldVal; } - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext) { + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext) { messageBuffer.append("empty["); if (!this.mapAcsr.isEmpty()) { messageBuffer.append(this.mapAcsr); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/HasPermissionCondition.java Sun Aug 3 20:00:54 2008 @@ -69,7 +69,7 @@ return runSubOps; } - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext) { + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext) { messageBuffer.append("has-permission["); messageBuffer.append(this.permission); if (UtilValidate.isNotEmpty(this.action)) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/MasterIf.java Sun Aug 3 20:00:54 2008 @@ -111,7 +111,7 @@ public String expandedString(MethodContext methodContext) { // TODO: fill in missing details, if needed - StringBuffer messageBuf = new StringBuffer(); + StringBuilder messageBuf = new StringBuilder(); this.condition.prettyPrint(messageBuf, methodContext); return "<if><condition>" + messageBuf + "</condition></if>"; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/RegexpCondition.java Sun Aug 3 20:00:54 2008 @@ -22,6 +22,8 @@ import java.util.List; import java.util.Map; +import javolution.util.FastList; + import org.apache.oro.text.regex.MalformedPatternException; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.PatternCompiler; @@ -49,19 +51,19 @@ static PatternMatcher matcher = new Perl5Matcher(); static PatternCompiler compiler = new Perl5Compiler(); - List subOps = new LinkedList(); + List subOps = FastList.newInstance(); List elseSubOps = null; - ContextAccessor mapAcsr; - ContextAccessor fieldAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<Object> fieldAcsr; FlexibleStringExpander exprExdr; public RegexpCondition(Element element, SimpleMethod simpleMethod) { this.simpleMethod = simpleMethod; - this.mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name")); + this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); this.exprExdr = new FlexibleStringExpander(element.getAttribute("expr")); } @@ -90,7 +92,7 @@ Object fieldVal = null; if (!mapAcsr.isEmpty()) { - Map fromMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext); if (fromMap == null) { if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module); } else { @@ -114,7 +116,7 @@ return fieldString; } - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext) { + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext) { messageBuffer.append("regexp["); messageBuffer.append("["); if (!this.mapAcsr.isEmpty()) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/ValidateMethodCondition.java Sun Aug 3 20:00:54 2008 @@ -31,14 +31,14 @@ public static final String module = ValidateMethodCondition.class.getName(); - ContextAccessor mapAcsr; - ContextAccessor fieldAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<Object> fieldAcsr; String methodName; String className; public ValidateMethodCondition(Element element) { - this.mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name")); + this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name")); this.methodName = element.getAttribute("method"); this.className = element.getAttribute("class"); } @@ -49,10 +49,10 @@ String fieldString = getFieldString(methodContext); - Class[] paramTypes = new Class[] {String.class}; + Class<?>[] paramTypes = new Class<?>[] {String.class}; Object[] params = new Object[] {fieldString}; - Class valClass; + Class<?> valClass; try { valClass = methodContext.getLoader().loadClass(className); } catch (ClassNotFoundException cnfe) { @@ -85,7 +85,7 @@ Object fieldVal = null; if (!mapAcsr.isEmpty()) { - Map fromMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext); if (fromMap == null) { if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", using empty string for comparison", module); } else { @@ -110,7 +110,7 @@ return fieldString; } - public void prettyPrint(StringBuffer messageBuffer, MethodContext methodContext) { + public void prettyPrint(StringBuilder messageBuffer, MethodContext methodContext) { // allow methodContext to be null String methodName = methodContext == null ? this.methodName : methodContext.expandString(this.methodName); String className = methodContext == null ? this.className : methodContext.expandString(this.className); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/conditional/While.java Sun Aug 3 20:00:54 2008 @@ -71,7 +71,7 @@ public String expandedString(MethodContext methodContext) { // TODO: fill in missing details, if needed - StringBuffer messageBuf = new StringBuffer(); + StringBuilder messageBuf = new StringBuilder(); this.condition.prettyPrint(messageBuf, methodContext); return "<while><condition>" + messageBuf + "</condition></while>"; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/ClearCacheLine.java Sun Aug 3 20:00:54 2008 @@ -34,12 +34,12 @@ public static final String module = ClearCacheLine.class.getName(); String entityName; - ContextAccessor mapAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; public ClearCacheLine(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); entityName = element.getAttribute("entity-name"); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); } public boolean exec(MethodContext methodContext) { @@ -48,7 +48,7 @@ if (mapAcsr.isEmpty()) { methodContext.getDelegator().clearCacheLine(entityName); } else { - Map theMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> theMap = mapAcsr.get(methodContext); if (theMap == null) { Debug.logWarning("In clear-cache-line could not find map with name " + mapAcsr + ", not clearing any cache lines", module); } else { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CloneValue.java Sun Aug 3 20:00:54 2008 @@ -33,17 +33,17 @@ public static final String module = CloneValue.class.getName(); - ContextAccessor valueAcsr; - ContextAccessor newValueAcsr; + ContextAccessor<GenericValue> valueAcsr; + ContextAccessor<GenericValue> newValueAcsr; public CloneValue(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); - newValueAcsr = new ContextAccessor(element.getAttribute("new-value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); + newValueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("new-value-name")); } public boolean exec(MethodContext methodContext) { - GenericValue value = (GenericValue) valueAcsr.get(methodContext); + GenericValue value = valueAcsr.get(methodContext); if (value == null) { Debug.logWarning("In clone-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not copying", module); return true; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/CreateValue.java Sun Aug 3 20:00:54 2008 @@ -34,19 +34,19 @@ public static final String module = CreateValue.class.getName(); - ContextAccessor valueAcsr; + ContextAccessor<GenericValue> valueAcsr; String doCacheClearStr; public CreateValue(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); doCacheClearStr = element.getAttribute("do-cache-clear"); } public boolean exec(MethodContext methodContext) { boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr)); - GenericValue value = (GenericValue) valueAcsr.get(methodContext); + GenericValue value = valueAcsr.get(methodContext); if (value == null) { String errMsg = "In create-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not creating"; Debug.logWarning(errMsg, module); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java Sun Aug 3 20:00:54 2008 @@ -47,13 +47,13 @@ protected FlexibleStringExpander delegatorNameExdr; protected Condition whereCondition; protected Condition havingCondition; - protected FlexibleMapAccessor countAcsr; + protected FlexibleMapAccessor<Long> countAcsr; public EntityCount(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); this.entityNameExdr = new FlexibleStringExpander(element.getAttribute("entity-name")); this.delegatorNameExdr = new FlexibleStringExpander(element.getAttribute("delegator-name")); - this.countAcsr = new FlexibleMapAccessor(element.getAttribute("count-name")); + this.countAcsr = new FlexibleMapAccessor<Long>(element.getAttribute("count-name")); // process condition-expr | condition-list Element conditionExprElement = UtilXml.firstChildElement(element, "condition-expr"); @@ -79,7 +79,7 @@ public boolean exec(MethodContext methodContext) { try { - Map context = methodContext.getEnvMap(); + Map<String, Object> context = methodContext.getEnvMap(); GenericDelegator delegator = methodContext.getDelegator(); String entityName = this.entityNameExdr.expandString(context); String delegatorName = this.delegatorNameExdr.expandString(context); @@ -102,7 +102,7 @@ long count = delegator.findCountByCondition(entityName, whereEntityCondition, havingEntityCondition, null); - this.countAcsr.put(context, Long.valueOf(count)); + this.countAcsr.put(context, count); } catch (GeneralException e) { Debug.logError(e, module); String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process: " + e.getMessage(); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java Sun Aug 3 20:00:54 2008 @@ -47,7 +47,7 @@ protected FlexibleStringExpander locationExdr; protected FlexibleStringExpander delegatorNameExdr; protected FlexibleStringExpander timeoutExdr; - protected ContextAccessor errorListAcsr; + protected ContextAccessor<List<Object>> errorListAcsr; protected String mode; public EntityData(Element element, SimpleMethod simpleMethod) { @@ -55,7 +55,7 @@ locationExdr = new FlexibleStringExpander(element.getAttribute("location")); delegatorNameExdr = new FlexibleStringExpander(element.getAttribute("delegator-name")); timeoutExdr = new FlexibleStringExpander(element.getAttribute("timeout")); - errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list"); + errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list"); mode = element.getAttribute("mode"); if (UtilValidate.isEmpty(mode)) { @@ -64,7 +64,7 @@ } public boolean exec(MethodContext methodContext) { - List messages = (List) errorListAcsr.get(methodContext); + List<Object> messages = errorListAcsr.get(methodContext); if (messages == null) { messages = FastList.newInstance(); errorListAcsr.put(methodContext, messages); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByAnd.java Sun Aug 3 20:00:54 2008 @@ -21,6 +21,7 @@ import java.util.List; import java.util.Map; +import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; @@ -33,24 +34,24 @@ */ public class FilterListByAnd extends MethodOperation { - ContextAccessor listAcsr; - ContextAccessor toListAcsr; - ContextAccessor mapAcsr; + ContextAccessor<List<GenericEntity>> listAcsr; + ContextAccessor<List<GenericEntity>> toListAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; public FilterListByAnd(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - listAcsr = new ContextAccessor(element.getAttribute("list-name")); - toListAcsr = new ContextAccessor(element.getAttribute("to-list-name"), element.getAttribute("list-name")); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); + listAcsr = new ContextAccessor<List<GenericEntity>>(element.getAttribute("list-name")); + toListAcsr = new ContextAccessor<List<GenericEntity>>(element.getAttribute("to-list-name"), element.getAttribute("list-name")); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); } public boolean exec(MethodContext methodContext) { - Map theMap = null; + Map<String, ? extends Object> theMap = null; if (!mapAcsr.isEmpty()) { - theMap = (Map) mapAcsr.get(methodContext); + theMap = mapAcsr.get(methodContext); } - toListAcsr.put(methodContext, EntityUtil.filterByAnd((List) listAcsr.get(methodContext), theMap)); + toListAcsr.put(methodContext, EntityUtil.filterByAnd(listAcsr.get(methodContext), theMap)); return true; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FilterListByDate.java Sun Aug 3 20:00:54 2008 @@ -18,10 +18,12 @@ *******************************************************************************/ package org.ofbiz.minilang.method.entityops; +import java.sql.Timestamp; import java.util.List; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; @@ -34,18 +36,18 @@ */ public class FilterListByDate extends MethodOperation { - ContextAccessor listAcsr; - ContextAccessor toListAcsr; - ContextAccessor validDateAcsr; + ContextAccessor<List<GenericEntity>> listAcsr; + ContextAccessor<List<GenericEntity>> toListAcsr; + ContextAccessor<Timestamp> validDateAcsr; String fromFieldName; String thruFieldName; String allSameStr; public FilterListByDate(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - listAcsr = new ContextAccessor(element.getAttribute("list-name")); - toListAcsr = new ContextAccessor(element.getAttribute("to-list-name"), element.getAttribute("list-name")); - validDateAcsr = new ContextAccessor(element.getAttribute("valid-date-name")); + listAcsr = new ContextAccessor<List<GenericEntity>>(element.getAttribute("list-name")); + toListAcsr = new ContextAccessor<List<GenericEntity>>(element.getAttribute("to-list-name"), element.getAttribute("list-name")); + validDateAcsr = new ContextAccessor<Timestamp>(element.getAttribute("valid-date-name")); fromFieldName = element.getAttribute("from-field-name"); if (UtilValidate.isEmpty(fromFieldName)) fromFieldName = "fromDate"; @@ -58,9 +60,9 @@ public boolean exec(MethodContext methodContext) { if (!validDateAcsr.isEmpty()) { - toListAcsr.put(methodContext, EntityUtil.filterByDate((List) listAcsr.get(methodContext), (java.sql.Timestamp) validDateAcsr.get(methodContext), fromFieldName, thruFieldName, true)); + toListAcsr.put(methodContext, EntityUtil.filterByDate(listAcsr.get(methodContext), validDateAcsr.get(methodContext), fromFieldName, thruFieldName, true)); } else { - toListAcsr.put(methodContext, EntityUtil.filterByDate((List) listAcsr.get(methodContext), UtilDateTime.nowTimestamp(), fromFieldName, thruFieldName, true)); + toListAcsr.put(methodContext, EntityUtil.filterByDate(listAcsr.get(methodContext), UtilDateTime.nowTimestamp(), fromFieldName, thruFieldName, true)); } return true; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java Sun Aug 3 20:00:54 2008 @@ -24,6 +24,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityFieldMap; import org.ofbiz.entity.condition.EntityOperator; @@ -40,20 +41,20 @@ public static final String module = FindByAnd.class.getName(); - ContextAccessor listAcsr; + ContextAccessor<Object> listAcsr; String entityName; - ContextAccessor mapAcsr; - ContextAccessor orderByListAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<List<String>> orderByListAcsr; String delegatorName; String useCacheStr; String useIteratorStr; public FindByAnd(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - listAcsr = new ContextAccessor(element.getAttribute("list-name")); + listAcsr = new ContextAccessor<Object>(element.getAttribute("list-name")); entityName = element.getAttribute("entity-name"); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - orderByListAcsr = new ContextAccessor(element.getAttribute("order-by-list-name")); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + orderByListAcsr = new ContextAccessor<List<String>>(element.getAttribute("order-by-list-name")); delegatorName = element.getAttribute("delegator-name"); useCacheStr = element.getAttribute("use-cache"); @@ -69,9 +70,9 @@ boolean useCache = "true".equals(useCacheStr); boolean useIterator = "true".equals(useIteratorStr); - List orderByNames = null; + List<String> orderByNames = null; if (!orderByListAcsr.isEmpty()) { - orderByNames = (List) orderByListAcsr.get(methodContext); + orderByNames = orderByListAcsr.get(methodContext); } GenericDelegator delegator = methodContext.getDelegator(); @@ -83,14 +84,14 @@ if (useIterator) { EntityCondition whereCond = null; if (!mapAcsr.isEmpty()) { - whereCond = EntityCondition.makeCondition((Map) mapAcsr.get(methodContext)); + whereCond = EntityCondition.makeCondition(mapAcsr.get(methodContext)); } listAcsr.put(methodContext, delegator.find(entityName, whereCond, null, null, orderByNames, null)); } else { if (useCache) { - listAcsr.put(methodContext, delegator.findByAndCache(entityName, (Map) mapAcsr.get(methodContext), orderByNames)); + listAcsr.put(methodContext, delegator.findByAndCache(entityName, mapAcsr.get(methodContext), orderByNames)); } else { - listAcsr.put(methodContext, delegator.findByAnd(entityName, (Map) mapAcsr.get(methodContext), orderByNames)); + listAcsr.put(methodContext, delegator.findByAnd(entityName, mapAcsr.get(methodContext), orderByNames)); } } } catch (GenericEntityException e) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java Sun Aug 3 20:00:54 2008 @@ -19,14 +19,15 @@ package org.ofbiz.minilang.method.entityops; import java.util.Collection; -import java.util.HashSet; import java.util.List; import java.util.Map; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntity; +import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; @@ -41,19 +42,19 @@ public static final String module = FindByPrimaryKey.class.getName(); - ContextAccessor valueAcsr; + ContextAccessor<GenericValue> valueAcsr; String entityName; - ContextAccessor mapAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; String delegatorName; String useCacheStr; - ContextAccessor fieldsToSelectListAcsr; + ContextAccessor<Collection<String>> fieldsToSelectListAcsr; public FindByPrimaryKey(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); entityName = element.getAttribute("entity-name"); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - fieldsToSelectListAcsr = new ContextAccessor(element.getAttribute("fields-to-select-list")); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + fieldsToSelectListAcsr = new ContextAccessor<Collection<String>>(element.getAttribute("fields-to-select-list")); delegatorName = element.getAttribute("delegator-name"); useCacheStr = element.getAttribute("use-cache"); } @@ -70,20 +71,20 @@ delegator = GenericDelegator.getGenericDelegator(delegatorName); } - Map inMap = (Map) mapAcsr.get(methodContext); + Map<String, ? extends Object> inMap = mapAcsr.get(methodContext); if (UtilValidate.isEmpty(entityName) && inMap instanceof GenericEntity) { GenericEntity inEntity = (GenericEntity) inMap; entityName = inEntity.getEntityName(); } - Collection fieldsToSelectList = null; + Collection<String> fieldsToSelectList = null; if (!fieldsToSelectListAcsr.isEmpty()) { - fieldsToSelectList = (Collection) fieldsToSelectListAcsr.get(methodContext); + fieldsToSelectList = fieldsToSelectListAcsr.get(methodContext); } try { if (fieldsToSelectList != null) { - valueAcsr.put(methodContext, delegator.findByPrimaryKeyPartial(delegator.makePK(entityName, inMap), new HashSet(fieldsToSelectList))); + valueAcsr.put(methodContext, delegator.findByPrimaryKeyPartial(delegator.makePK(entityName, inMap), UtilMisc.makeSetWritable(fieldsToSelectList))); } else { valueAcsr.put(methodContext, delegator.findOne(entityName, inMap, useCache)); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelated.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelated.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelated.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelated.java Sun Aug 3 20:00:54 2008 @@ -37,20 +37,20 @@ public static final String module = GetRelated.class.getName(); - ContextAccessor valueAcsr; - ContextAccessor mapAcsr; - ContextAccessor orderByListAcsr; + ContextAccessor<GenericValue> valueAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; + ContextAccessor<List<String>> orderByListAcsr; String relationName; String useCacheStr; - ContextAccessor listAcsr; + ContextAccessor<List<GenericValue>> listAcsr; public GetRelated(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); relationName = element.getAttribute("relation-name"); - listAcsr = new ContextAccessor(element.getAttribute("list-name")); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); - orderByListAcsr = new ContextAccessor(element.getAttribute("order-by-list-name")); + listAcsr = new ContextAccessor<List<GenericValue>>(element.getAttribute("list-name")); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); + orderByListAcsr = new ContextAccessor<List<String>>(element.getAttribute("order-by-list-name")); useCacheStr = element.getAttribute("use-cache"); } @@ -60,16 +60,16 @@ String useCacheStr = methodContext.expandString(this.useCacheStr); boolean useCache = "true".equals(useCacheStr); - List orderByNames = null; + List<String> orderByNames = null; if (!orderByListAcsr.isEmpty()) { - orderByNames = (List) orderByListAcsr.get(methodContext); + orderByNames = orderByListAcsr.get(methodContext); } - Map constraintMap = null; + Map<String, ? extends Object> constraintMap = null; if (!mapAcsr.isEmpty()) { - constraintMap = (Map) mapAcsr.get(methodContext); + constraintMap = mapAcsr.get(methodContext); } - GenericValue value = (GenericValue) valueAcsr.get(methodContext); + GenericValue value = valueAcsr.get(methodContext); if (value == null) { Debug.logWarning("Value not found with name: " + valueAcsr + ", not getting related...", module); return true; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelatedOne.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelatedOne.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelatedOne.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelatedOne.java Sun Aug 3 20:00:54 2008 @@ -34,15 +34,15 @@ public static final String module = GetRelatedOne.class.getName(); - ContextAccessor valueAcsr; - ContextAccessor toValueAcsr; + ContextAccessor<Object> valueAcsr; + ContextAccessor<GenericValue> toValueAcsr; String relationName; String useCacheStr; public GetRelatedOne(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); - toValueAcsr = new ContextAccessor(element.getAttribute("to-value-name")); + valueAcsr = new ContextAccessor<Object>(element.getAttribute("value-name")); + toValueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("to-value-name")); relationName = element.getAttribute("relation-name"); useCacheStr = element.getAttribute("use-cache"); } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeNextSeqId.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeNextSeqId.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeNextSeqId.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeNextSeqId.java Sun Aug 3 20:00:54 2008 @@ -35,14 +35,14 @@ public static final String module = MakeNextSeqId.class.getName(); String seqFieldName; - ContextAccessor valueAcsr; + ContextAccessor<GenericValue> valueAcsr; String numericPaddingStr; String incrementByStr; public MakeNextSeqId(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); seqFieldName = element.getAttribute("seq-field-name"); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); numericPaddingStr = element.getAttribute("numeric-padding"); incrementByStr = element.getAttribute("increment-by"); @@ -69,7 +69,7 @@ Debug.logError(e, "increment-by format invalid for [" + incrementByStr + "]", module); } - GenericValue value = (GenericValue) valueAcsr.get(methodContext); + GenericValue value = valueAcsr.get(methodContext); methodContext.getDelegator().setNextSubSeqId(value, seqFieldName, numericPadding, incrementBy); return true; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeValue.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeValue.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/MakeValue.java Sun Aug 3 20:00:54 2008 @@ -21,6 +21,7 @@ import java.util.*; import org.w3c.dom.*; +import org.ofbiz.entity.GenericValue; import org.ofbiz.minilang.*; import org.ofbiz.minilang.method.*; @@ -29,20 +30,20 @@ */ public class MakeValue extends MethodOperation { - ContextAccessor valueAcsr; + ContextAccessor<GenericValue> valueAcsr; String entityName; - ContextAccessor mapAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; public MakeValue(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); entityName = element.getAttribute("entity-name"); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); } public boolean exec(MethodContext methodContext) { String entityName = methodContext.expandString(this.entityName); - Map ctxMap = (Map) (mapAcsr.isEmpty() ? null : mapAcsr.get(methodContext)); + Map<String, ? extends Object> ctxMap = (mapAcsr.isEmpty() ? null : mapAcsr.get(methodContext)); valueAcsr.put(methodContext, methodContext.getDelegator().makeValidValue(entityName, ctxMap)); return true; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowDateToEnv.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowDateToEnv.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowDateToEnv.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowDateToEnv.java Sun Aug 3 20:00:54 2008 @@ -28,11 +28,11 @@ */ public class NowDateToEnv extends MethodOperation { - ContextAccessor envAcsr; + ContextAccessor<java.sql.Date> envAcsr; public NowDateToEnv(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - envAcsr = new ContextAccessor(element.getAttribute("env-name")); + envAcsr = new ContextAccessor<java.sql.Date>(element.getAttribute("env-name")); } public boolean exec(MethodContext methodContext) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowTimestampToEnv.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowTimestampToEnv.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowTimestampToEnv.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/NowTimestampToEnv.java Sun Aug 3 20:00:54 2008 @@ -28,11 +28,11 @@ */ public class NowTimestampToEnv extends MethodOperation { - ContextAccessor envAcsr; + ContextAccessor<java.sql.Timestamp> envAcsr; public NowTimestampToEnv(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - envAcsr = new ContextAccessor(element.getAttribute("env-name")); + envAcsr = new ContextAccessor<java.sql.Timestamp>(element.getAttribute("env-name")); } public boolean exec(MethodContext methodContext) { Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/OrderValueList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/OrderValueList.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/OrderValueList.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/OrderValueList.java Sun Aug 3 20:00:54 2008 @@ -20,6 +20,7 @@ import java.util.List; +import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; @@ -32,24 +33,24 @@ */ public class OrderValueList extends MethodOperation { - ContextAccessor listAcsr; - ContextAccessor toListAcsr; - ContextAccessor orderByListAcsr; + ContextAccessor<List<? extends GenericEntity>> listAcsr; + ContextAccessor<List<? extends GenericEntity>> toListAcsr; + ContextAccessor<List<String>> orderByListAcsr; public OrderValueList(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - listAcsr = new ContextAccessor(element.getAttribute("list-name")); - toListAcsr = new ContextAccessor(element.getAttribute("to-list-name"), element.getAttribute("list-name")); - orderByListAcsr = new ContextAccessor(element.getAttribute("order-by-list-name")); + listAcsr = new ContextAccessor<List<? extends GenericEntity>>(element.getAttribute("list-name")); + toListAcsr = new ContextAccessor<List<? extends GenericEntity>>(element.getAttribute("to-list-name"), element.getAttribute("list-name")); + orderByListAcsr = new ContextAccessor<List<String>>(element.getAttribute("order-by-list-name")); } public boolean exec(MethodContext methodContext) { - List orderByList = null; + List<String> orderByList = null; if (!orderByListAcsr.isEmpty()) { - orderByList = (List) orderByListAcsr.get(methodContext); + orderByList = orderByListAcsr.get(methodContext); } - toListAcsr.put(methodContext, EntityUtil.orderBy((List) listAcsr.get(methodContext), orderByList)); + toListAcsr.put(methodContext, EntityUtil.orderBy(listAcsr.get(methodContext), orderByList)); return true; } Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RefreshValue.java Sun Aug 3 20:00:54 2008 @@ -34,19 +34,19 @@ public static final String module = RemoveValue.class.getName(); - ContextAccessor valueAcsr; + ContextAccessor<GenericValue> valueAcsr; String doCacheClearStr; public RefreshValue(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); doCacheClearStr = element.getAttribute("do-cache-clear"); } public boolean exec(MethodContext methodContext) { boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr)); - GenericValue value = (GenericValue) valueAcsr.get(methodContext); + GenericValue value = valueAcsr.get(methodContext); if (value == null) { String errMsg = "In remove-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not removing"; Debug.logWarning(errMsg, module); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveByAnd.java Sun Aug 3 20:00:54 2008 @@ -36,13 +36,13 @@ public static final String module = RemoveByAnd.class.getName(); String entityName; - ContextAccessor mapAcsr; + ContextAccessor<Map<String, ? extends Object>> mapAcsr; String doCacheClearStr; public RemoveByAnd(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); entityName = element.getAttribute("entity-name"); - mapAcsr = new ContextAccessor(element.getAttribute("map-name")); + mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name")); doCacheClearStr = element.getAttribute("do-cache-clear"); } @@ -51,7 +51,7 @@ String entityName = methodContext.expandString(this.entityName); try { - methodContext.getDelegator().removeByAnd(entityName, (Map) mapAcsr.get(methodContext), doCacheClear); + methodContext.getDelegator().removeByAnd(entityName, mapAcsr.get(methodContext), doCacheClear); } catch (GenericEntityException e) { Debug.logError(e, module); String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem removing the " + entityName + " entity by and: " + e.getMessage() + "]"; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveList.java Sun Aug 3 20:00:54 2008 @@ -22,6 +22,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericValue; import org.ofbiz.minilang.SimpleMethod; import org.ofbiz.minilang.method.ContextAccessor; import org.ofbiz.minilang.method.MethodContext; @@ -35,19 +36,19 @@ public static final String module = RemoveList.class.getName(); - ContextAccessor listAcsr; + ContextAccessor<List<GenericValue>> listAcsr; String doCacheClearStr; public RemoveList(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - listAcsr = new ContextAccessor(element.getAttribute("list-name")); + listAcsr = new ContextAccessor<List<GenericValue>>(element.getAttribute("list-name")); doCacheClearStr = element.getAttribute("do-cache-clear"); } public boolean exec(MethodContext methodContext) { boolean doCacheClear = !"false".equals(doCacheClearStr); - List values = (List) listAcsr.get(methodContext); + List<GenericValue> values = listAcsr.get(methodContext); if (values == null) { String errMsg = "In remove-list a value list was not found with the specified listAcsr: " + listAcsr + ", not removing"; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveRelated.java Sun Aug 3 20:00:54 2008 @@ -34,13 +34,13 @@ public static final String module = RemoveRelated.class.getName(); - ContextAccessor valueAcsr; + ContextAccessor<GenericValue> valueAcsr; String relationName; String doCacheClearStr; public RemoveRelated(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); relationName = element.getAttribute("relation-name"); doCacheClearStr = element.getAttribute("do-cache-clear"); } @@ -49,7 +49,7 @@ boolean doCacheClear = !"false".equals(doCacheClearStr); String relationName = methodContext.expandString(this.relationName); - GenericValue value = (GenericValue) valueAcsr.get(methodContext); + GenericValue value = valueAcsr.get(methodContext); if (value == null) { String errMsg = "In remove-related a value was not found with the specified valueAcsr: " + valueAcsr + ", not removing related"; Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/RemoveValue.java Sun Aug 3 20:00:54 2008 @@ -34,19 +34,19 @@ public static final String module = RemoveValue.class.getName(); - ContextAccessor valueAcsr; + ContextAccessor<GenericValue> valueAcsr; String doCacheClearStr; public RemoveValue(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); - valueAcsr = new ContextAccessor(element.getAttribute("value-name")); + valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name")); doCacheClearStr = element.getAttribute("do-cache-clear"); } public boolean exec(MethodContext methodContext) { boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr)); - GenericValue value = (GenericValue) valueAcsr.get(methodContext); + GenericValue value = valueAcsr.get(methodContext); if (value == null) { String errMsg = "In remove-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not removing"; Debug.logWarning(errMsg, module); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java?rev=682246&r1=682245&r2=682246&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SequencedIdToEnv.java Sun Aug 3 20:00:54 2008 @@ -31,14 +31,14 @@ public class SequencedIdToEnv extends MethodOperation { String seqName; - ContextAccessor envAcsr; + ContextAccessor<Object> envAcsr; boolean getLongOnly; long staggerMax = 1; public SequencedIdToEnv(Element element, SimpleMethod simpleMethod) { super(element, simpleMethod); seqName = element.getAttribute("sequence-name"); - envAcsr = new ContextAccessor(element.getAttribute("env-name")); + envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name")); // default false, anything but true is false getLongOnly = "true".equals(element.getAttribute("get-long-only")); String staggerMaxStr = element.getAttribute("stagger-max"); |
Free forum by Nabble | Edit this page |