You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2008/08/04 05:00:57 UTC
svn commit: r682246 [3/4] - in
/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang: ./ method/
method/callops/ method/conditional/ method/entityops/ method/envops/
method/eventops/ method/ifops/ method/otherops/ method/serviceops/ operation/
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetCurrentUserLogin.java Sun Aug 3 20:00:54 2008
@@ -33,15 +33,15 @@
public static final String module = SetCurrentUserLogin.class.getName();
- ContextAccessor valueAcsr;
+ ContextAccessor<GenericValue> valueAcsr;
public SetCurrentUserLogin(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- valueAcsr = new ContextAccessor(element.getAttribute("value-name"));
+ valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name"));
}
public boolean exec(MethodContext methodContext) {
- GenericValue userLogin = (GenericValue) valueAcsr.get(methodContext);
+ GenericValue userLogin = valueAcsr.get(methodContext);
if (userLogin == null) {
Debug.logWarning("In SetCurrentUserLogin a value was not found with the specified valueName: " + valueAcsr + ", not setting", module);
return true;
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetNonpkFields.java Sun Aug 3 20:00:54 2008
@@ -35,14 +35,14 @@
public static final String module = SetNonpkFields.class.getName();
- ContextAccessor valueAcsr;
- ContextAccessor mapAcsr;
+ ContextAccessor<GenericValue> valueAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
String setIfNullStr;
public SetNonpkFields(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- valueAcsr = new ContextAccessor(element.getAttribute("value-name"));
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
+ valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
setIfNullStr = element.getAttribute("set-if-null");
}
@@ -50,7 +50,7 @@
// if anything but false it will be true
boolean setIfNull = !"false".equals(methodContext.expandString(setIfNullStr));
- GenericValue value = (GenericValue) valueAcsr.get(methodContext);
+ GenericValue value = valueAcsr.get(methodContext);
if (value == null) {
String errMsg = "In set-nonpk-fields a value was not found with the specified valueAcsr: " + valueAcsr + ", not setting fields";
Debug.logWarning(errMsg, module);
@@ -64,7 +64,7 @@
return false;
}
- Map theMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> theMap = mapAcsr.get(methodContext);
if (theMap == null) {
Debug.logWarning("In set-nonpk-fields could not find map with name " + mapAcsr + ", not setting any fields", module);
} else {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/SetPkFields.java Sun Aug 3 20:00:54 2008
@@ -35,14 +35,14 @@
public static final String module = SetPkFields.class.getName();
- ContextAccessor valueAcsr;
- ContextAccessor mapAcsr;
+ ContextAccessor<GenericValue> valueAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
String setIfNullStr;
public SetPkFields(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- valueAcsr = new ContextAccessor(element.getAttribute("value-name"));
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
+ valueAcsr = new ContextAccessor<GenericValue>(element.getAttribute("value-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
setIfNullStr = element.getAttribute("set-if-null");
}
@@ -50,7 +50,7 @@
// if anything but false it will be true
boolean setIfNull = !"false".equals(methodContext.expandString(setIfNullStr));
- GenericValue value = (GenericValue) valueAcsr.get(methodContext);
+ GenericValue value = valueAcsr.get(methodContext);
if (value == null) {
String errMsg = "In set-pk-fields a value was not found with the specified valueAcsr: " + valueAcsr + ", not setting fields";
@@ -65,7 +65,7 @@
return false;
}
- Map theMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> theMap = mapAcsr.get(methodContext);
if (theMap == null) {
Debug.logWarning("In set-pk-fields could not find map with name " + mapAcsr + ", not setting any fields", module);
} else {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreList.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 = StoreList.class.getName();
- ContextAccessor listAcsr;
+ ContextAccessor<List<GenericValue>> listAcsr;
String doCacheClearStr;
public StoreList(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(methodContext.expandString(doCacheClearStr));
- List values = (List) listAcsr.get(methodContext);
+ List<GenericValue> values = listAcsr.get(methodContext);
if (values == null) {
String errMsg = "In store-list a value list was not found with the specified listAcsr: " + listAcsr + ", not storing";
Debug.logInfo(errMsg, module);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/StoreValue.java Sun Aug 3 20:00:54 2008
@@ -34,19 +34,19 @@
public static final String module = StoreValue.class.getName();
- ContextAccessor valueAcsr;
+ ContextAccessor<GenericValue> valueAcsr;
String doCacheClearStr;
public StoreValue(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 store-value a value was not found with the specified valueAcsr: " + valueAcsr + ", not storing";
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionBegin.java Sun Aug 3 20:00:54 2008
@@ -34,11 +34,11 @@
public static final String module = TransactionBegin.class.getName();
- ContextAccessor beganTransactionAcsr;
+ ContextAccessor<Boolean> beganTransactionAcsr;
public TransactionBegin(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- beganTransactionAcsr = new ContextAccessor(element.getAttribute("began-transaction-name"), "beganTransaction");
+ beganTransactionAcsr = new ContextAccessor<Boolean>(element.getAttribute("began-transaction-name"), "beganTransaction");
}
public boolean exec(MethodContext methodContext) {
@@ -53,7 +53,7 @@
return false;
}
- beganTransactionAcsr.put(methodContext, Boolean.valueOf(beganTransaction));
+ beganTransactionAcsr.put(methodContext, beganTransaction);
return true;
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionCommit.java Sun Aug 3 20:00:54 2008
@@ -34,17 +34,17 @@
public static final String module = TransactionCommit.class.getName();
- ContextAccessor beganTransactionAcsr;
+ ContextAccessor<Boolean> beganTransactionAcsr;
public TransactionCommit(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- beganTransactionAcsr = new ContextAccessor(element.getAttribute("began-transaction-name"), "beganTransaction");
+ beganTransactionAcsr = new ContextAccessor<Boolean>(element.getAttribute("began-transaction-name"), "beganTransaction");
}
public boolean exec(MethodContext methodContext) {
boolean beganTransaction = false;
- Boolean beganTransactionBoolean = (Boolean) beganTransactionAcsr.get(methodContext);
+ Boolean beganTransactionBoolean = beganTransactionAcsr.get(methodContext);
if (beganTransactionBoolean != null) {
beganTransaction = beganTransactionBoolean.booleanValue();
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/TransactionRollback.java Sun Aug 3 20:00:54 2008
@@ -34,17 +34,17 @@
public static final String module = TransactionRollback.class.getName();
- ContextAccessor beganTransactionAcsr;
+ ContextAccessor<Boolean> beganTransactionAcsr;
public TransactionRollback(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- beganTransactionAcsr = new ContextAccessor(element.getAttribute("began-transaction-name"), "beganTransaction");
+ beganTransactionAcsr = new ContextAccessor<Boolean>(element.getAttribute("began-transaction-name"), "beganTransaction");
}
public boolean exec(MethodContext methodContext) {
boolean beganTransaction = false;
- Boolean beganTransactionBoolean = (Boolean) beganTransactionAcsr.get(methodContext);
+ Boolean beganTransactionBoolean = beganTransactionAcsr.get(methodContext);
if (beganTransactionBoolean != null) {
beganTransaction = beganTransactionBoolean.booleanValue();
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ClearField.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastMap;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
@@ -33,24 +35,24 @@
public static final String module = ClearField.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
public ClearField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
}
public boolean exec(MethodContext methodContext) {
if (!mapAcsr.isEmpty()) {
- Map toMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> toMap = mapAcsr.get(methodContext);
if (toMap == null) {
// it seems silly to create a new map, but necessary since whenever
// an env field like a Map or List is referenced it should be created, even if empty
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToEnv.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToEnv.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToEnv.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToEnv.java Sun Aug 3 20:00:54 2008
@@ -31,13 +31,13 @@
public static final String module = EnvToEnv.class.getName();
- protected ContextAccessor envAcsr;
- protected ContextAccessor toEnvAcsr;
+ protected ContextAccessor<Object> envAcsr;
+ protected ContextAccessor<Object> toEnvAcsr;
public EnvToEnv(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- envAcsr = new ContextAccessor(element.getAttribute("env-name"));
- toEnvAcsr = new ContextAccessor(element.getAttribute("to-env-name"));
+ envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name"));
+ toEnvAcsr = new ContextAccessor<Object>(element.getAttribute("to-env-name"));
}
public boolean exec(MethodContext methodContext) {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/EnvToField.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastMap;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
@@ -32,15 +34,15 @@
public static final String module = EnvToField.class.getName();
- ContextAccessor envAcsr;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Object> envAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
public EnvToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- envAcsr = new ContextAccessor(element.getAttribute("env-name"));
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
// set fieldAcsr to their defualt value of envAcsr if empty
if (fieldAcsr.isEmpty()) {
@@ -57,11 +59,11 @@
}
if (!mapAcsr.isEmpty()) {
- Map toMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> toMap = mapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
fieldAcsr.put(toMap, envVar, methodContext);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToEnv.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToEnv.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToEnv.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToEnv.java Sun Aug 3 20:00:54 2008
@@ -32,15 +32,15 @@
public static final String module = FieldToEnv.class.getName();
- ContextAccessor envAcsr;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Object> envAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
public FieldToEnv(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- envAcsr = new ContextAccessor(element.getAttribute("env-name"));
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ envAcsr = new ContextAccessor<Object>(element.getAttribute("env-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
// set fieldAcsr to their defualt value of envAcsr if empty - this is the way it USED to work, so still supporting it, but a parsing error will result
if (fieldAcsr.isEmpty()) {
@@ -56,7 +56,7 @@
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr + ", not copying field", module);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToField.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastMap;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
@@ -32,17 +34,17 @@
public static final String module = FieldToField.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- ContextAccessor toMapAcsr;
- ContextAccessor toFieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<Map<String, Object>> toMapAcsr;
+ ContextAccessor<Object> toFieldAcsr;
public FieldToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- toMapAcsr = new ContextAccessor(element.getAttribute("to-map-name"));
- toFieldAcsr = new ContextAccessor(element.getAttribute("to-field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ toMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("to-map-name"));
+ toFieldAcsr = new ContextAccessor<Object>(element.getAttribute("to-field-name"));
// set toMapAcsr and toFieldAcsr to their defualt values of mapAcsr and fieldAcsr if empty
if (toMapAcsr.isEmpty()) {
@@ -57,7 +59,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 + ", not copying from this map", module);
@@ -78,13 +80,13 @@
// note that going to an env field will only work if it came from an env
// field because if not specified the to-map-name will be set to the map-name
// to go from a map field to an env field, use the field-to-env operation
- Map toMap = null;
+ Map<String, Object> toMap = null;
if (!toMapAcsr.isEmpty()) {
- toMap = (Map) toMapAcsr.get(methodContext);
+ toMap = toMapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + toMapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
toMapAcsr.put(methodContext, toMap);
}
toFieldAcsr.put(toMap, fieldVal, methodContext);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FieldToList.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastList;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
@@ -32,22 +34,22 @@
public static final String module = FieldToList.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- ContextAccessor listAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<List<Object>> listAcsr;
public FieldToList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- listAcsr = new ContextAccessor(element.getAttribute("list-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ listAcsr = new ContextAccessor<List<Object>>(element.getAttribute("list-name"));
}
public boolean exec(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) {
Debug.logWarning("Map not found with name " + mapAcsr + ", Not copying to list", module);
@@ -65,11 +67,11 @@
return true;
}
- List toList = (List) listAcsr.get(methodContext);
+ List<Object> toList = listAcsr.get(methodContext);
if (toList == null) {
if (Debug.verboseOn()) Debug.logVerbose("List not found with name " + listAcsr + ", creating new list", module);
- toList = new LinkedList();
+ toList = FastList.newInstance();
listAcsr.put(methodContext, toList);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/FirstFromList.java Sun Aug 3 20:00:54 2008
@@ -32,13 +32,13 @@
public static final String module = FirstFromList.class.getName();
- ContextAccessor entryAcsr;
- ContextAccessor listAcsr;
+ ContextAccessor<Object> entryAcsr;
+ ContextAccessor<List<? extends Object>> listAcsr;
public FirstFromList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.entryAcsr = new ContextAccessor(element.getAttribute("entry-name"));
- this.listAcsr = new ContextAccessor(element.getAttribute("list-name"));
+ this.entryAcsr = new ContextAccessor<Object>(element.getAttribute("entry-name"));
+ this.listAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("list-name"));
}
public boolean exec(MethodContext methodContext) {
@@ -48,7 +48,7 @@
return true;
}
- List theList = (List) listAcsr.get(methodContext);
+ List<? extends Object> theList = listAcsr.get(methodContext);
if (UtilValidate.isEmpty(theList)) {
entryAcsr.put(methodContext, null);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Iterate.java Sun Aug 3 20:00:54 2008
@@ -20,10 +20,12 @@
import java.util.Collection;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
+import javolution.util.FastList;
+
import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityListIterator;
@@ -40,15 +42,15 @@
public static final String module = Iterate.class.getName();
- protected List<MethodOperation> subOps = new LinkedList();
+ protected List<MethodOperation> subOps = FastList.newInstance();
- protected ContextAccessor entryAcsr;
- protected ContextAccessor listAcsr;
+ protected ContextAccessor<GenericValue> entryAcsr;
+ protected ContextAccessor<Object> listAcsr;
public Iterate(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.entryAcsr = new ContextAccessor(element.getAttribute("entry-name"));
- this.listAcsr = new ContextAccessor(element.getAttribute("list-name"));
+ this.entryAcsr = new ContextAccessor<GenericValue>(element.getAttribute("entry-name"));
+ this.listAcsr = new ContextAccessor<Object>(element.getAttribute("list-name"));
SimpleMethod.readOperations(element, subOps, simpleMethod);
}
@@ -60,13 +62,13 @@
return true;
}
- Object oldEntryValue = entryAcsr.get(methodContext);
+ GenericValue oldEntryValue = entryAcsr.get(methodContext);
Object objList = listAcsr.get(methodContext);
if (objList instanceof EntityListIterator) {
EntityListIterator eli = (EntityListIterator) objList;
GenericValue theEntry;
- while ((theEntry = (GenericValue) eli.next()) != null) {
+ while ((theEntry = eli.next()) != null) {
entryAcsr.put(methodContext, theEntry);
if (!SimpleMethod.runSubOps(subOps, methodContext)) {
@@ -91,7 +93,7 @@
return false;
}
} else {
- Collection theList = (Collection) objList;
+ Collection<GenericValue> theList = UtilGenerics.checkList(objList);
if (theList == null) {
if (Debug.infoOn()) Debug.logInfo("List not found with name " + listAcsr + ", doing nothing: " + rawString(), module);
@@ -102,10 +104,7 @@
return true;
}
- Iterator theIterator = theList.iterator();
-
- while (theIterator.hasNext()) {
- Object theEntry = theIterator.next();
+ for (GenericValue theEntry: theList) {
entryAcsr.put(methodContext, theEntry);
if (!SimpleMethod.runSubOps(subOps, methodContext)) {
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/IterateMap.java Sun Aug 3 20:00:54 2008
@@ -19,7 +19,6 @@
package org.ofbiz.minilang.method.envops;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -41,15 +40,15 @@
List<MethodOperation> subOps = FastList.newInstance();
- ContextAccessor keyAcsr;
- ContextAccessor valueAcsr;
- ContextAccessor mapAcsr;
+ ContextAccessor<Object> keyAcsr;
+ ContextAccessor<Object> valueAcsr;
+ ContextAccessor<Map<? extends Object, ? extends Object>> mapAcsr;
public IterateMap(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.keyAcsr = new ContextAccessor(element.getAttribute("key-name"));
- this.valueAcsr = new ContextAccessor(element.getAttribute("value-name"));
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
+ this.keyAcsr = new ContextAccessor<Object>(element.getAttribute("key-name"));
+ this.valueAcsr = new ContextAccessor<Object>(element.getAttribute("value-name"));
+ this.mapAcsr = new ContextAccessor<Map<? extends Object, ? extends Object>>(element.getAttribute("map-name"));
SimpleMethod.readOperations(element, subOps, simpleMethod);
}
@@ -71,7 +70,7 @@
Debug.logWarning("In iterate-map the value had a non-null value before entering the loop for the operation: " + this.rawString(), module);
}
- Map theMap = (Map) mapAcsr.get(methodContext);
+ Map<? extends Object, ? extends Object> theMap = mapAcsr.get(methodContext);
if (theMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", doing nothing: " + rawString(), module);
return true;
@@ -81,9 +80,7 @@
return true;
}
- Iterator theIterator = theMap.entrySet().iterator();
- while (theIterator.hasNext()) {
- Map.Entry theEntry = (Map.Entry) theIterator.next();
+ for (Map.Entry<? extends Object, ? extends Object> theEntry: theMap.entrySet()) {
keyAcsr.put(methodContext, theEntry.getKey());
valueAcsr.put(methodContext, theEntry.getValue());
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ListToList.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastList;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
@@ -32,19 +34,19 @@
public static final String module = ListToList.class.getName();
- ContextAccessor listAcsr;
- ContextAccessor toListAcsr;
+ ContextAccessor<List<Object>> listAcsr;
+ ContextAccessor<List<Object>> toListAcsr;
public ListToList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- listAcsr = new ContextAccessor(element.getAttribute("list-name"));
- toListAcsr = new ContextAccessor(element.getAttribute("to-list-name"));
+ listAcsr = new ContextAccessor<List<Object>>(element.getAttribute("list-name"));
+ toListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("to-list-name"));
}
public boolean exec(MethodContext methodContext) {
- List fromList = (List) listAcsr.get(methodContext);
- List toList = (List) toListAcsr.get(methodContext);
+ List<Object> fromList = listAcsr.get(methodContext);
+ List<Object> toList = toListAcsr.get(methodContext);
if (fromList == null) {
if (Debug.infoOn()) Debug.logInfo("List not found with name " + listAcsr + ", not copying list", module);
@@ -53,7 +55,7 @@
if (toList == null) {
if (Debug.verboseOn()) Debug.logVerbose("List not found with name " + toListAcsr + ", creating new list", module);
- toList = new LinkedList();
+ toList = FastList.newInstance();
toListAcsr.put(methodContext, toList);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/Loop.java Sun Aug 3 20:00:54 2008
@@ -19,7 +19,6 @@
package org.ofbiz.minilang.method.envops;
import java.util.List;
-import java.util.LinkedList;
import javolution.util.FastList;
@@ -38,13 +37,13 @@
public static final String module = Loop.class.getName();
protected List<MethodOperation> subOps = FastList.newInstance();
- protected ContextAccessor fieldAcsr;
+ protected ContextAccessor<Integer> fieldAcsr;
protected String countStr;
public Loop(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field"));
+ this.fieldAcsr = new ContextAccessor<Integer>(element.getAttribute("field"));
this.countStr = element.getAttribute("count");
SimpleMethod.readOperations(element, subOps, simpleMethod);
@@ -69,7 +68,7 @@
}
for (int i = 0; i < count; i++) {
- fieldAcsr.put(methodContext, Integer.valueOf(i));
+ fieldAcsr.put(methodContext, i);
if (!SimpleMethod.runSubOps(subOps, methodContext)) {
// only return here if it returns false, otherwise just carry on
return false;
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/MapToMap.java Sun Aug 3 20:00:54 2008
@@ -20,6 +20,8 @@
import java.util.*;
+import javolution.util.FastMap;
+
import org.w3c.dom.*;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
@@ -32,32 +34,32 @@
public static final String module = MapToMap.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor toMapAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Map<String, Object>> toMapAcsr;
public MapToMap(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- toMapAcsr = new ContextAccessor(element.getAttribute("to-map-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ toMapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("to-map-name"));
}
public boolean exec(MethodContext methodContext) {
- Map fromMap = null;
+ Map<String, Object> fromMap = null;
if (!mapAcsr.isEmpty()) {
- fromMap = (Map) mapAcsr.get(methodContext);
+ fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
if (Debug.infoOn()) Debug.logInfo("Map not found with name " + mapAcsr + ", not copying from this map", module);
- fromMap = new HashMap();
+ fromMap = FastMap.newInstance();
mapAcsr.put(methodContext, fromMap);
}
}
if (!toMapAcsr.isEmpty()) {
- Map toMap = (Map) toMapAcsr.get(methodContext);
+ Map<String, Object> toMap = toMapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + toMapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
toMapAcsr.put(methodContext, toMap);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/OrderMapList.java Sun Aug 3 20:00:54 2008
@@ -36,19 +36,16 @@
public static final String module = FieldToList.class.getName();
- protected ContextAccessor listAcsr;
- protected List orderByAcsrList = FastList.newInstance();
+ protected ContextAccessor<List<Map<Object, Object>>> listAcsr;
+ protected List<FlexibleMapAccessor<String>> orderByAcsrList = FastList.newInstance();
protected MapComparator mc;
public OrderMapList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- listAcsr = new ContextAccessor(element.getAttribute("list-name"));
+ listAcsr = new ContextAccessor<List<Map<Object, Object>>>(element.getAttribute("list-name"));
- List orderByElementList = UtilXml.childElementList(element, "order-by");
- Iterator orderByElementIter = orderByElementList.iterator();
- while (orderByElementIter.hasNext()) {
- Element orderByElement = (Element) orderByElementIter.next();
- this.orderByAcsrList.add(new FlexibleMapAccessor(orderByElement.getAttribute("field-name")));
+ for (Element orderByElement: UtilXml.childElementList(element, "order-by")) {
+ this.orderByAcsrList.add(new FlexibleMapAccessor<String>(orderByElement.getAttribute("field-name")));
}
this.mc = new MapComparator(this.orderByAcsrList);
@@ -56,7 +53,7 @@
public boolean exec(MethodContext methodContext) {
- List orderList = (List) listAcsr.get(methodContext);
+ List<Map<Object, Object>> orderList = listAcsr.get(methodContext);
if (orderList == null) {
if (Debug.infoOn()) Debug.logInfo("List not found with name " + listAcsr + ", not ordering/sorting list.", module);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetCalendar.java Sun Aug 3 20:00:54 2008
@@ -39,8 +39,8 @@
public class SetCalendar extends MethodOperation {
public static final String module = SetCalendar.class.getName();
- protected ContextAccessor field;
- protected ContextAccessor fromField;
+ protected ContextAccessor<Timestamp> field;
+ protected ContextAccessor<Object> fromField;
protected FlexibleStringExpander valueExdr;
protected FlexibleStringExpander defaultExdr;
protected FlexibleStringExpander yearsExdr;
@@ -59,8 +59,8 @@
public SetCalendar(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.field = new ContextAccessor(element.getAttribute("field"));
- this.fromField = new ContextAccessor(element.getAttribute("from-field"));
+ this.field = new ContextAccessor<Timestamp>(element.getAttribute("field"));
+ this.fromField = new ContextAccessor<Object>(element.getAttribute("from-field"));
this.valueExdr = new FlexibleStringExpander(element.getAttribute("value"));
this.defaultExdr = new FlexibleStringExpander(element.getAttribute("default-value"));
this.yearsExdr = new FlexibleStringExpander(element.getAttribute("years"));
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java Sun Aug 3 20:00:54 2008
@@ -38,8 +38,8 @@
public class SetOperation extends MethodOperation {
public static final String module = SetOperation.class.getName();
- protected ContextAccessor field;
- protected ContextAccessor fromField;
+ protected ContextAccessor<Object> field;
+ protected ContextAccessor<Object> fromField;
protected FlexibleStringExpander valueExdr;
protected FlexibleStringExpander defaultExdr;
protected String type;
@@ -48,8 +48,8 @@
public SetOperation(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.field = new ContextAccessor(element.getAttribute("field"));
- this.fromField = new ContextAccessor(element.getAttribute("from-field"));
+ this.field = new ContextAccessor<Object>(element.getAttribute("field"));
+ this.fromField = new ContextAccessor<Object>(element.getAttribute("from-field"));
this.valueExdr = new FlexibleStringExpander(element.getAttribute("value"));
this.defaultExdr = new FlexibleStringExpander(element.getAttribute("default-value"));
this.type = element.getAttribute("type");
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringAppend.java Sun Aug 3 20:00:54 2008
@@ -23,6 +23,8 @@
import org.w3c.dom.*;
+import javolution.util.FastMap;
+
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -37,27 +39,27 @@
String string;
String prefix;
String suffix;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- ContextAccessor argListAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<String> fieldAcsr;
+ ContextAccessor<List<? extends Object>> argListAcsr;
public StringAppend(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
string = element.getAttribute("string");
prefix = element.getAttribute("prefix");
suffix = element.getAttribute("suffix");
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- argListAcsr = new ContextAccessor(element.getAttribute("arg-list-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<String>(element.getAttribute("field-name"));
+ argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list-name"));
}
public boolean exec(MethodContext methodContext) {
if (!mapAcsr.isEmpty()) {
- Map toMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> toMap = mapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
@@ -77,13 +79,13 @@
String suffixValue = methodContext.expandString(suffix);
if (!argListAcsr.isEmpty()) {
- List argList = (List) argListAcsr.get(methodContext);
+ List<? extends Object> argList = argListAcsr.get(methodContext);
if (argList != null && argList.size() > 0) {
value = MessageFormat.format(value, argList.toArray());
}
}
- StringBuffer newValue = new StringBuffer();
+ StringBuilder newValue = new StringBuilder();
if (value != null && value.length() > 0) {
if (oldValue == null || oldValue.length() == 0) {
newValue.append(value);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToField.java Sun Aug 3 20:00:54 2008
@@ -23,6 +23,8 @@
import org.w3c.dom.*;
+import javolution.util.FastMap;
+
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -35,17 +37,17 @@
public static final String module = StringToField.class.getName();
String string;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- ContextAccessor argListAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<List<? extends Object>> argListAcsr;
String messageFieldName;
public StringToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
string = element.getAttribute("string");
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- argListAcsr = new ContextAccessor(element.getAttribute("arg-list-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list-name"));
messageFieldName = element.getAttribute("message-field-name");
}
@@ -53,7 +55,7 @@
String valueStr = methodContext.expandString(string);
if (!argListAcsr.isEmpty()) {
- List argList = (List) argListAcsr.get(methodContext);
+ List<? extends Object> argList = argListAcsr.get(methodContext);
if (argList != null && argList.size() > 0) {
valueStr = MessageFormat.format(valueStr, argList.toArray());
}
@@ -67,11 +69,11 @@
}
if (!mapAcsr.isEmpty()) {
- Map toMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> toMap = mapAcsr.get(methodContext);
if (toMap == null) {
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
fieldAcsr.put(toMap, value, methodContext);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/StringToList.java Sun Aug 3 20:00:54 2008
@@ -23,6 +23,8 @@
import org.w3c.dom.*;
+import javolution.util.FastList;
+
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -35,22 +37,22 @@
public static final String module = StringToList.class.getName();
String string;
- ContextAccessor listAcsr;
- ContextAccessor argListAcsr;
+ ContextAccessor<List<Object>> listAcsr;
+ ContextAccessor<List<? extends Object>> argListAcsr;
String messageFieldName;
public StringToList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
string = element.getAttribute("string");
- listAcsr = new ContextAccessor(element.getAttribute("list-name"));
- argListAcsr = new ContextAccessor(element.getAttribute("arg-list-name"));
+ listAcsr = new ContextAccessor<List<Object>>(element.getAttribute("list-name"));
+ argListAcsr = new ContextAccessor<List<? extends Object>>(element.getAttribute("arg-list-name"));
messageFieldName = element.getAttribute("message-field-name");
}
public boolean exec(MethodContext methodContext) {
String valueStr = methodContext.expandString(string);
if (!argListAcsr.isEmpty()) {
- List argList = (List) argListAcsr.get(methodContext);
+ List<? extends Object> argList = argListAcsr.get(methodContext);
if (argList != null && argList.size() > 0) {
valueStr = MessageFormat.format(valueStr, argList.toArray());
}
@@ -63,10 +65,10 @@
value = valueStr;
}
- List toList = (List) listAcsr.get(methodContext);
+ List<Object> toList = listAcsr.get(methodContext);
if (toList == null) {
if (Debug.verboseOn()) Debug.logVerbose("List not found with name " + listAcsr + ", creating new List", module);
- toList = new LinkedList();
+ toList = FastList.newInstance();
listAcsr.put(methodContext, toList);
}
toList.add(value);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/ToString.java Sun Aug 3 20:00:54 2008
@@ -22,6 +22,8 @@
import org.w3c.dom.*;
+import javolution.util.FastMap;
+
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -33,15 +35,15 @@
public static final String module = ToString.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
String format;
Integer numericPadding;
public ToString(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
format = element.getAttribute("format");
String npStr = element.getAttribute("numeric-padding");
@@ -56,13 +58,13 @@
public boolean exec(MethodContext methodContext) {
if (!mapAcsr.isEmpty()) {
- Map toMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> toMap = mapAcsr.get(methodContext);
if (toMap == null) {
// it seems silly to create a new map, but necessary since whenever
// an env field like a Map or List is referenced it should be created, even if empty
if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
- toMap = new HashMap();
+ toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToRequest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToRequest.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToRequest.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToRequest.java Sun Aug 3 20:00:54 2008
@@ -35,15 +35,15 @@
public static final String module = FieldToRequest.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- FlexibleServletAccessor requestAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ FlexibleServletAccessor<Object> requestAcsr;
public FieldToRequest(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- requestAcsr = new FlexibleServletAccessor(element.getAttribute("request-name"), element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ requestAcsr = new FlexibleServletAccessor<Object>(element.getAttribute("request-name"), element.getAttribute("field-name"));
}
public boolean exec(MethodContext methodContext) {
@@ -51,7 +51,7 @@
if (methodContext.getMethodType() == MethodContext.EVENT) {
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr, module);
return true;
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToSession.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToSession.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/FieldToSession.java Sun Aug 3 20:00:54 2008
@@ -35,15 +35,15 @@
public static final String module = FieldToSession.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- FlexibleServletAccessor sessionAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ FlexibleServletAccessor<Object> sessionAcsr;
public FieldToSession(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- sessionAcsr = new FlexibleServletAccessor(element.getAttribute("session-name"), element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ sessionAcsr = new FlexibleServletAccessor<Object>(element.getAttribute("session-name"), element.getAttribute("field-name"));
}
public boolean exec(MethodContext methodContext) {
@@ -51,7 +51,7 @@
if (methodContext.getMethodType() == MethodContext.EVENT) {
Object fieldVal = null;
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr, module);
return true;
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestParametersToList.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestParametersToList.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestParametersToList.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestParametersToList.java Sun Aug 3 20:00:54 2008
@@ -21,6 +21,7 @@
import java.util.*;
import org.w3c.dom.*;
+import javolution.util.FastList;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -32,41 +33,41 @@
public static final String module = RequestParametersToList.class.getName();
- ContextAccessor listAcsr;
+ ContextAccessor<List<String>> listAcsr;
String requestName;
public RequestParametersToList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
requestName = element.getAttribute("request-name");
- listAcsr = new ContextAccessor(element.getAttribute("list-name"), requestName);
+ listAcsr = new ContextAccessor<List<String>>(element.getAttribute("list-name"), requestName);
}
public boolean exec(MethodContext methodContext) {
- Object listVal = null;
+ List<String> listVal = null;
// only run this if it is in an EVENT context
if (methodContext.getMethodType() == MethodContext.EVENT) {
- listVal = methodContext.getRequest().getParameterValues(requestName);
- if (listVal == null) {
+ String[] parameterValues = methodContext.getRequest().getParameterValues(requestName);
+ if (parameterValues == null) {
Debug.logWarning("Request parameter values not found with name " + requestName, module);
+ } else {
+ listVal = UtilMisc.toListArray(parameterValues);
}
}
// if listVal is null, use a empty list;
if (listVal == null) {
- listVal = new ArrayList();
- } else if (listVal instanceof String[]) {
- listVal = UtilMisc.toListArray((String[]) listVal);
+ listVal = FastList.newInstance();
}
- List toList = (List) listAcsr.get(methodContext);
+ List<String> toList = listAcsr.get(methodContext);
if (toList == null) {
if (Debug.verboseOn()) Debug.logVerbose("List not found with name " + listAcsr + ", creating new list", module);
- toList = new ArrayList();
+ toList = FastList.newInstance();
listAcsr.put(methodContext, toList);
}
- toList.addAll((Collection) listVal);
+ toList.addAll(listVal);
return true;
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestToField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/RequestToField.java Sun Aug 3 20:00:54 2008
@@ -18,9 +18,9 @@
*******************************************************************************/
package org.ofbiz.minilang.method.eventops;
-import java.util.HashMap;
import java.util.Map;
+import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.collections.FlexibleServletAccessor;
import org.ofbiz.minilang.SimpleMethod;
@@ -36,16 +36,16 @@
public static final String module = RequestToField.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- FlexibleServletAccessor requestAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ FlexibleServletAccessor<Object> requestAcsr;
String defaultVal;
public RequestToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- requestAcsr = new FlexibleServletAccessor(element.getAttribute("request-name"), element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ requestAcsr = new FlexibleServletAccessor<Object>(element.getAttribute("request-name"), element.getAttribute("field-name"));
defaultVal = element.getAttribute("default");
}
@@ -73,11 +73,11 @@
}
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr + " creating a new map", module);
- fromMap = new HashMap();
+ fromMap = FastMap.newInstance();
mapAcsr.put(methodContext, fromMap);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/SessionToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/SessionToField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/SessionToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/SessionToField.java Sun Aug 3 20:00:54 2008
@@ -18,9 +18,10 @@
*******************************************************************************/
package org.ofbiz.minilang.method.eventops;
-import java.util.HashMap;
import java.util.Map;
+import javolution.util.FastMap;
+
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.collections.FlexibleServletAccessor;
import org.ofbiz.minilang.SimpleMethod;
@@ -36,16 +37,16 @@
public static final String module = SessionToField.class.getName();
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
- FlexibleServletAccessor sessionAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ FlexibleServletAccessor<Object> sessionAcsr;
String defaultVal;
public SessionToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- sessionAcsr = new FlexibleServletAccessor(element.getAttribute("session-name"), element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ sessionAcsr = new FlexibleServletAccessor<Object>(element.getAttribute("session-name"), element.getAttribute("field-name"));
defaultVal = element.getAttribute("default");
}
@@ -73,11 +74,11 @@
}
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr + " creating a new map", module);
- fromMap = new HashMap();
+ fromMap = FastMap.newInstance();
mapAcsr.put(methodContext, fromMap);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java Sun Aug 3 20:00:54 2008
@@ -23,6 +23,7 @@
import javax.servlet.*;
import org.w3c.dom.*;
+import javolution.util.FastMap;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -37,16 +38,16 @@
String resource;
String property;
String defaultVal;
- ContextAccessor mapAcsr;
- ContextAccessor fieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
+ ContextAccessor<Object> fieldAcsr;
public WebappPropertyToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
resource = element.getAttribute("resource");
property = element.getAttribute("property");
defaultVal = element.getAttribute("default");
- mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
+ mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
+ fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
}
public boolean exec(MethodContext methodContext) {
@@ -83,11 +84,11 @@
}
if (!mapAcsr.isEmpty()) {
- Map fromMap = (Map) mapAcsr.get(methodContext);
+ Map<String, Object> fromMap = mapAcsr.get(methodContext);
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr + " creating a new map", module);
- fromMap = new HashMap();
+ fromMap = FastMap.newInstance();
mapAcsr.put(methodContext, fromMap);
}
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckId.java Sun Aug 3 20:00:54 2008
@@ -21,6 +21,7 @@
import java.util.*;
import org.w3c.dom.*;
+import javolution.util.FastList;
import org.ofbiz.base.util.*;
import org.ofbiz.minilang.*;
import org.ofbiz.minilang.method.*;
@@ -37,15 +38,15 @@
String propertyResource = null;
boolean isProperty = false;
- ContextAccessor fieldAcsr;
- ContextAccessor mapAcsr;
- ContextAccessor errorListAcsr;
+ ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<List<Object>> errorListAcsr;
public CheckId(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
- this.fieldAcsr = new ContextAccessor(element.getAttribute("field-name"));
- this.mapAcsr = new ContextAccessor(element.getAttribute("map-name"));
- this.errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list");
+ this.fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field-name"));
+ this.mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map-name"));
+ this.errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list");
//note: if no fail-message or fail-property then message will be null
Element failMessage = UtilXml.firstChildElement(element, "fail-message");
@@ -64,15 +65,15 @@
public boolean exec(MethodContext methodContext) {
boolean isValid = true;
- 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);
}
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);
@@ -85,7 +86,7 @@
}
String fieldStr = fieldVal.toString();
- StringBuffer errorDetails = new StringBuffer();
+ StringBuilder errorDetails = new StringBuilder();
//check various illegal characters, etc for ids
isValid = UtilValidate.isValidDatabaseId(fieldStr, errorDetails);
@@ -97,7 +98,7 @@
return true;
}
- public void addMessage(List messages, MethodContext methodContext, String defaultMessage, String errorDetails) {
+ public void addMessage(List<Object> messages, MethodContext methodContext, String defaultMessage, String errorDetails) {
String message = methodContext.expandString(this.message);
String propertyResource = methodContext.expandString(this.propertyResource);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/CheckPermission.java Sun Aug 3 20:00:54 2008
@@ -19,10 +19,11 @@
package org.ofbiz.minilang.method.ifops;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import javolution.util.FastList;
+
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
@@ -45,29 +46,27 @@
boolean isProperty = false;
/** If null no partyId env-name will be checked against the userLogin.partyId and accepted as permission */
- ContextAccessor acceptUlPartyIdEnvNameAcsr = null;
+ ContextAccessor<String> acceptUlPartyIdEnvNameAcsr = null;
PermissionInfo permissionInfo;
- ContextAccessor errorListAcsr;
- List altPermissions = null;
+ ContextAccessor<List<Object>> errorListAcsr;
+ List<PermissionInfo> altPermissions = null;
public CheckPermission(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
permissionInfo = new PermissionInfo(element);
- this.errorListAcsr = new ContextAccessor(element.getAttribute("error-list-name"), "error_list");
+ this.errorListAcsr = new ContextAccessor<List<Object>>(element.getAttribute("error-list-name"), "error_list");
Element acceptUserloginPartyElement = UtilXml.firstChildElement(element, "accept-userlogin-party");
if (acceptUserloginPartyElement != null) {
- acceptUlPartyIdEnvNameAcsr = new ContextAccessor(acceptUserloginPartyElement.getAttribute("party-id-env-name"), "partyId");
+ acceptUlPartyIdEnvNameAcsr = new ContextAccessor<String>(acceptUserloginPartyElement.getAttribute("party-id-env-name"), "partyId");
}
- List altPermElements = UtilXml.childElementList(element, "alt-permission");
- Iterator apeIter = altPermElements.iterator();
- if (apeIter.hasNext()) {
- altPermissions = new LinkedList();
+ List<? extends Element> altPermElements = UtilXml.childElementList(element, "alt-permission");
+ if (!altPermElements.isEmpty()) {
+ altPermissions = FastList.newInstance();
}
- while (apeIter.hasNext()) {
- Element altPermElement = (Element) apeIter.next();
+ for (Element altPermElement: altPermElements) {
altPermissions.add(new PermissionInfo(altPermElement));
}
@@ -86,9 +85,9 @@
public boolean exec(MethodContext methodContext) {
boolean hasPermission = false;
- 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);
}
@@ -102,9 +101,7 @@
// if failed, check alternate permissions
if (!hasPermission && altPermissions != null) {
- Iterator altPermIter = altPermissions.iterator();
- while (altPermIter.hasNext()) {
- PermissionInfo altPermInfo = (PermissionInfo) altPermIter.next();
+ for (PermissionInfo altPermInfo: altPermissions) {
if (altPermInfo.hasPermission(methodContext, userLogin, security)) {
hasPermission = true;
break;
@@ -117,9 +114,9 @@
String acceptPartyId = (String) acceptUlPartyIdEnvNameAcsr.get(methodContext);
if (UtilValidate.isEmpty(acceptPartyId)) {
// try the parameters Map
- Map parameters = (Map) methodContext.getEnv("parameters");
+ Map<String, Object> parameters = methodContext.getEnv("parameters");
if (parameters != null) {
- acceptPartyId = (String) acceptUlPartyIdEnvNameAcsr.get(parameters, methodContext);
+ acceptPartyId = acceptUlPartyIdEnvNameAcsr.get(parameters, methodContext);
}
}
if (UtilValidate.isNotEmpty(acceptPartyId) && UtilValidate.isNotEmpty(userLogin.getString("partyId")) && acceptPartyId.equals(userLogin.getString("partyId"))) {
@@ -134,7 +131,7 @@
return true;
}
- public void addMessage(List messages, MethodContext methodContext) {
+ public void addMessage(List<Object> messages, MethodContext methodContext) {
String message = methodContext.expandString(this.message);
String propertyResource = methodContext.expandString(this.propertyResource);
Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java?rev=682246&r1=682245&r2=682246&view=diff
==============================================================================
--- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java (original)
+++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ifops/IfCompare.java Sun Aug 3 20:00:54 2008
@@ -39,8 +39,8 @@
protected List<MethodOperation> subOps = FastList.newInstance();
protected List<MethodOperation> elseSubOps = null;
- protected ContextAccessor mapAcsr;
- protected ContextAccessor fieldAcsr;
+ protected ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ protected ContextAccessor<Object> fieldAcsr;
protected String value;
protected String operator;
@@ -50,11 +50,11 @@
public IfCompare(Element element, SimpleMethod simpleMethod) {
super(element, 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");
@@ -81,7 +81,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 {
@@ -97,16 +97,15 @@
fieldVal = "";
}
- List messages = FastList.newInstance();
+ 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);