You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2012/04/19 17:09:08 UTC
svn commit: r1327981 [6/9] - 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/GetRelated.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/GetRelated.java?rev=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -34,24 +34,15 @@ import org.w3c.dom.Element;
* Gets a list of related entity instance according to the specified relation-name
*/
public class GetRelated extends MethodOperation {
- public static final class GetRelatedFactory implements Factory<GetRelated> {
- public GetRelated createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new GetRelated(element, simpleMethod);
- }
-
- public String getName() {
- return "get-related";
- }
- }
public static final String module = GetRelated.class.getName();
- ContextAccessor<GenericValue> valueAcsr;
+ ContextAccessor<List<GenericValue>> listAcsr;
ContextAccessor<Map<String, ? extends Object>> mapAcsr;
ContextAccessor<List<String>> orderByListAcsr;
String relationName;
String useCacheStr;
- ContextAccessor<List<GenericValue>> listAcsr;
+ ContextAccessor<GenericValue> valueAcsr;
public GetRelated(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -60,7 +51,6 @@ public class GetRelated extends MethodOp
listAcsr = new ContextAccessor<List<GenericValue>>(element.getAttribute("list"), element.getAttribute("list-name"));
mapAcsr = new ContextAccessor<Map<String, ? extends Object>>(element.getAttribute("map"), element.getAttribute("map-name"));
orderByListAcsr = new ContextAccessor<List<String>>(element.getAttribute("order-by-list"), element.getAttribute("order-by-list-name"));
-
useCacheStr = element.getAttribute("use-cache");
}
@@ -69,7 +59,6 @@ public class GetRelated extends MethodOp
String relationName = methodContext.expandString(this.relationName);
String useCacheStr = methodContext.expandString(this.useCacheStr);
boolean useCache = "true".equals(useCacheStr);
-
List<String> orderByNames = null;
if (!orderByListAcsr.isEmpty()) {
orderByNames = orderByListAcsr.get(methodContext);
@@ -78,7 +67,6 @@ public class GetRelated extends MethodOp
if (!mapAcsr.isEmpty()) {
constraintMap = mapAcsr.get(methodContext);
}
-
GenericValue value = valueAcsr.get(methodContext);
if (value == null) {
Debug.logWarning("Value not found with name: " + valueAcsr + ", not getting related...", module);
@@ -99,17 +87,29 @@ public class GetRelated extends MethodOp
return true;
}
+ @Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
public String getRelationName() {
return this.relationName;
}
+
@Override
public String rawString() {
// TODO: something more than the empty tag
return "<get-related/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class GetRelatedFactory implements Factory<GetRelated> {
+ public GetRelated createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new GetRelated(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "get-related";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,22 +31,13 @@ import org.w3c.dom.Element;
* Gets a list of related entity instance according to the specified relation-name
*/
public class GetRelatedOne extends MethodOperation {
- public static final class GetRelatedOneFactory implements Factory<GetRelatedOne> {
- public GetRelatedOne createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new GetRelatedOne(element, simpleMethod);
- }
-
- public String getName() {
- return "get-related-one";
- }
- }
public static final String module = GetRelatedOne.class.getName();
- ContextAccessor<Object> valueAcsr;
- ContextAccessor<GenericValue> toValueAcsr;
String relationName;
+ ContextAccessor<GenericValue> toValueAcsr;
String useCacheStr;
+ ContextAccessor<Object> valueAcsr;
public GetRelatedOne(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -61,7 +52,6 @@ public class GetRelatedOne extends Metho
String relationName = methodContext.expandString(this.relationName);
String useCacheStr = methodContext.expandString(this.useCacheStr);
boolean useCache = "true".equals(useCacheStr);
-
Object valueObject = valueAcsr.get(methodContext);
if (!(valueObject instanceof GenericValue)) {
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [env variable for value-name " + valueAcsr.toString() + " is not a GenericValue object; for the relation-name: " + relationName + "]";
@@ -89,17 +79,29 @@ public class GetRelatedOne extends Metho
return true;
}
+ @Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
public String getRelationName() {
return this.relationName;
}
+
@Override
public String rawString() {
// TODO: something more than the empty tag
return "<get-related-one/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class GetRelatedOneFactory implements Factory<GetRelatedOne> {
+ public GetRelatedOne createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new GetRelatedOne(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "get-related-one";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,28 +31,18 @@ import org.w3c.dom.Element;
* Look at existing values for a sub-entity with a sequenced secondary ID, and get the highest plus 1
*/
public class MakeNextSeqId extends MethodOperation {
- public static final class MakeNextSeqIdFactory implements Factory<MakeNextSeqId> {
- public MakeNextSeqId createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new MakeNextSeqId(element, simpleMethod);
- }
-
- public String getName() {
- return "make-next-seq-id";
- }
- }
public static final String module = MakeNextSeqId.class.getName();
+ String incrementByStr;
+ String numericPaddingStr;
String seqFieldName;
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<GenericValue>(element.getAttribute("value-field"), element.getAttribute("value-name"));
-
numericPaddingStr = element.getAttribute("numeric-padding");
incrementByStr = element.getAttribute("increment-by");
}
@@ -78,21 +68,30 @@ public class MakeNextSeqId extends Metho
} catch (Exception e) {
Debug.logError(e, "increment-by format invalid for [" + incrementByStr + "]", module);
}
-
GenericValue value = valueAcsr.get(methodContext);
methodContext.getDelegator().setNextSubSeqId(value, seqFieldName, numericPadding, incrementBy);
-
return true;
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<make-next-seq-id/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class MakeNextSeqIdFactory implements Factory<MakeNextSeqId> {
+ public MakeNextSeqId createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new MakeNextSeqId(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "make-next-seq-id";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -18,30 +18,23 @@
*******************************************************************************/
package org.ofbiz.minilang.method.entityops;
-import java.util.*;
+import java.util.Map;
-import org.w3c.dom.*;
import org.ofbiz.entity.GenericValue;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
/**
* Uses the delegator to find entity values by anding the map fields
*/
public class MakeValue extends MethodOperation {
- public static final class MakeValueFactory implements Factory<MakeValue> {
- public MakeValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new MakeValue(element, simpleMethod);
- }
- public String getName() {
- return "make-value";
- }
- }
-
- ContextAccessor<GenericValue> valueAcsr;
String entityName;
ContextAccessor<Map<String, ? extends Object>> mapAcsr;
+ ContextAccessor<GenericValue> valueAcsr;
public MakeValue(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -58,6 +51,12 @@ public class MakeValue extends MethodOpe
return true;
}
+ @Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
public String getEntityName() {
return this.entityName;
}
@@ -67,9 +66,14 @@ public class MakeValue extends MethodOpe
// TODO: something more than the empty tag
return "<make-value/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class MakeValueFactory implements Factory<MakeValue> {
+ public MakeValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new MakeValue(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "make-value";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -18,33 +18,16 @@
*******************************************************************************/
package org.ofbiz.minilang.method.entityops;
-import org.w3c.dom.*;
-
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
/**
* Creates a java.sql.Date with the current date and puts it in the env
*/
public class NowDateToEnv extends MethodOperation {
- public static final class NowDateToEnvFactory implements Factory<NowDateToEnv> {
- public NowDateToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new NowDateToEnv(element, simpleMethod);
- }
-
- public String getName() {
- return "now-date-to-env";
- }
- }
- public static final class NowDateFactory implements Factory<NowDateToEnv> {
- public NowDateToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new NowDateToEnv(element, simpleMethod);
- }
-
- public String getName() {
- return "now-date";
- }
- }
ContextAccessor<java.sql.Date> envAcsr;
@@ -60,13 +43,34 @@ public class NowDateToEnv extends Method
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<now-date-to-env/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class NowDateFactory implements Factory<NowDateToEnv> {
+ public NowDateToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new NowDateToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "now-date";
+ }
+ }
+
+ public static final class NowDateToEnvFactory implements Factory<NowDateToEnv> {
+ public NowDateToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new NowDateToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "now-date-to-env";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -18,33 +18,16 @@
*******************************************************************************/
package org.ofbiz.minilang.method.entityops;
-import org.w3c.dom.*;
-
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
/**
* Creates a java.sql.Timestamp with the current date/time in it and puts it in the env
*/
public class NowTimestampToEnv extends MethodOperation {
- public static final class NowTimestampToEnvFactory implements Factory<NowTimestampToEnv> {
- public NowTimestampToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new NowTimestampToEnv(element, simpleMethod);
- }
-
- public String getName() {
- return "now-timestamp-to-env";
- }
- }
- public static final class NowTimestampFactory implements Factory<NowTimestampToEnv> {
- public NowTimestampToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new NowTimestampToEnv(element, simpleMethod);
- }
-
- public String getName() {
- return "now-timestamp";
- }
- }
ContextAccessor<java.sql.Timestamp> envAcsr;
@@ -60,13 +43,34 @@ public class NowTimestampToEnv extends M
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<now-timestamp-to-env/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class NowTimestampFactory implements Factory<NowTimestampToEnv> {
+ public NowTimestampToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new NowTimestampToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "now-timestamp";
+ }
+ }
+
+ public static final class NowTimestampToEnvFactory implements Factory<NowTimestampToEnv> {
+ public NowTimestampToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new NowTimestampToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "now-timestamp-to-env";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -32,19 +32,10 @@ import org.w3c.dom.Element;
* Order the given list of GenericValue objects
*/
public class OrderValueList extends MethodOperation {
- public static final class OrderValueListFactory implements Factory<OrderValueList> {
- public OrderValueList createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new OrderValueList(element, simpleMethod);
- }
-
- public String getName() {
- return "order-value-list";
- }
- }
ContextAccessor<List<? extends GenericEntity>> listAcsr;
- ContextAccessor<List<? extends GenericEntity>> toListAcsr;
ContextAccessor<List<String>> orderByListAcsr;
+ ContextAccessor<List<? extends GenericEntity>> toListAcsr;
public OrderValueList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -59,7 +50,6 @@ public class OrderValueList extends Meth
@Override
public boolean exec(MethodContext methodContext) {
List<String> orderByList = null;
-
if (!orderByListAcsr.isEmpty()) {
orderByList = orderByListAcsr.get(methodContext);
}
@@ -68,13 +58,24 @@ public class OrderValueList extends Meth
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<order-value-list/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class OrderValueListFactory implements Factory<OrderValueList> {
+ public OrderValueList createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new OrderValueList(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "order-value-list";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,20 +31,11 @@ import org.w3c.dom.Element;
* Uses the delegator to refresh the specified value object entity from the datasource
*/
public class RefreshValue extends MethodOperation {
- public static final class RefreshValueFactory implements Factory<RefreshValue> {
- public RefreshValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new RefreshValue(element, simpleMethod);
- }
-
- public String getName() {
- return "refresh-value";
- }
- }
public static final String module = RemoveValue.class.getName();
- ContextAccessor<GenericValue> valueAcsr;
String doCacheClearStr;
+ ContextAccessor<GenericValue> valueAcsr;
public RefreshValue(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -55,7 +46,6 @@ public class RefreshValue extends Method
@Override
public boolean exec(MethodContext methodContext) {
boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr));
-
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";
@@ -63,7 +53,6 @@ public class RefreshValue extends Method
methodContext.setErrorReturn(errMsg, simpleMethod);
return false;
}
-
try {
methodContext.getDelegator().refresh(value, doCacheClear);
} catch (GenericEntityException e) {
@@ -76,13 +65,24 @@ public class RefreshValue extends Method
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<refresh-value/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class RefreshValueFactory implements Factory<RefreshValue> {
+ public RefreshValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new RefreshValue(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "refresh-value";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -32,21 +32,12 @@ import org.w3c.dom.Element;
* Uses the delegator to remove entity values constrained by anding the map fields
*/
public class RemoveByAnd extends MethodOperation {
- public static final class RemoveByAndFactory implements Factory<RemoveByAnd> {
- public RemoveByAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new RemoveByAnd(element, simpleMethod);
- }
-
- public String getName() {
- return "remove-by-and";
- }
- }
public static final String module = RemoveByAnd.class.getName();
+ String doCacheClearStr;
String entityName;
ContextAccessor<Map<String, ? extends Object>> mapAcsr;
- String doCacheClearStr;
public RemoveByAnd(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -59,13 +50,11 @@ public class RemoveByAnd extends MethodO
public boolean exec(MethodContext methodContext) {
boolean doCacheClear = !"false".equals(doCacheClearStr);
String entityName = methodContext.expandString(this.entityName);
-
try {
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() + "]";
-
if (methodContext.getMethodType() == MethodContext.EVENT) {
methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -79,13 +68,24 @@ public class RemoveByAnd extends MethodO
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<remove-by-and/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class RemoveByAndFactory implements Factory<RemoveByAnd> {
+ public RemoveByAnd createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new RemoveByAnd(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "remove-by-and";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -33,20 +33,11 @@ import org.w3c.dom.Element;
* Uses the delegator to remove the specified value object (or psuedo-pk) list from the datasource
*/
public class RemoveList extends MethodOperation {
- public static final class RemoveListFactory implements Factory<RemoveList> {
- public RemoveList createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new RemoveList(element, simpleMethod);
- }
-
- public String getName() {
- return "remove-list";
- }
- }
public static final String module = RemoveList.class.getName();
- ContextAccessor<List<GenericValue>> listAcsr;
String doCacheClearStr;
+ ContextAccessor<List<GenericValue>> listAcsr;
public RemoveList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -57,11 +48,9 @@ public class RemoveList extends MethodOp
@Override
public boolean exec(MethodContext methodContext) {
boolean doCacheClear = !"false".equals(doCacheClearStr);
-
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";
-
Debug.logWarning(errMsg, module);
if (methodContext.getMethodType() == MethodContext.EVENT) {
methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
@@ -72,13 +61,11 @@ public class RemoveList extends MethodOp
}
return false;
}
-
try {
methodContext.getDelegator().removeAll(values, doCacheClear);
} catch (GenericEntityException e) {
Debug.logError(e, module);
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem removing the " + listAcsr + " value list: " + e.getMessage() + "]";
-
if (methodContext.getMethodType() == MethodContext.EVENT) {
methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -92,13 +79,24 @@ public class RemoveList extends MethodOp
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<remove-list/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class RemoveListFactory implements Factory<RemoveList> {
+ public RemoveList createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new RemoveList(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "remove-list";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,21 +31,12 @@ import org.w3c.dom.Element;
* Uses the delegator to remove entities related to the specified value object from the datasource
*/
public class RemoveRelated extends MethodOperation {
- public static final class RemoveRelatedFactory implements Factory<RemoveRelated> {
- public RemoveRelated createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new RemoveRelated(element, simpleMethod);
- }
-
- public String getName() {
- return "remove-related";
- }
- }
public static final String module = RemoveRelated.class.getName();
- ContextAccessor<GenericValue> valueAcsr;
- String relationName;
String doCacheClearStr;
+ String relationName;
+ ContextAccessor<GenericValue> valueAcsr;
public RemoveRelated(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -58,11 +49,9 @@ public class RemoveRelated extends Metho
public boolean exec(MethodContext methodContext) {
boolean doCacheClear = !"false".equals(doCacheClearStr);
String relationName = methodContext.expandString(this.relationName);
-
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";
-
Debug.logWarning(errMsg, module);
if (methodContext.getMethodType() == MethodContext.EVENT) {
methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
@@ -73,13 +62,11 @@ public class RemoveRelated extends Metho
}
return false;
}
-
try {
methodContext.getDelegator().removeRelated(relationName, value, doCacheClear);
} catch (GenericEntityException e) {
Debug.logError(e, module);
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem removing the relation " + relationName + " of the value " + valueAcsr + " value: " + e.getMessage() + "]";
-
if (methodContext.getMethodType() == MethodContext.EVENT) {
methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -93,13 +80,24 @@ public class RemoveRelated extends Metho
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<remove-related/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class RemoveRelatedFactory implements Factory<RemoveRelated> {
+ public RemoveRelated createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new RemoveRelated(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "remove-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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,20 +31,11 @@ import org.w3c.dom.Element;
* Uses the delegator to remove the specified value object entity from the datasource
*/
public class RemoveValue extends MethodOperation {
- public static final class RemoveValueFactory implements Factory<RemoveValue> {
- public RemoveValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new RemoveValue(element, simpleMethod);
- }
-
- public String getName() {
- return "remove-value";
- }
- }
public static final String module = RemoveValue.class.getName();
- ContextAccessor<GenericValue> valueAcsr;
String doCacheClearStr;
+ ContextAccessor<GenericValue> valueAcsr;
public RemoveValue(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -55,7 +46,6 @@ public class RemoveValue extends MethodO
@Override
public boolean exec(MethodContext methodContext) {
boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr));
-
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";
@@ -63,7 +53,6 @@ public class RemoveValue extends MethodO
methodContext.setErrorReturn(errMsg, simpleMethod);
return false;
}
-
try {
methodContext.getDelegator().removeValue(value, doCacheClear);
} catch (GenericEntityException e) {
@@ -76,13 +65,24 @@ public class RemoveValue extends MethodO
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<remove-value/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class RemoveValueFactory implements Factory<RemoveValue> {
+ public RemoveValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new RemoveValue(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "remove-value";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -29,29 +29,10 @@ import org.w3c.dom.Element;
* Gets a sequenced ID from the delegator and puts it in the env
*/
public class SequencedIdToEnv extends MethodOperation {
- public static final class SequencedIdToEnvFactory implements Factory<SequencedIdToEnv> {
- public SequencedIdToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new SequencedIdToEnv(element, simpleMethod);
- }
-
- public String getName() {
- return "sequenced-id-to-env";
- }
- }
- public static final class SequencedIdFactory implements Factory<SequencedIdToEnv> {
- public SequencedIdToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new SequencedIdToEnv(element, simpleMethod);
- }
- public String getName() {
- return "sequenced-id";
- }
- }
-
-
- String seqName;
ContextAccessor<Object> envAcsr;
boolean getLongOnly;
+ String seqName;
long staggerMax = 1;
public SequencedIdToEnv(Element element, SimpleMethod simpleMethod) {
@@ -72,7 +53,6 @@ public class SequencedIdToEnv extends Me
}
}
}
-
@Override
public boolean exec(MethodContext methodContext) {
String seqName = methodContext.expandString(this.seqName);
@@ -85,13 +65,34 @@ public class SequencedIdToEnv extends Me
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<sequenced-id-to-env/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class SequencedIdFactory implements Factory<SequencedIdToEnv> {
+ public SequencedIdToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new SequencedIdToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "sequenced-id";
+ }
+ }
+
+ public static final class SequencedIdToEnvFactory implements Factory<SequencedIdToEnv> {
+ public SequencedIdToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new SequencedIdToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "sequenced-id-to-env";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -30,15 +30,6 @@ import org.w3c.dom.Element;
* Uses the delegator to create the specified value object entity in the datasource
*/
public class SetCurrentUserLogin extends MethodOperation {
- public static final class SetCurrentUserLoginFactory implements Factory<SetCurrentUserLogin> {
- public SetCurrentUserLogin createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new SetCurrentUserLogin(element, simpleMethod);
- }
-
- public String getName() {
- return "set-current-user-login";
- }
- }
public static final String module = SetCurrentUserLogin.class.getName();
@@ -56,19 +47,29 @@ public class SetCurrentUserLogin extends
Debug.logWarning("In SetCurrentUserLogin a value was not found with the specified valueName: " + valueAcsr + ", not setting", module);
return true;
}
-
methodContext.setUserLogin(userLogin, this.simpleMethod.getUserLoginEnvName());
return true;
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<set-current-user-login/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class SetCurrentUserLoginFactory implements Factory<SetCurrentUserLogin> {
+ public SetCurrentUserLogin createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new SetCurrentUserLogin(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "set-current-user-login";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -32,21 +32,12 @@ import org.w3c.dom.Element;
* Looks for each non-PK field in the named map and if it exists there it will copy it into the named value object.
*/
public class SetNonpkFields extends MethodOperation {
- public static final class SetNonpkFieldsFactory implements Factory<SetNonpkFields> {
- public SetNonpkFields createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new SetNonpkFields(element, simpleMethod);
- }
-
- public String getName() {
- return "set-nonpk-fields";
- }
- }
public static final String module = SetNonpkFields.class.getName();
- ContextAccessor<GenericValue> valueAcsr;
ContextAccessor<Map<String, ? extends Object>> mapAcsr;
String setIfNullStr;
+ ContextAccessor<GenericValue> valueAcsr;
public SetNonpkFields(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -59,7 +50,6 @@ public class SetNonpkFields extends Meth
public boolean exec(MethodContext methodContext) {
// if anything but false it will be true
boolean setIfNull = !"false".equals(methodContext.expandString(setIfNullStr));
-
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";
@@ -73,7 +63,6 @@ public class SetNonpkFields extends Meth
}
return false;
}
-
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);
@@ -84,13 +73,24 @@ public class SetNonpkFields extends Meth
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<set-nonpk-fields/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class SetNonpkFieldsFactory implements Factory<SetNonpkFields> {
+ public SetNonpkFields createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new SetNonpkFields(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "set-nonpk-fields";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -32,21 +32,12 @@ import org.w3c.dom.Element;
* Looks for each PK field in the named map and if it exists there it will copy it into the named value object.
*/
public class SetPkFields extends MethodOperation {
- public static final class SetPkFieldsFactory implements Factory<SetPkFields> {
- public SetPkFields createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new SetPkFields(element, simpleMethod);
- }
-
- public String getName() {
- return "set-pk-fields";
- }
- }
public static final String module = SetPkFields.class.getName();
- ContextAccessor<GenericValue> valueAcsr;
ContextAccessor<Map<String, ? extends Object>> mapAcsr;
String setIfNullStr;
+ ContextAccessor<GenericValue> valueAcsr;
public SetPkFields(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -59,7 +50,6 @@ public class SetPkFields extends MethodO
public boolean exec(MethodContext methodContext) {
// if anything but false it will be true
boolean setIfNull = !"false".equals(methodContext.expandString(setIfNullStr));
-
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";
@@ -74,7 +64,6 @@ public class SetPkFields extends MethodO
}
return false;
}
-
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);
@@ -85,13 +74,24 @@ public class SetPkFields extends MethodO
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<set-pk-fields/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class SetPkFieldsFactory implements Factory<SetPkFields> {
+ public SetPkFields createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new SetPkFields(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "set-pk-fields";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -33,20 +33,11 @@ import org.w3c.dom.Element;
* Uses the delegator to store the specified value object list in the datasource
*/
public class StoreList extends MethodOperation {
- public static final class StoreListFactory implements Factory<StoreList> {
- public StoreList createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new StoreList(element, simpleMethod);
- }
-
- public String getName() {
- return "store-list";
- }
- }
public static final String module = StoreList.class.getName();
- ContextAccessor<List<GenericValue>> listAcsr;
String doCacheClearStr;
+ ContextAccessor<List<GenericValue>> listAcsr;
public StoreList(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -57,19 +48,16 @@ public class StoreList extends MethodOpe
@Override
public boolean exec(MethodContext methodContext) {
boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr));
-
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);
}
-
try {
methodContext.getDelegator().storeAll(values, doCacheClear);
} catch (GenericEntityException e) {
Debug.logError(e, module);
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem storing the " + listAcsr + " value list: " + e.getMessage() + "]";
-
if (methodContext.getMethodType() == MethodContext.EVENT) {
methodContext.putEnv(simpleMethod.getEventErrorMessageName(), errMsg);
methodContext.putEnv(simpleMethod.getEventResponseCodeName(), simpleMethod.getDefaultErrorCode());
@@ -83,13 +71,24 @@ public class StoreList extends MethodOpe
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<store-list/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class StoreListFactory implements Factory<StoreList> {
+ public StoreList createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new StoreList(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "store-list";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,20 +31,11 @@ import org.w3c.dom.Element;
* Uses the delegator to store the specified value object entity in the datasource
*/
public class StoreValue extends MethodOperation {
- public static final class StoreValueFactory implements Factory<StoreValue> {
- public StoreValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new StoreValue(element, simpleMethod);
- }
-
- public String getName() {
- return "store-value";
- }
- }
public static final String module = StoreValue.class.getName();
- ContextAccessor<GenericValue> valueAcsr;
String doCacheClearStr;
+ ContextAccessor<GenericValue> valueAcsr;
public StoreValue(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -55,7 +46,6 @@ public class StoreValue extends MethodOp
@Override
public boolean exec(MethodContext methodContext) {
boolean doCacheClear = !"false".equals(methodContext.expandString(doCacheClearStr));
-
GenericValue value = null;
try {
value = valueAcsr.get(methodContext);
@@ -71,7 +61,6 @@ public class StoreValue extends MethodOp
methodContext.setErrorReturn(errMsg, simpleMethod);
return false;
}
-
try {
methodContext.getDelegator().store(value, doCacheClear);
} catch (GenericEntityException e) {
@@ -84,13 +73,24 @@ public class StoreValue extends MethodOp
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<store-value/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class StoreValueFactory implements Factory<StoreValue> {
+ public StoreValue createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new StoreValue(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "store-value";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,15 +31,6 @@ import org.w3c.dom.Element;
* Begins a transaction if one is not already in place; if does begin one puts true in the began-transaction-name env variable, otherwise it returns false.
*/
public class TransactionBegin extends MethodOperation {
- public static final class TransactionBeginFactory implements Factory<TransactionBegin> {
- public TransactionBegin createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new TransactionBegin(element, simpleMethod);
- }
-
- public String getName() {
- return "transaction-begin";
- }
- }
public static final String module = TransactionBegin.class.getName();
@@ -57,24 +48,33 @@ public class TransactionBegin extends Me
beganTransaction = TransactionUtil.begin();
} catch (GenericTransactionException e) {
Debug.logError(e, "Could not begin transaction in simple-method, returning error.", module);
-
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [error beginning a transaction: " + e.getMessage() + "]";
methodContext.setErrorReturn(errMsg, simpleMethod);
return false;
}
-
beganTransactionAcsr.put(methodContext, beganTransaction);
return true;
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<transaction-begin/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class TransactionBeginFactory implements Factory<TransactionBegin> {
+ public TransactionBegin createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new TransactionBegin(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "transaction-begin";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,15 +31,6 @@ import org.w3c.dom.Element;
* Commits a transaction if beganTransaction is true, otherwise does nothing.
*/
public class TransactionCommit extends MethodOperation {
- public static final class TransactionCommitFactory implements Factory<TransactionCommit> {
- public TransactionCommit createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new TransactionCommit(element, simpleMethod);
- }
-
- public String getName() {
- return "transaction-commit";
- }
- }
public static final String module = TransactionCommit.class.getName();
@@ -53,34 +44,41 @@ public class TransactionCommit extends M
@Override
public boolean exec(MethodContext methodContext) {
boolean beganTransaction = false;
-
Boolean beganTransactionBoolean = beganTransactionAcsr.get(methodContext);
if (beganTransactionBoolean != null) {
beganTransaction = beganTransactionBoolean.booleanValue();
}
-
try {
TransactionUtil.commit(beganTransaction);
} catch (GenericTransactionException e) {
Debug.logError(e, "Could not commit transaction in simple-method, returning error.", module);
-
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [error committing a transaction: " + e.getMessage() + "]";
methodContext.setErrorReturn(errMsg, simpleMethod);
return false;
}
-
beganTransactionAcsr.remove(methodContext);
return true;
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<transaction-commit/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class TransactionCommitFactory implements Factory<TransactionCommit> {
+ public TransactionCommit createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new TransactionCommit(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "transaction-commit";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -31,15 +31,6 @@ import org.w3c.dom.Element;
* Rolls back a transaction if beganTransaction is true, otherwise tries to do a setRollbackOnly.
*/
public class TransactionRollback extends MethodOperation {
- public static final class TransactionRollbackFactory implements Factory<TransactionRollback> {
- public TransactionRollback createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new TransactionRollback(element, simpleMethod);
- }
-
- public String getName() {
- return "transaction-rollback";
- }
- }
public static final String module = TransactionRollback.class.getName();
@@ -53,34 +44,41 @@ public class TransactionRollback extends
@Override
public boolean exec(MethodContext methodContext) {
boolean beganTransaction = false;
-
Boolean beganTransactionBoolean = beganTransactionAcsr.get(methodContext);
if (beganTransactionBoolean != null) {
beganTransaction = beganTransactionBoolean.booleanValue();
}
-
try {
TransactionUtil.rollback(beganTransaction, "Explicit rollback in simple-method [" + this.simpleMethod.getShortDescription() + "]", null);
} catch (GenericTransactionException e) {
Debug.logError(e, "Could not rollback transaction in simple-method, returning error.", module);
-
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [error rolling back a transaction: " + e.getMessage() + "]";
methodContext.setErrorReturn(errMsg, simpleMethod);
return false;
}
-
beganTransactionAcsr.remove(methodContext);
return true;
}
@Override
+ public String expandedString(MethodContext methodContext) {
+ // TODO: something more than a stub/dummy
+ return this.rawString();
+ }
+
+ @Override
public String rawString() {
// TODO: something more than the empty tag
return "<transaction-rollback/>";
}
- @Override
- public String expandedString(MethodContext methodContext) {
- // TODO: something more than a stub/dummy
- return this.rawString();
+
+ public static final class TransactionRollbackFactory implements Factory<TransactionRollback> {
+ public TransactionRollback createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new TransactionRollback(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "transaction-rollback";
+ }
}
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -18,38 +18,29 @@
*******************************************************************************/
package org.ofbiz.minilang.method.envops;
-import java.util.*;
+import java.util.Map;
import javolution.util.FastMap;
-import org.w3c.dom.*;
-
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
/**
* Clears the specified field
*/
public class ClearField extends MethodOperation {
- public static final class ClearFieldFactory implements Factory<ClearField> {
- public ClearField createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new ClearField(element, simpleMethod);
- }
-
- public String getName() {
- return "clear-field";
- }
- }
public static final String module = ClearField.class.getName();
- ContextAccessor<Map<String, Object>> mapAcsr;
ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
public ClearField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
-
// the schema for this element now just has the "field" attribute, though the old "field-name" and "map-name" pair is still supported
fieldAcsr = new ContextAccessor<Object>(element.getAttribute("field"), element.getAttribute("field-name"));
mapAcsr = new ContextAccessor<Map<String, Object>>(element.getAttribute("map-name"));
@@ -59,30 +50,39 @@ public class ClearField extends MethodOp
public boolean exec(MethodContext methodContext) {
if (!mapAcsr.isEmpty()) {
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);
+ if (Debug.verboseOn())
+ Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
-
fieldAcsr.put(toMap, null, methodContext);
} else {
fieldAcsr.put(methodContext, null);
}
-
return true;
}
@Override
- public String rawString() {
- return "<clear-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
- }
- @Override
public String expandedString(MethodContext methodContext) {
// TODO: something more than a stub/dummy
return this.rawString();
}
+
+ @Override
+ public String rawString() {
+ return "<clear-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
+ }
+
+ public static final class ClearFieldFactory implements Factory<ClearField> {
+ public ClearField createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new ClearField(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "clear-field";
+ }
+ }
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -30,15 +30,6 @@ import org.w3c.dom.Element;
@Deprecated
@MethodOperation.DeprecatedOperation("set")
public class EnvToEnv extends MethodOperation {
- public static final class EnvToEnvFactory implements Factory<EnvToEnv> {
- public EnvToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new EnvToEnv(element, simpleMethod);
- }
-
- public String getName() {
- return "env-to-env";
- }
- }
public static final String module = EnvToEnv.class.getName();
@@ -58,12 +49,23 @@ public class EnvToEnv extends MethodOper
}
@Override
- public String rawString() {
- return "<env-to-env env-name=\"" + this.envAcsr + "\" to-env-name=\"" + this.toEnvAcsr + "\"/>";
- }
- @Override
public String expandedString(MethodContext methodContext) {
// TODO: something more than a stub/dummy
return this.rawString();
}
+
+ @Override
+ public String rawString() {
+ return "<env-to-env env-name=\"" + this.envAcsr + "\" to-env-name=\"" + this.toEnvAcsr + "\"/>";
+ }
+
+ public static final class EnvToEnvFactory implements Factory<EnvToEnv> {
+ public EnvToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new EnvToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "env-to-env";
+ }
+ }
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -33,28 +33,18 @@ import org.ofbiz.minilang.method.*;
@Deprecated
@MethodOperation.DeprecatedOperation("set")
public class EnvToField extends MethodOperation {
- public static final class EnvToFieldFactory implements Factory<EnvToField> {
- public EnvToField createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new EnvToField(element, simpleMethod);
- }
-
- public String getName() {
- return "env-to-field";
- }
- }
public static final String module = EnvToField.class.getName();
ContextAccessor<Object> envAcsr;
- ContextAccessor<Map<String, Object>> mapAcsr;
ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
public EnvToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
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()) {
fieldAcsr = envAcsr;
@@ -64,17 +54,15 @@ public class EnvToField extends MethodOp
@Override
public boolean exec(MethodContext methodContext) {
Object envVar = envAcsr.get(methodContext);
-
if (envVar == null) {
Debug.logWarning("Environment field not found with name " + envAcsr + ", not copying env field", module);
return true;
}
-
if (!mapAcsr.isEmpty()) {
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);
+ if (Debug.verboseOn())
+ Debug.logVerbose("Map not found with name " + mapAcsr + ", creating new map", module);
toMap = FastMap.newInstance();
mapAcsr.put(methodContext, toMap);
}
@@ -87,12 +75,23 @@ public class EnvToField extends MethodOp
}
@Override
- public String rawString() {
- return "<env-to-field env-name=\"" + this.envAcsr + "\" field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
- }
- @Override
public String expandedString(MethodContext methodContext) {
// TODO: something more than a stub/dummy
return this.rawString();
}
+
+ @Override
+ public String rawString() {
+ return "<env-to-field env-name=\"" + this.envAcsr + "\" field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
+ }
+
+ public static final class EnvToFieldFactory implements Factory<EnvToField> {
+ public EnvToField createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new EnvToField(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "env-to-field";
+ }
+ }
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -18,12 +18,14 @@
*******************************************************************************/
package org.ofbiz.minilang.method.envops;
-import java.util.*;
+import java.util.Map;
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
/**
* Copies a map field to an environment field
@@ -31,28 +33,18 @@ import org.ofbiz.minilang.method.*;
@Deprecated
@MethodOperation.DeprecatedOperation("set")
public class FieldToEnv extends MethodOperation {
- public static final class FieldToEnvFactory implements Factory<FieldToEnv> {
- public FieldToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new FieldToEnv(element, simpleMethod);
- }
-
- public String getName() {
- return "field-to-env";
- }
- }
public static final String module = FieldToEnv.class.getName();
ContextAccessor<Object> envAcsr;
- ContextAccessor<Map<String, ? extends Object>> mapAcsr;
ContextAccessor<Object> fieldAcsr;
+ ContextAccessor<Map<String, ? extends Object>> mapAcsr;
public FieldToEnv(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
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()) {
fieldAcsr = envAcsr;
@@ -66,37 +58,44 @@ public class FieldToEnv extends MethodOp
@Override
public boolean exec(MethodContext methodContext) {
Object fieldVal = null;
-
if (!mapAcsr.isEmpty()) {
Map<String, ? extends Object> fromMap = mapAcsr.get(methodContext);
-
if (fromMap == null) {
Debug.logWarning("Map not found with name " + mapAcsr + ", not copying field", module);
return true;
}
-
fieldVal = fieldAcsr.get(fromMap, methodContext);
} else {
// no map name, try the env
fieldVal = fieldAcsr.get(methodContext);
}
-
if (fieldVal == null) {
- if (Debug.verboseOn()) Debug.logVerbose("Field value not found with name " + fieldAcsr + " in Map with name " + mapAcsr + ", not copying field", module);
+ if (Debug.verboseOn())
+ Debug.logVerbose("Field value not found with name " + fieldAcsr + " in Map with name " + mapAcsr + ", not copying field", module);
return true;
}
-
envAcsr.put(methodContext, fieldVal);
return true;
}
@Override
- public String rawString() {
- return "<field-to-env env-name=\"" + this.envAcsr + "\" field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
- }
- @Override
public String expandedString(MethodContext methodContext) {
// TODO: something more than a stub/dummy
return this.rawString();
}
+
+ @Override
+ public String rawString() {
+ return "<field-to-env env-name=\"" + this.envAcsr + "\" field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\"/>";
+ }
+
+ public static final class FieldToEnvFactory implements Factory<FieldToEnv> {
+ public FieldToEnv createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new FieldToEnv(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "field-to-env";
+ }
+ }
}
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=1327981&r1=1327980&r2=1327981&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 Thu Apr 19 15:09:03 2012
@@ -18,14 +18,16 @@
*******************************************************************************/
package org.ofbiz.minilang.method.envops;
-import java.util.*;
+import java.util.Map;
import javolution.util.FastMap;
-import org.w3c.dom.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.minilang.*;
-import org.ofbiz.minilang.method.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.minilang.SimpleMethod;
+import org.ofbiz.minilang.method.ContextAccessor;
+import org.ofbiz.minilang.method.MethodContext;
+import org.ofbiz.minilang.method.MethodOperation;
+import org.w3c.dom.Element;
/**
* Copies a map field to a map field
@@ -33,22 +35,13 @@ import org.ofbiz.minilang.method.*;
@Deprecated
@MethodOperation.DeprecatedOperation("set")
public class FieldToField extends MethodOperation {
- public static final class FieldToFieldFactory implements Factory<FieldToField> {
- public FieldToField createMethodOperation(Element element, SimpleMethod simpleMethod) {
- return new FieldToField(element, simpleMethod);
- }
-
- public String getName() {
- return "field-to-field";
- }
- }
public static final String module = FieldToField.class.getName();
- ContextAccessor<Map<String, Object>> mapAcsr;
ContextAccessor<Object> fieldAcsr;
- ContextAccessor<Map<String, Object>> toMapAcsr;
+ ContextAccessor<Map<String, Object>> mapAcsr;
ContextAccessor<Object> toFieldAcsr;
+ ContextAccessor<Map<String, Object>> toMapAcsr;
public FieldToField(Element element, SimpleMethod simpleMethod) {
super(element, simpleMethod);
@@ -56,7 +49,6 @@ public class FieldToField extends Method
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()) {
toMapAcsr = mapAcsr;
@@ -69,35 +61,32 @@ public class FieldToField extends Method
@Override
public boolean exec(MethodContext methodContext) {
Object fieldVal = null;
-
if (!mapAcsr.isEmpty()) {
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);
+ if (Debug.infoOn())
+ Debug.logInfo("Map not found with name " + mapAcsr + ", not copying from this map", module);
return true;
}
-
fieldVal = fieldAcsr.get(fromMap, methodContext);
} else {
// no map name, try the env
fieldVal = fieldAcsr.get(methodContext);
}
-
if (fieldVal == null) {
- if (Debug.verboseOn()) Debug.logVerbose("Field value not found with name " + fieldAcsr + " in Map with name " + mapAcsr + ", not copying field", module);
+ if (Debug.verboseOn())
+ Debug.logVerbose("Field value not found with name " + fieldAcsr + " in Map with name " + mapAcsr + ", not copying field", module);
return true;
}
-
// 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<String, Object> toMap = null;
-
if (!toMapAcsr.isEmpty()) {
toMap = toMapAcsr.get(methodContext);
if (toMap == null) {
- if (Debug.verboseOn()) Debug.logVerbose("Map not found with name " + toMapAcsr + ", creating new map", module);
+ if (Debug.verboseOn())
+ Debug.logVerbose("Map not found with name " + toMapAcsr + ", creating new map", module);
toMap = FastMap.newInstance();
toMapAcsr.put(methodContext, toMap);
}
@@ -106,17 +95,27 @@ public class FieldToField extends Method
// no to-map, so put in env
toFieldAcsr.put(methodContext, fieldVal);
}
-
return true;
}
@Override
- public String rawString() {
- return "<field-to-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\" to-field-name=\"" + this.toFieldAcsr + "\" to-map-name=\"" + this.toMapAcsr + "\"/>";
- }
- @Override
public String expandedString(MethodContext methodContext) {
// TODO: something more than a stub/dummy
return this.rawString();
}
+
+ @Override
+ public String rawString() {
+ return "<field-to-field field-name=\"" + this.fieldAcsr + "\" map-name=\"" + this.mapAcsr + "\" to-field-name=\"" + this.toFieldAcsr + "\" to-map-name=\"" + this.toMapAcsr + "\"/>";
+ }
+
+ public static final class FieldToFieldFactory implements Factory<FieldToField> {
+ public FieldToField createMethodOperation(Element element, SimpleMethod simpleMethod) {
+ return new FieldToField(element, simpleMethod);
+ }
+
+ public String getName() {
+ return "field-to-field";
+ }
+ }
}