You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2015/01/05 09:50:36 UTC
svn commit: r1649482 [22/26] - in
/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./
applications/accounting/src/org/ofbiz/accounting/invoice/
applications/accounting/src/org/ofbiz/accounting/payment/
applications/accounting/src/org/ofbiz/ac...
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java Mon Jan 5 08:50:30 2015
@@ -45,63 +45,250 @@ import org.ofbiz.service.DispatchContext
import org.ofbiz.service.GenericServiceException;
import org.ofbiz.service.ModelService;
import org.ofbiz.widget.ModelActionVisitor;
-import org.ofbiz.widget.ModelWidget;
import org.ofbiz.widget.ModelWidgetAction;
import org.ofbiz.widget.WidgetWorker;
+import org.ofbiz.widget.tree.ModelTree.ModelNode;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
- * Widget Library - Tree model class
+ * Abstract tree action.
*/
@SuppressWarnings("serial")
public abstract class ModelTreeAction extends ModelWidgetAction {
+ /*
+ * ----------------------------------------------------------------------- *
+ * DEVELOPERS PLEASE READ
+ * ----------------------------------------------------------------------- *
+ *
+ * This model is intended to be a read-only data structure that represents
+ * an XML element. Outside of object construction, the class should not
+ * have any behaviors.
+ *
+ * Instances of this class will be shared by multiple threads - therefore
+ * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME!
+ *
+ */
+
public static final String module = ModelTreeAction.class.getName();
- protected ModelTree modelTree;
- protected ModelTree.ModelNode.ModelSubNode modelSubNode;
+ public static List<ModelWidgetAction> readNodeActions(ModelNode modelNode, Element actionsElement) {
+ List<? extends Element> actionElementList = UtilXml.childElementList(actionsElement);
+ List<ModelWidgetAction> actions = new ArrayList<ModelWidgetAction>(actionElementList.size());
+ for (Element actionElement : actionElementList) {
+ if ("service".equals(actionElement.getNodeName())) {
+ actions.add(new Service(modelNode, actionElement));
+ } else if ("script".equals(actionElement.getNodeName())) {
+ actions.add(new Script(modelNode, actionElement));
+ } else {
+ actions.add(ModelWidgetAction.newInstance(modelNode, actionElement));
+ }
+ }
+ return actions;
+ }
+
+ public static List<ModelWidgetAction> readSubNodeActions(ModelNode.ModelSubNode modelSubNode, Element actionsElement) {
+ List<? extends Element> actionElementList = UtilXml.childElementList(actionsElement);
+ List<ModelWidgetAction> actions = new ArrayList<ModelWidgetAction>(actionElementList.size());
+ for (Element actionElement : actionElementList) {
+ if ("service".equals(actionElement.getNodeName())) {
+ actions.add(new Service(modelSubNode, actionElement));
+ } else if ("entity-and".equals(actionElement.getNodeName())) {
+ actions.add(new EntityAnd(modelSubNode, actionElement));
+ } else if ("entity-condition".equals(actionElement.getNodeName())) {
+ actions.add(new EntityCondition(modelSubNode, actionElement));
+ } else if ("script".equals(actionElement.getNodeName())) {
+ actions.add(new Script(modelSubNode, actionElement));
+ } else {
+ actions.add(ModelWidgetAction.newInstance(modelSubNode, actionElement));
+ }
+ }
+ return actions;
+ }
+
+ private final ModelNode.ModelSubNode modelSubNode;
+ private final ModelTree modelTree;
- public ModelTreeAction(ModelTree.ModelNode modelNode, Element actionElement) {
- if (Debug.verboseOn()) Debug.logVerbose("Reading Tree action with name: " + actionElement.getNodeName(), module);
+ protected ModelTreeAction(ModelNode modelNode, Element actionElement) {
+ if (Debug.verboseOn())
+ Debug.logVerbose("Reading Tree action with name: " + actionElement.getNodeName(), module);
this.modelTree = modelNode.getModelTree();
+ this.modelSubNode = null;
}
- public ModelTreeAction(ModelTree.ModelNode.ModelSubNode modelSubNode, Element actionElement) {
- if (Debug.verboseOn()) Debug.logVerbose("Reading Tree action with name: " + actionElement.getNodeName(), module);
+ protected ModelTreeAction(ModelNode.ModelSubNode modelSubNode, Element actionElement) {
+ if (Debug.verboseOn())
+ Debug.logVerbose("Reading Tree action with name: " + actionElement.getNodeName(), module);
this.modelSubNode = modelSubNode;
this.modelTree = modelSubNode.getNode().getModelTree();
}
- public static List<ModelWidgetAction> readNodeActions(ModelWidget modelNode, Element actionsElement) {
- List<? extends Element> actionElementList = UtilXml.childElementList(actionsElement);
- List<ModelWidgetAction> actions = new ArrayList<ModelWidgetAction>(actionElementList.size());
- for (Element actionElement : actionElementList) {
- // TODO: Check for tree-specific actions
- actions.add(ModelWidgetAction.toModelWidgetAction(modelNode, actionElement));
+ public ModelNode.ModelSubNode getModelSubNode() {
+ return modelSubNode;
+ }
+
+ public ModelTree getModelTree() {
+ return modelTree;
+ }
+
+ /**
+ * Models the <entity-and> element.
+ *
+ * @see <code>widget-tree.xsd</code>
+ */
+ public static class EntityAnd extends ModelTreeAction {
+ private final ByAndFinder finder;
+ private final String listName;
+
+ public EntityAnd(ModelNode.ModelSubNode modelSubNode, Element entityAndElement) {
+ super(modelSubNode, entityAndElement);
+ boolean useCache = "true".equalsIgnoreCase(entityAndElement.getAttribute("use-cache"));
+ Document ownerDoc = entityAndElement.getOwnerDocument();
+ if (!useCache)
+ UtilXml.addChildElement(entityAndElement, "use-iterator", ownerDoc);
+ String listName = UtilFormatOut.checkEmpty(entityAndElement.getAttribute("list"),
+ entityAndElement.getAttribute("list-name"));
+ if (UtilValidate.isEmpty(listName))
+ listName = "_LIST_ITERATOR_";
+ this.listName = listName;
+ entityAndElement.setAttribute("list-name", this.listName);
+ finder = new ByAndFinder(entityAndElement);
+ }
+
+ @Override
+ public void accept(ModelActionVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public ByAndFinder getFinder() {
+ return finder;
+ }
+
+ public String getListName() {
+ return listName;
+ }
+
+ @Override
+ public void runAction(Map<String, Object> context) {
+ try {
+ context.put(this.listName, null);
+ finder.runFind(context, WidgetWorker.getDelegator(context));
+ Object obj = context.get(this.listName);
+ if (obj != null && (obj instanceof EntityListIterator || obj instanceof ListIterator<?>)) {
+ ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(obj);
+ this.getModelSubNode().setListIterator(listIt, context);
+ } else {
+ if (obj instanceof List<?>) {
+ List<? extends Map<String, ? extends Object>> list = UtilGenerics.checkList(obj);
+ this.getModelSubNode().setListIterator(list.listIterator(), context);
+ }
+ }
+ } catch (GeneralException e) {
+ String errMsg = "Error doing entity query by condition: " + e.toString();
+ Debug.logError(e, errMsg, module);
+ throw new IllegalArgumentException(errMsg);
+ }
}
- return actions;
}
+ /**
+ * Models the <entity-condition> element.
+ *
+ * @see <code>widget-tree.xsd</code>
+ */
+ public static class EntityCondition extends ModelTreeAction {
+ private final ByConditionFinder finder;
+ private final String listName;
+
+ public EntityCondition(ModelNode.ModelSubNode modelSubNode, Element entityConditionElement) {
+ super(modelSubNode, entityConditionElement);
+ Document ownerDoc = entityConditionElement.getOwnerDocument();
+ boolean useCache = "true".equalsIgnoreCase(entityConditionElement.getAttribute("use-cache"));
+ if (!useCache)
+ UtilXml.addChildElement(entityConditionElement, "use-iterator", ownerDoc);
+ String listName = UtilFormatOut.checkEmpty(entityConditionElement.getAttribute("list"),
+ entityConditionElement.getAttribute("list-name"));
+ if (UtilValidate.isEmpty(listName))
+ listName = "_LIST_ITERATOR_";
+ this.listName = listName;
+ entityConditionElement.setAttribute("list-name", this.listName);
+ finder = new ByConditionFinder(entityConditionElement);
+ }
+
+ @Override
+ public void accept(ModelActionVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public ByConditionFinder getFinder() {
+ return finder;
+ }
+
+ public String getListName() {
+ return listName;
+ }
+
+ @Override
+ public void runAction(Map<String, Object> context) {
+ try {
+ context.put(this.listName, null);
+ finder.runFind(context, WidgetWorker.getDelegator(context));
+ Object obj = context.get(this.listName);
+ if (obj != null && (obj instanceof EntityListIterator || obj instanceof ListIterator<?>)) {
+ ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(obj);
+ this.getModelSubNode().setListIterator(listIt, context);
+ } else {
+ if (obj instanceof List<?>) {
+ List<? extends Map<String, ? extends Object>> list = UtilGenerics.cast(obj);
+ this.getModelSubNode().setListIterator(list.listIterator(), context);
+ }
+ }
+ } catch (GeneralException e) {
+ String errMsg = "Error doing entity query by condition: " + e.toString();
+ Debug.logError(e, errMsg, module);
+ throw new IllegalArgumentException(errMsg);
+ }
+ }
+ }
+
+ /**
+ * Models the <script> element.
+ *
+ * @see <code>widget-tree.xsd</code>
+ */
public static class Script extends ModelTreeAction {
- protected String location;
- protected String method;
+ private final String location;
+ private final String method;
- public Script(ModelTree.ModelNode modelNode, Element scriptElement) {
- super (modelNode, scriptElement);
+ public Script(ModelNode modelNode, Element scriptElement) {
+ super(modelNode, scriptElement);
String scriptLocation = scriptElement.getAttribute("location");
this.location = WidgetWorker.getScriptLocation(scriptLocation);
this.method = WidgetWorker.getScriptMethodName(scriptLocation);
}
- public Script(ModelTree.ModelNode.ModelSubNode modelSubNode, Element scriptElement) {
- super (modelSubNode, scriptElement);
+ public Script(ModelNode.ModelSubNode modelSubNode, Element scriptElement) {
+ super(modelSubNode, scriptElement);
String scriptLocation = scriptElement.getAttribute("location");
this.location = WidgetWorker.getScriptLocation(scriptLocation);
this.method = WidgetWorker.getScriptMethodName(scriptLocation);
}
@Override
+ public void accept(ModelActionVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getMethod() {
+ return method;
+ }
+
+ @Override
public void runAction(Map<String, Object> context) {
context.put("_LIST_ITERATOR_", null);
if (location.endsWith(".xml")) {
@@ -119,87 +306,112 @@ public abstract class ModelTreeAction ex
ScriptUtil.executeScript(this.location, this.method, context);
}
Object obj = context.get("_LIST_ITERATOR_");
- if (this.modelSubNode != null) {
+ if (this.getModelSubNode() != null) {
if (obj != null && (obj instanceof EntityListIterator || obj instanceof ListIterator<?>)) {
ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(obj);
- this.modelSubNode.setListIterator(listIt);
+ this.getModelSubNode().setListIterator(listIt, context);
} else {
if (obj instanceof List<?>) {
List<? extends Map<String, ? extends Object>> list = UtilGenerics.checkList(obj);
- this.modelSubNode.setListIterator(list.listIterator());
+ this.getModelSubNode().setListIterator(list.listIterator(), context);
}
}
}
}
-
- @Override
- public void accept(ModelActionVisitor visitor) {
- visitor.visit(this);
- }
}
+ /**
+ * Models the <service> element.
+ *
+ * @see <code>widget-tree.xsd</code>
+ */
public static class Service extends ModelTreeAction {
- protected FlexibleStringExpander serviceNameExdr;
- protected FlexibleMapAccessor<Map<String, Object>> resultMapNameAcsr;
- protected FlexibleStringExpander autoFieldMapExdr;
- protected FlexibleStringExpander resultMapListNameExdr;
- protected FlexibleStringExpander resultMapValueNameExdr;
- protected FlexibleStringExpander valueNameExdr;
- protected Map<FlexibleMapAccessor<Object>, Object> fieldMap;
-
- public Service(ModelTree.ModelNode modelNode, Element serviceElement) {
- super (modelNode, serviceElement);
- initService(serviceElement);
- }
+ private final FlexibleStringExpander autoFieldMapExdr;
+ private final Map<FlexibleMapAccessor<Object>, Object> fieldMap;
+ private final FlexibleStringExpander resultMapListNameExdr;
+ private final FlexibleMapAccessor<Map<String, Object>> resultMapNameAcsr;
+ private final FlexibleStringExpander resultMapValueNameExdr;
+ private final FlexibleStringExpander serviceNameExdr;
+ private final FlexibleStringExpander valueNameExdr;
- public Service(ModelTree.ModelNode.ModelSubNode modelSubNode, Element serviceElement) {
- super (modelSubNode, serviceElement);
- initService(serviceElement);
+ public Service(ModelNode modelNode, Element serviceElement) {
+ super(modelNode, serviceElement);
+ this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name"));
+ this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map"));
+ this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map"));
+ this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list"));
+ this.resultMapValueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-value"));
+ this.valueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("value"));
+ this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
}
- public void initService(Element serviceElement) {
-
+ public Service(ModelNode.ModelSubNode modelSubNode, Element serviceElement) {
+ super(modelSubNode, serviceElement);
this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name"));
this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map"));
- if (this.resultMapNameAcsr.isEmpty()) this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name"));
this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map"));
this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list"));
- if (this.resultMapListNameExdr.isEmpty()) this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-name"));
- if (this.resultMapListNameExdr.isEmpty()) this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-iterator-name"));
this.resultMapValueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-value"));
- if (this.resultMapValueNameExdr.isEmpty()) this.resultMapValueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-value-name"));
this.valueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("value"));
- if (this.valueNameExdr.isEmpty()) this.valueNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("value-name"));
this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
}
@Override
+ public void accept(ModelActionVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ public FlexibleStringExpander getAutoFieldMapExdr() {
+ return autoFieldMapExdr;
+ }
+
+ public Map<FlexibleMapAccessor<Object>, Object> getFieldMap() {
+ return fieldMap;
+ }
+
+ public FlexibleStringExpander getResultMapListNameExdr() {
+ return resultMapListNameExdr;
+ }
+
+ public FlexibleMapAccessor<Map<String, Object>> getResultMapNameAcsr() {
+ return resultMapNameAcsr;
+ }
+
+ public FlexibleStringExpander getResultMapValueNameExdr() {
+ return resultMapValueNameExdr;
+ }
+
+ public FlexibleStringExpander getServiceNameExdr() {
+ return serviceNameExdr;
+ }
+
+ public FlexibleStringExpander getValueNameExdr() {
+ return valueNameExdr;
+ }
+
+ @Override
public void runAction(Map<String, Object> context) {
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
if (UtilValidate.isEmpty(serviceNameExpanded)) {
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
}
-
String autoFieldMapString = this.autoFieldMapExdr.expandString(context);
boolean autoFieldMapBool = !"false".equals(autoFieldMapString);
-
try {
Map<String, Object> serviceContext = null;
if (autoFieldMapBool) {
- serviceContext = this.modelTree.getDispatcher().getDispatchContext().makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, context);
+ serviceContext = WidgetWorker.getDispatcher(context).getDispatchContext()
+ .makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, context);
} else {
serviceContext = new HashMap<String, Object>();
}
-
if (this.fieldMap != null) {
EntityFinderUtil.expandFieldMapToContext(this.fieldMap, context, serviceContext);
}
-
- Map<String, Object> result = this.modelTree.getDispatcher().runSync(serviceNameExpanded, serviceContext);
-
+ Map<String, Object> result = WidgetWorker.getDispatcher(context).runSync(serviceNameExpanded, serviceContext);
if (!this.resultMapNameAcsr.isEmpty()) {
this.resultMapNameAcsr.put(context, result);
- String queryString = (String)result.get("queryString");
+ String queryString = (String) result.get("queryString");
context.put("queryString", queryString);
context.put("queryStringMap", result.get("queryStringMap"));
if (UtilValidate.isNotEmpty(queryString)) {
@@ -217,17 +429,16 @@ public abstract class ModelTreeAction ex
//String resultMapListIteratorName = resultMapListIteratorNameExdr.expandString(context);
String resultMapValueName = resultMapValueNameExdr.expandString(context);
String valueName = valueNameExdr.expandString(context);
-
- if (this.modelSubNode != null) {
+ if (this.getModelSubNode() != null) {
//ListIterator iter = null;
if (UtilValidate.isNotEmpty(resultMapListName)) {
List<? extends Map<String, ? extends Object>> lst = UtilGenerics.checkList(result.get(resultMapListName));
if (lst != null) {
if (lst instanceof ListIterator<?>) {
ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(lst);
- this.modelSubNode.setListIterator(listIt);
+ this.getModelSubNode().setListIterator(listIt, context);
} else {
- this.modelSubNode.setListIterator(lst.listIterator());
+ this.getModelSubNode().setListIterator(lst.listIterator(), context);
}
}
}
@@ -247,100 +458,5 @@ public abstract class ModelTreeAction ex
throw new IllegalArgumentException(errMsg);
}
}
-
- @Override
- public void accept(ModelActionVisitor visitor) {
- visitor.visit(this);
- }
- }
-
- public static class EntityAnd extends ModelTreeAction {
- protected ByAndFinder finder;
- String listName;
-
- public EntityAnd(ModelTree.ModelNode.ModelSubNode modelSubNode, Element entityAndElement) {
- super (modelSubNode, entityAndElement);
- boolean useCache = "true".equalsIgnoreCase(entityAndElement.getAttribute("use-cache"));
- Document ownerDoc = entityAndElement.getOwnerDocument();
- if (!useCache) UtilXml.addChildElement(entityAndElement, "use-iterator", ownerDoc);
-
- this.listName = UtilFormatOut.checkEmpty(entityAndElement.getAttribute("list"), entityAndElement.getAttribute("list-name"));
- if (UtilValidate.isEmpty(this.listName)) this.listName = "_LIST_ITERATOR_";
- entityAndElement.setAttribute("list-name", this.listName);
-
- finder = new ByAndFinder(entityAndElement);
- }
-
- @Override
- public void runAction(Map<String, Object> context) {
- try {
- context.put(this.listName, null);
- finder.runFind(context, this.modelTree.getDelegator());
- Object obj = context.get(this.listName);
- if (obj != null && (obj instanceof EntityListIterator || obj instanceof ListIterator<?>)) {
- ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(obj);
- this.modelSubNode.setListIterator(listIt);
- } else {
- if (obj instanceof List<?>) {
- List<? extends Map<String, ? extends Object>> list = UtilGenerics.checkList(obj);
- this.modelSubNode.setListIterator(list.listIterator());
- }
- }
- } catch (GeneralException e) {
- String errMsg = "Error doing entity query by condition: " + e.toString();
- Debug.logError(e, errMsg, module);
- throw new IllegalArgumentException(errMsg);
- }
- }
-
- @Override
- public void accept(ModelActionVisitor visitor) {
- visitor.visit(this);
- }
- }
-
- public static class EntityCondition extends ModelTreeAction {
- ByConditionFinder finder;
- String listName;
-
- public EntityCondition(ModelTree.ModelNode.ModelSubNode modelSubNode, Element entityConditionElement) {
- super (modelSubNode, entityConditionElement);
- Document ownerDoc = entityConditionElement.getOwnerDocument();
- boolean useCache = "true".equalsIgnoreCase(entityConditionElement.getAttribute("use-cache"));
- if (!useCache) UtilXml.addChildElement(entityConditionElement, "use-iterator", ownerDoc);
-
- this.listName = UtilFormatOut.checkEmpty(entityConditionElement.getAttribute("list"), entityConditionElement.getAttribute("list-name"));
- if (UtilValidate.isEmpty(this.listName)) this.listName = "_LIST_ITERATOR_";
- entityConditionElement.setAttribute("list-name", this.listName);
-
- finder = new ByConditionFinder(entityConditionElement);
- }
-
- @Override
- public void runAction(Map<String, Object> context) {
- try {
- context.put(this.listName, null);
- finder.runFind(context, this.modelTree.getDelegator());
- Object obj = context.get(this.listName);
- if (obj != null && (obj instanceof EntityListIterator || obj instanceof ListIterator<?>)) {
- ListIterator<? extends Map<String, ? extends Object>> listIt = UtilGenerics.cast(obj);
- this.modelSubNode.setListIterator(listIt);
- } else {
- if (obj instanceof List<?>) {
- List<? extends Map<String, ? extends Object>> list = UtilGenerics.cast(obj);
- this.modelSubNode.setListIterator(list.listIterator());
- }
- }
- } catch (GeneralException e) {
- String errMsg = "Error doing entity query by condition: " + e.toString();
- Debug.logError(e, errMsg, module);
- throw new IllegalArgumentException(errMsg);
- }
- }
-
- @Override
- public void accept(ModelActionVisitor visitor) {
- visitor.visit(this);
- }
}
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Mon Jan 5 08:50:30 2015
@@ -18,447 +18,19 @@
*******************************************************************************/
package org.ofbiz.widget.tree;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.PatternMatcher;
-import org.apache.oro.text.regex.Perl5Matcher;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.ObjectType;
-import org.ofbiz.base.util.PatternFactory;
-import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.UtilXml;
-import org.ofbiz.base.util.collections.FlexibleMapAccessor;
-import org.ofbiz.base.util.string.FlexibleStringExpander;
-import org.ofbiz.entity.GenericValue;
-import org.ofbiz.entityext.permission.EntityPermissionChecker;
-import org.ofbiz.minilang.operation.BaseCompare;
-import org.ofbiz.security.Security;
+import org.ofbiz.widget.ModelWidgetCondition;
import org.w3c.dom.Element;
/**
- * Widget Library - Screen model condition class
+ * Models the <condition> element.
+ *
+ * @see <code>widget-tree.xsd</code>
*/
-public class ModelTreeCondition {
+@SuppressWarnings("serial")
+public class ModelTreeCondition extends ModelWidgetCondition {
public static final String module = ModelTreeCondition.class.getName();
- protected ModelTree modelTree;
- protected TreeCondition rootCondition;
-
public ModelTreeCondition(ModelTree modelTree, Element conditionElement) {
- this.modelTree = modelTree;
- Element firstChildElement = UtilXml.firstChildElement(conditionElement);
- this.rootCondition = readCondition(modelTree, firstChildElement);
- }
-
- public boolean eval(Map<String, ? extends Object> context) {
- if (rootCondition == null) {
- return true;
- }
- return rootCondition.eval(context);
- }
-
- public static abstract class TreeCondition {
- protected ModelTree modelTree;
-
- public TreeCondition(ModelTree modelTree, Element conditionElement) {
- this.modelTree = modelTree;
- }
-
- public abstract boolean eval(Map<String, ? extends Object> context);
- }
-
- public static List<TreeCondition> readSubConditions(ModelTree modelTree, Element conditionElement) {
- List<TreeCondition> condList = new ArrayList<TreeCondition>();
- for (Element subElement: UtilXml.childElementList(conditionElement)) {
- condList.add(readCondition(modelTree, subElement));
- }
- return condList;
- }
-
- public static TreeCondition readCondition(ModelTree modelTree, Element conditionElement) {
- if (conditionElement == null) {
- return null;
- }
- if ("and".equals(conditionElement.getNodeName())) {
- return new And(modelTree, conditionElement);
- } else if ("xor".equals(conditionElement.getNodeName())) {
- return new Xor(modelTree, conditionElement);
- } else if ("or".equals(conditionElement.getNodeName())) {
- return new Or(modelTree, conditionElement);
- } else if ("not".equals(conditionElement.getNodeName())) {
- return new Not(modelTree, conditionElement);
- } else if ("if-has-permission".equals(conditionElement.getNodeName())) {
- return new IfHasPermission(modelTree, conditionElement);
- } else if ("if-validate-method".equals(conditionElement.getNodeName())) {
- return new IfValidateMethod(modelTree, conditionElement);
- } else if ("if-compare".equals(conditionElement.getNodeName())) {
- return new IfCompare(modelTree, conditionElement);
- } else if ("if-compare-field".equals(conditionElement.getNodeName())) {
- return new IfCompareField(modelTree, conditionElement);
- } else if ("if-regexp".equals(conditionElement.getNodeName())) {
- return new IfRegexp(modelTree, conditionElement);
- } else if ("if-empty".equals(conditionElement.getNodeName())) {
- return new IfEmpty(modelTree, conditionElement);
- } else if ("if-entity-permission".equals(conditionElement.getNodeName())) {
- return new IfEntityPermission(modelTree, conditionElement);
- } else {
- throw new IllegalArgumentException("Condition element not supported with name: " + conditionElement.getNodeName());
- }
- }
-
- public static class And extends TreeCondition {
- protected List<? extends TreeCondition> subConditions;
-
- public And(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.subConditions = readSubConditions(modelTree, condElement);
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- // return false for the first one in the list that is false, basic and algo
- for (TreeCondition subCondition: subConditions) {
- if (!subCondition.eval(context)) {
- return false;
- }
- }
- return true;
- }
- }
-
- public static class Xor extends TreeCondition {
- protected List<? extends TreeCondition> subConditions;
-
- public Xor(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.subConditions = readSubConditions(modelTree, condElement);
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- // if more than one is true stop immediately and return false; if all are false return false; if only one is true return true
- boolean foundOneTrue = false;
- for (TreeCondition subCondition: subConditions) {
- if (subCondition.eval(context)) {
- if (foundOneTrue) {
- // now found two true, so return false
- return false;
- } else {
- foundOneTrue = true;
- }
- }
- }
- return foundOneTrue;
- }
- }
-
- public static class Or extends TreeCondition {
- protected List<? extends TreeCondition> subConditions;
-
- public Or(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.subConditions = readSubConditions(modelTree, condElement);
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- // return true for the first one in the list that is true, basic or algo
- for (TreeCondition subCondition: subConditions) {
- if (subCondition.eval(context)) {
- return true;
- }
- }
- return false;
- }
- }
-
- public static class Not extends TreeCondition {
- protected TreeCondition subCondition;
-
- public Not(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- Element firstChildElement = UtilXml.firstChildElement(condElement);
- this.subCondition = readCondition(modelTree, firstChildElement);
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- return !this.subCondition.eval(context);
- }
- }
-
- public static class IfHasPermission extends TreeCondition {
- protected FlexibleStringExpander permissionExdr;
- protected FlexibleStringExpander actionExdr;
-
- public IfHasPermission(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.permissionExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("permission"));
- this.actionExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("action"));
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- // if no user is logged in, treat as if the user does not have permission
- GenericValue userLogin = (GenericValue) context.get("userLogin");
- if (userLogin != null) {
- String permission = permissionExdr.expandString(context);
- String action = actionExdr.expandString(context);
- Security security = (Security) context.get("security");
- if (UtilValidate.isNotEmpty(action)) {
- // run hasEntityPermission
- if (security.hasEntityPermission(permission, action, userLogin)) {
- return true;
- }
- } else {
- // run hasPermission
- if (security.hasPermission(permission, userLogin)) {
- return true;
- }
- }
- }
- return false;
- }
- }
-
- public static class IfValidateMethod extends TreeCondition {
- protected FlexibleMapAccessor<Object> fieldAcsr;
- protected FlexibleStringExpander methodExdr;
- protected FlexibleStringExpander classExdr;
-
- public IfValidateMethod(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
- if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
- this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method"));
- this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class"));
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- String methodName = this.methodExdr.expandString(context);
- String className = this.classExdr.expandString(context);
-
- Object fieldVal = this.fieldAcsr.get(context);
- String fieldString = null;
- if (fieldVal != null) {
- try {
- fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
- } catch (GeneralException e) {
- Debug.logError(e, "Could not convert object to String, using empty String", module);
- }
- }
-
- // always use an empty string by default
- if (fieldString == null) fieldString = "";
-
- Class<?>[] paramTypes = new Class[] {String.class};
- Object[] params = new Object[] {fieldString};
-
- Class<?> valClass;
- try {
- valClass = ObjectType.loadClass(className);
- } catch (ClassNotFoundException cnfe) {
- Debug.logError("Could not find validation class: " + className, module);
- return false;
- }
-
- Method valMethod;
- try {
- valMethod = valClass.getMethod(methodName, paramTypes);
- } catch (NoSuchMethodException cnfe) {
- Debug.logError("Could not find validation method: " + methodName + " of class " + className, module);
- return false;
- }
-
- Boolean resultBool = Boolean.FALSE;
- try {
- resultBool = (Boolean) valMethod.invoke(null, params);
- } catch (Exception e) {
- Debug.logError(e, "Error in IfValidationMethod " + methodName + " of class " + className + ", defaulting to false ", module);
- }
-
- return resultBool.booleanValue();
- }
- }
-
- public static class IfCompare extends TreeCondition {
- protected FlexibleMapAccessor<Object> fieldAcsr;
- protected FlexibleStringExpander valueExdr;
-
- protected String operator;
- protected String type;
- protected FlexibleStringExpander formatExdr;
-
- public IfCompare(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
- if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
- this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value"));
-
- this.operator = condElement.getAttribute("operator");
- this.type = condElement.getAttribute("type");
-
- this.formatExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("format"));
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- String value = this.valueExdr.expandString(context);
- String format = this.formatExdr.expandString(context);
-
- Object fieldVal = this.fieldAcsr.get(context);
-
- // always use an empty string by default
- if (fieldVal == null) {
- fieldVal = "";
- }
-
- List<Object> messages = new LinkedList<Object>();
- Boolean resultBool = BaseCompare.doRealCompare(fieldVal, value, operator, type, format, messages, null, null, true);
- if (messages.size() > 0) {
- messages.add(0, "Error with comparison in if-compare between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: ");
-
- StringBuilder fullString = new StringBuilder();
- for (Object message: messages) {
- fullString.append((String) message);
- }
- Debug.logWarning(fullString.toString(), module);
-
- throw new IllegalArgumentException(fullString.toString());
- }
-
- return resultBool.booleanValue();
- }
- }
-
- public static class IfCompareField extends TreeCondition {
- protected FlexibleMapAccessor<Object> fieldAcsr;
- protected FlexibleMapAccessor<Object> toFieldAcsr;
-
- protected String operator;
- protected String type;
- protected FlexibleStringExpander formatExdr;
-
- public IfCompareField(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
- if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
- this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field"));
- if (this.toFieldAcsr.isEmpty()) this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name"));
-
- this.operator = condElement.getAttribute("operator");
- this.type = condElement.getAttribute("type");
-
- this.formatExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("format"));
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- String format = this.formatExdr.expandString(context);
-
- Object fieldVal = this.fieldAcsr.get(context);
- Object toFieldVal = this.toFieldAcsr.get(context);
-
- // always use an empty string by default
- if (fieldVal == null) {
- fieldVal = "";
- }
-
- List<Object> messages = new LinkedList<Object>();
- Boolean resultBool = BaseCompare.doRealCompare(fieldVal, toFieldVal, operator, type, format, messages, null, null, false);
- if (messages.size() > 0) {
- messages.add(0, "Error with comparison in if-compare-field between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and to-field [" + toFieldVal.toString() + "] with value [" + toFieldVal + "] with operator [" + operator + "] and type [" + type + "]: ");
-
- StringBuilder fullString = new StringBuilder();
- for (Object message: messages) {
- fullString.append((String) message);
- }
- Debug.logWarning(fullString.toString(), module);
-
- throw new IllegalArgumentException(fullString.toString());
- }
-
- return resultBool.booleanValue();
- }
- }
-
- public static class IfRegexp extends TreeCondition {
- protected FlexibleMapAccessor<Object> fieldAcsr;
- protected FlexibleStringExpander exprExdr;
-
- public IfRegexp(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
- if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
- this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr"));
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- Object fieldVal = this.fieldAcsr.get(context);
- String expr = this.exprExdr.expandString(context);
- Pattern pattern = null;
-
- try {
- pattern = PatternFactory.createOrGetPerl5CompiledPattern(expr, true);
- } catch (MalformedPatternException e) {
- String errMsg = "Error in evaluation in if-regexp in screen: " + e.toString();
- Debug.logError(e, errMsg, module);
- throw new IllegalArgumentException(errMsg);
- }
-
- String fieldString = null;
- try {
- fieldString = (String) ObjectType.simpleTypeConvert(fieldVal, "String", null, (TimeZone) context.get("timeZone"), (Locale) context.get("locale"), true);
- } catch (GeneralException e) {
- Debug.logError(e, "Could not convert object to String, using empty String", module);
- }
- // always use an empty string by default
- if (fieldString == null) fieldString = "";
-
- PatternMatcher matcher = new Perl5Matcher();
- return matcher.matches(fieldString, pattern);
- }
- }
-
- public static class IfEmpty extends TreeCondition {
- protected FlexibleMapAccessor<Object> fieldAcsr;
-
- public IfEmpty(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field"));
- if (this.fieldAcsr.isEmpty()) this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name"));
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
- Object fieldVal = this.fieldAcsr.get(context);
- return ObjectType.isEmpty(fieldVal);
- }
- }
- public static class IfEntityPermission extends TreeCondition {
- protected EntityPermissionChecker permissionChecker;
-
- public IfEntityPermission(ModelTree modelTree, Element condElement) {
- super (modelTree, condElement);
- this.permissionChecker = new EntityPermissionChecker(condElement);
- }
-
- @Override
- public boolean eval(Map<String, ? extends Object> context) {
-
- boolean passed = permissionChecker.runPermissionCheck(context);
- return passed;
- }
+ super(ModelWidgetCondition.DEFAULT_CONDITION_FACTORY, modelTree, conditionElement);
}
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java Mon Jan 5 08:50:30 2015
@@ -78,8 +78,7 @@ public class TreeFactory {
// read document and construct ModelTree for each tree element
Element rootElement = treeFileDoc.getDocumentElement();
for (Element treeElement: UtilXml.childElementList(rootElement, "tree")) {
- ModelTree modelTree = new ModelTree(treeElement, delegator, dispatcher);
- modelTree.setTreeLocation(treeLocation);
+ ModelTree modelTree = new ModelTree(treeElement, treeLocation);
modelTreeMap.put(modelTree.getName(), modelTree);
}
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/EditMaint.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/EditMaint.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/EditMaint.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/EditMaint.groovy Mon Jan 5 08:50:30 2015
@@ -29,7 +29,7 @@ maintHistSeqId = parameters.maintHistSeq
workEffortId = parameters.workEffortId;
if (!maintHistSeqId && workEffortId) {
- fixedAssetMaint = EntityUtil.getFirst(delegator.findList("FixedAssetMaint", EntityCondition.makeCondition([scheduleWorkEffortId : workEffortId]), null, null, null, false));
+ fixedAssetMaint = from("FixedAssetMaint").where("scheduleWorkEffortId", workEffortId).queryFirst();
if (fixedAssetMaint) {
parameters.fixedAssetId = fixedAssetMaint.fixedAssetId;
parameters.maintHistSeqId = fixedAssetMaint.maintHistSeqId;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/PrintFixedAssetMaint.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/PrintFixedAssetMaint.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/PrintFixedAssetMaint.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/assetmaint/PrintFixedAssetMaint.groovy Mon Jan 5 08:50:30 2015
@@ -23,7 +23,7 @@ import org.ofbiz.entity.condition.*;
facility = fixedAsset.getRelatedOne("LocatedAtFacility", false);
context.locatedAtFacility = facility;
-fixedAssetIdents = delegator.findList("FixedAssetIdent", EntityCondition.makeCondition([fixedAssetId : fixedAssetId]), null, null, null, false);
+fixedAssetIdents = from("FixedAssetIdent").where("fixedAssetId", fixedAssetId).queryList();
fixedAssetIdentValue = "";
if (fixedAssetIdents) {
fixedAssetIdents.each { ident ->
@@ -46,13 +46,13 @@ if (intervalUom) {
instanceOfProductId = fixedAsset.instanceOfProductId;
productMaintSeqId = fixedAssetMaint.productMaintSeqId;
if (productMaintSeqId) {
- productMaint = delegator.findOne("ProductMaint", [productId : instanceOfProductId, productMaintSeqId : productMaintSeqId], false);
+ productMaint = from("ProductMaint").where("productId", instanceOfProductId, "productMaintSeqId", productMaintSeqId).queryOne();
context.productMaintName = productMaint.maintName;
}
productMaintTypeId = fixedAssetMaint.productMaintTypeId;
if (productMaintTypeId) {
- productMaintType = delegator.findOne("ProductMaintType", [productMaintTypeId : productMaintTypeId], false);
+ productMaintType = from("ProductMaintType").where("productMaintTypeId", productMaintTypeId).queryOne();
if (productMaintType) {
productMaintTypeDesc = productMaintType.description;
context.productMaintTypeDesc = productMaintTypeDesc;
@@ -62,7 +62,7 @@ if (productMaintTypeId) {
intervalMeterTypeId = fixedAssetMaint.intervalMeterTypeId;
productMeterTypeDesc = "";
if (intervalMeterTypeId) {
- productMeterType = delegator.findOne("ProductMeterType", [productMeterTypeId : intervalMeterTypeId], false);
+ productMeterType = from("ProductMeterType").where("productMeterTypeId", intervalMeterTypeId).queryOne();
productMeterTypeDesc = productMeterType.description;
}
context.productMeterTypeDesc = productMeterTypeDesc;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/actions/workeffort/EditWorkEfforts.groovy Mon Jan 5 08:50:30 2015
@@ -44,16 +44,16 @@ fixedAsset = null;
rootWorkEffortId = null;
if (workEffortId) {
- workEffort = delegator.findOne("WorkEffort", [workEffortId : workEffortId], false);
+ workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne();
if (workEffort) {
if (!fixedAssetId) {
fixedAssetId = workEffort.fixedAssetId;
}
// If this is a child workeffort, locate the "root" workeffort
- parentWorkEffort = EntityUtil.getFirst(delegator.findList("WorkEffortAssoc", EntityCondition.makeCondition([workEffortIdTo : workEffortId]), null, null, null, false));
+ parentWorkEffort = from("WorkEffortAssoc").where("workEffortIdTo", workEffortId).queryFirst();
while (parentWorkEffort) {
rootWorkEffortId = parentWorkEffort.workEffortIdFrom;
- parentWorkEffort = EntityUtil.getFirst(delegator.findList("WorkEffortAssoc", EntityCondition.makeCondition([workEffortIdTo : rootWorkEffortId]), null, null, null, false));
+ parentWorkEffort = from("WorkEffortAssoc").where("workEffortIdTo", rootWorkEffortId).queryFirst();
}
}
}
@@ -63,7 +63,7 @@ if (!rootWorkEffortId) {
}
if (rootWorkEffortId) {
- fixedAssetMaint = EntityUtil.getFirst(delegator.findList("FixedAssetMaint", EntityCondition.makeCondition([scheduleWorkEffortId : rootWorkEffortId]), null, null, null, false));
+ fixedAssetMaint = from("FixedAssetMaint").where("scheduleWorkEffortId", rootWorkEffortId).queryFirst();
if (fixedAssetMaint) {
maintHistSeqId = fixedAssetMaint.maintHistSeqId;
if (!fixedAssetId) {
@@ -73,7 +73,7 @@ if (rootWorkEffortId) {
}
if (fixedAssetId) {
- fixedAsset = delegator.findOne("FixedAsset", [fixedAssetId : fixedAssetId], false);
+ fixedAsset = from("FixedAsset").where("fixedAssetId", fixedAssetId).queryOne();
}
context.fixedAssetMaint = fixedAssetMaint;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/bi/webapp/bi/WEB-INF/actions/reportbuilder/RunStarSchemaQuery.groovy Mon Jan 5 08:50:30 2015
@@ -41,21 +41,7 @@ selectedFieldList.each { selectedField -
columnNames.add(selectedField.selectedFieldName);
}
context.columnNames = columnNames;
-List conditionList = null;
-EntityConditionList condition = null;
-List orderByFields = null;
-EntityFindOptions findOptions = null;
-
List records = FastList.newInstance();
-
-//conditionList.add(...);
-//condition = EntityCondition.makeCondition(conditionList, EntityOperator.AND);
-
-orderByFields = null;
-
-findOptions = new EntityFindOptions();
-findOptions.setDistinct(false);
-
-records = delegator.findList(starSchemaName, condition, context.columnNames, orderByFields, findOptions, false);
+records = select(context.columnNames).from(starSchemaName).distinct(false).queryList();
context.records = records;
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/src/org/ofbiz/ebay/ProductsExportToEbay.java Mon Jan 5 08:50:30 2015
@@ -34,6 +34,7 @@ import javolution.util.FastMap;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilCodec;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilProperties;
@@ -179,7 +180,7 @@ public class ProductsExportToEbay {
Delegator delegator = dctx.getDelegator();
String webSiteUrl = (String)context.get("webSiteUrl");
- StringUtil.SimpleEncoder encoder = StringUtil.getEncoder("xml");
+ UtilCodec.SimpleEncoder encoder = UtilCodec.getEncoder("xml");
// Get the list of products to be exported to eBay
try {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/EbayAdvancedSearch.groovy Mon Jan 5 08:50:30 2015
@@ -31,12 +31,12 @@ if (parameters.productStoreId) {
} else {
productStoreId = ProductStoreWorker.getProductStoreId(request);
}
-ebayConfigList = delegator.findList("EbayConfig", null, null, null, null, false);
+ebayConfigList = from("EbayConfig").queryList();
if (productStoreId) {
productStoreCatalogs = CatalogWorker.getStoreCatalogs(delegator, productStoreId);
if (productStoreCatalogs) {
productStoreCatalogs.each { productStoreCatalog ->
- prodCatalog = delegator.findOne("ProdCatalog", [prodCatalogId : productStoreCatalog.prodCatalogId], true);
+ prodCatalog = from("ProdCatalog").where("prodCatalogId", productStoreCatalog.prodCatalogId).cache(true).queryOne();
prodCatalogList.add(prodCatalog);
}
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebay/webapp/ebay/WEB-INF/actions/find/ProductsExportToEbay.groovy Mon Jan 5 08:50:30 2015
@@ -24,9 +24,9 @@ webSiteList = [];
webSite = null;
if (parameters.productStoreId) {
productStoreId = parameters.productStoreId;
- webSiteList = delegator.findList("WebSite", EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId), null, null, null, false);
+ webSiteList = from("WebSite").where("productStoreId", productStoreId).queryList();
if (parameters.webSiteId) {
- webSite = delegator.findOne("WebSite", ["webSiteId" : parameters.webSiteId], true);
+ webSite = from("WebSite").where("webSiteId", parameters.webSiteId).cache(true).queryOne();
context.selectedWebSiteId = parameters.webSiteId;
} else if (webSiteList) {
webSite = EntityUtil.getFirst(webSiteList);
@@ -42,7 +42,7 @@ if (parameters.productStoreId) {
}
context.countryCode = countryCode;
if (webSite) {
- eBayConfig = delegator.findOne("EbayConfig", [productStoreId : productStoreId], false);
+ eBayConfig = from("EbayConfig").where("productStoreId", productStoreId).queryOne();
context.customXml = eBayConfig.customXml;
context.webSiteUrl = webSite.getString("standardContentPrefix");
@@ -51,7 +51,7 @@ if (parameters.productStoreId) {
userLogin = parameters.userLogin;
if (productStoreId) {
- results = dispatcher.runSync("getEbayCategories", [categoryCode : categoryCode, userLogin : userLogin, productStoreId : productStoreId]);
+ results = runService('getEbayCategories', [categoryCode : categoryCode, userLogin : userLogin, productStoreId : productStoreId]);
}
if (results.categories) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/automationPreferences/GetEbayJobsandbox.groovy Mon Jan 5 08:50:30 2015
@@ -19,7 +19,7 @@
import org.ofbiz.base.util.*;
-jobSandboxs = delegator.findByAnd("JobSandbox", UtilMisc.toMap("authUserLoginId", userLoginId), null, false);
+jobSandboxs = from("JobSandbox").where("authUserLoginId", userLoginId).queryList();
job = null
jobId = null;
if(jobSandboxs) {
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/email/GetProductStoreEmailTemplate.groovy Mon Jan 5 08:50:30 2015
@@ -20,10 +20,10 @@
import org.ofbiz.base.util.*;
contentId = null;
-contentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "OWNER"), null, false);
+contentRoles = from("ContentRole").where("partyId", partyId, "roleTypeId", "OWNER").queryList();
if (contentRoles.size() != 0) {
contentRoles.each { contentRole->
- contents = delegator.findByAnd("Content", UtilMisc.toMap("contentId", contentRole.getString("contentId"), "ownerContentId", emailType), null, false);
+ contents = from("Content").where("contentId", contentRole.getString("contentId"), "ownerContentId", emailType).queryList();
if (contents.size() != 0) {
if (emailType.equals(contents.get(0).getString("ownerContentId"))) {
contentId = contents.get(0).getString("contentId");
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/feedback/FeedbackList.groovy Mon Jan 5 08:50:30 2015
@@ -25,12 +25,9 @@ import java.util.Map;
import javolution.util.FastMap;
partyId = null
-inMap = FastMap.newInstance();
-inMap.put("productStoreId", parameters.productStoreId);
-inMap.put("userLogin", context.get("userLogin"));
-resultUser = dispatcher.runSync("getEbayStoreUser", inMap);
+resultUser = runService('getEbayStoreUser', ["productStoreId": parameters.productStoreId, "userLogin": context.get("userLogin")]);
ownerUser = resultUser.get("userLoginId");
-userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", ownerUser), false);
+userLogin = from("UserLogin").where("userLoginId", ownerUser).queryOne();
if (userLogin) {
partyId = userLogin.get("partyId");
}
@@ -55,23 +52,22 @@ if (fromDate && thruDate) {
} else if (!fromDate && thruDate) {
expr.add(EntityCondition.makeCondition("createdDate",EntityOperator.LESS_THAN, UtilDateTime.getDayEnd(Timestamp.valueOf(thruDate + " 23:59:59.999"))));
}
-contentRoles = delegator.findByAnd("ContentRole", UtilMisc.toMap("roleTypeId","OWNER", "partyId", partyId), null, false);
+contentRoles = from("ContentRole").where("roleTypeId","OWNER", "partyId", partyId).queryList();
contentIds = [];
contentRoles.each{ content ->
contentIds.add(content.getString("contentId"));
}
expr.add(EntityCondition.makeCondition("contentId", EntityOperator.IN, contentIds));
-cond = EntityCondition.makeCondition(expr, EntityOperator.AND);
-contents = delegator.findList("Content", cond, null, null, null, false);
+contents = from("Content").where(expr).queryList();
recentFeedbackList = [];
ownerUser = null;
commentator = null;
contents.each{ content ->
- commentatorContents = delegator.findByAnd("ContentRole", UtilMisc.toMap("contentId",content.contentId, "roleTypeId","COMMENTATOR"), null, false);
+ commentatorContents = from("ContentRole").where("contentId",content.contentId, "roleTypeId","COMMENTATOR").queryList();
if(commentatorContents){
commentatorPartyId = commentatorContents.get(0).get("partyId");
- commentatorUsers = delegator.findByAnd("UserLogin", UtilMisc.toMap("partyId", commentatorPartyId), null, false);
+ commentatorUsers = from("UserLogin").where("partyId", commentatorPartyId).queryList();
if(commentatorUsers){
commentator = commentatorUsers.get(0).get("userLoginId");
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/CheckOrderStatus.groovy Mon Jan 5 08:50:30 2015
@@ -19,7 +19,7 @@
import org.ofbiz.entity.util.EntityUtil;
context.importStatus = "NOT_IMPORT";
-orderHeaders = delegator.findByAnd("OrderHeader", [externalId : externalId], null, false);
+orderHeaders = from("OrderHeader").where("externalId", externalId).queryList();
if (orderHeaders.size() > 0) {
orderHeader = EntityUtil.getFirst(orderHeaders);
context.orderId = orderHeader.get("orderId");
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/OrderListPrepare.groovy Mon Jan 5 08:50:30 2015
@@ -28,7 +28,7 @@ if (orderList) {
for (orderCount = 0; orderCount < orderList.size(); orderCount++) {
orderItem = orderList[orderCount];
orderId = null;
- orderHeaders = delegator.findByAnd("OrderHeader", [externalId : orderItem.("externalId")], null, false);
+ orderHeaders = from("OrderHeader").where("externalId", orderItem.("externalId")).queryList();
if (orderHeaders.size() > 0) {
orderHeader = EntityUtil.getFirst(orderHeaders);
orderId = orderHeader.get("orderId").toString();
@@ -44,7 +44,7 @@ if (orderList) {
item = items[itemCount];
title = null;
if (!(item.get("title"))) {
- product = delegator.findOne("Product", [productId : item.get("productId")], true);
+ product = from("Product").where("productId", item.get("productId")).cache(true).queryOne();
title = product.get("internalName");
}
orderMap = FastMap.newInstance();
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/PrepareProductListing.groovy Mon Jan 5 08:50:30 2015
@@ -64,7 +64,7 @@
content = [:];
item = addItem.getItem();
productId = item.getSKU();
- product = delegator.findOne("Product", [productId : productId], true);
+ product = from("Product").where("productId", productId).cache(true).queryOne();
contentWrapper = new ProductContentWrapper(product, request);
content.productContentWrapper = contentWrapper;
content.product = product;
@@ -94,7 +94,7 @@
}
context.isProductId = productId;
// get product default price form product price
- productPrices = delegator.findByAnd("ProductPrice",["productId":productId,"productPricePurposeId":"EBAY"], null, false);
+ productPrices = from("ProductPrice").where("productId", productId, "productPricePurposeId", "EBAY").queryList();
if (productPrices) {
context.productPrices = productPrices;
}
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/RetrieveStoreOptions.groovy Mon Jan 5 08:50:30 2015
@@ -26,7 +26,7 @@ if (parameters.ebayStore) {
if (productStoreId != null) {
flag = null;
storeBasicThemes = null;
- resultsBasicThemes = dispatcher.runSync("retrieveBasicThemeArray",["productStoreId":productStoreId, "userLogin": userLogin]);
+ resultsBasicThemes = runService('retrieveBasicThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]);
if(resultsBasicThemes){
storeBasicThemes = resultsBasicThemes.get("storeThemeList");
//check what kind of theme?
@@ -41,7 +41,7 @@ if (productStoreId != null) {
}
storeAdvanceThemes = null;
storeAdvancedThemeColorOptList = null;
- resultsAdvanceThemes = dispatcher.runSync("retrieveAdvancedThemeArray",["productStoreId":productStoreId, "userLogin": userLogin]);
+ resultsAdvanceThemes = runService('retrieveAdvancedThemeArray',["productStoreId":productStoreId, "userLogin": userLogin]);
if (resultsAdvanceThemes) {
storeAdvanceThemes = resultsAdvanceThemes.get("storeThemeList");
storeAdvancedThemeColorOptList = resultsAdvanceThemes.get("storeAdvancedThemeColorOptList");
@@ -56,7 +56,7 @@ if (productStoreId != null) {
}
}
}
- resultsFontTheme = dispatcher.runSync("retrieveStoreFontTheme",["productStoreId":productStoreId, "userLogin": userLogin]);
+ resultsFontTheme = runService('retrieveStoreFontTheme',["productStoreId":productStoreId, "userLogin": userLogin]);
if (resultsFontTheme) {
storeFontTheme = resultsFontTheme.get("advanceFontTheme");
context.put("storeFontTheme",storeFontTheme);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/webapp/ebaystore/WEB-INF/actions/store/StoreAccount.groovy Mon Jan 5 08:50:30 2015
@@ -22,8 +22,8 @@ import javolution.util.FastList;
import javolution.util.FastMap;
results = FastList.newInstance();
-ebayAccountList = delegator.findByAnd("PartyRoleAndPartyDetail",["roleTypeId":"EBAY_ACCOUNT"], null, false);
-productStoreRoles = delegator.findByAnd("ProductStoreRole",["roleTypeId":"EBAY_ACCOUNT"], null, false);
+ebayAccountList = from("PartyRoleAndPartyDetail").where("roleTypeId", "EBAY_ACCOUNT").queryList();
+productStoreRoles = from("ProductStoreRole").where("roleTypeId", "EBAY_ACCOUNT").queryList();
if (productStoreRoles != null && ebayAccountList != null) {
ebayAccountList.each{ebayAccount->
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/widget/EbayAccountForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/widget/EbayAccountForms.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/widget/EbayAccountForms.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ebaystore/widget/EbayAccountForms.xml Mon Jan 5 08:50:30 2015
@@ -55,7 +55,7 @@ under the License.
<form name="RecentFeedback" type="list" list-name="recentFeedbackList"
odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
<field name="contentId" title="Feedback Id"><display/></field>
- <field name="dataResourceId" title="Comment Text">
+ <field name="dataResourceId" title="${uiLabelMap.ContentDataResourceId}" title="Comment Text">
<display-entity entity-name="ElectronicText" key-field-name="dataResourceId" description="${textData}"/>
</field>
<field name="commentator" title="Commentator"><display/></field>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/config/EcommerceUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/config/EcommerceUiLabels.xml?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/config/EcommerceUiLabels.xml (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/config/EcommerceUiLabels.xml Mon Jan 5 08:50:30 2015
@@ -1759,6 +1759,9 @@
<value xml:lang="zh">æè¿æµè§</value>
<value xml:lang="zh_TW">æè¿çé</value>
</property>
+ <property key="EcommerceLayeredNavigation">
+ <value xml:lang="en">Layered Navigation</value>
+ </property>
<property key="EcommerceLength">
<value xml:lang="da">Længde</value>
<value xml:lang="de">Länge</value>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/email/ContactListVerifyEmail.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/email/ContactListVerifyEmail.ftl?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/email/ContactListVerifyEmail.ftl (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/email/ContactListVerifyEmail.ftl Mon Jan 5 08:50:30 2015
@@ -34,7 +34,7 @@ under the License.
<p>We have received a request for subscription to the ${contactList.contactListName} contact list.</p>
<p>To complete your subscription click the on the following link:</p>
-<#assign verifyUrl = baseEcommerceSecureUrl+'updateContactListPartyNoUserLogin?contactListId='+contactListParty.contactListId+'&partyId='+contactListParty.partyId+'&fromDate='+contactListParty.fromDate+'&statusId=CLPT_ACCEPTED&optInVerifyCode='+contactListPartyStatus.optInVerifyCode+'&baseLocation='+baseLocation!>
+<#assign verifyUrl = baseEcommerceSecureUrl+'/'+'updateContactListPartyNoUserLogin?contactListId='+contactListParty.contactListId+'&partyId='+contactListParty.partyId+'&fromDate='+contactListParty.fromDate+'&statusId=CLPT_ACCEPTED&optInVerifyCode='+contactListPartyStatus.optInVerifyCode+'&baseLocation='+baseLocation!>
<#if (contactListParty.preferredContactMechId)??>
<#assign verifyUrl= verifyUrl+"&preferredContactMechId="+contactListParty.preferredContactMechId>
</#if>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/survey/minisurvey.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/survey/minisurvey.ftl?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/survey/minisurvey.ftl (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/templates/survey/minisurvey.ftl Mon Jan 5 08:50:30 2015
@@ -61,8 +61,8 @@ under the License.
<#if surveyQuestionAndAppl.requiredField?default("N") != "Y">
<option value=""></option>
</#if>
- <option <#if "Y" == selectedOption>selected="selected"</#if>>Y</option>
- <option <#if "N" == selectedOption>selected="selected"</#if>>N</option>
+ <option value="Y" <#if "Y" == selectedOption>selected="selected"</#if>>Y</option>
+ <option value="N" <#if "N" == selectedOption>selected="selected"</#if>>N</option>
</select>
<#elseif surveyQuestionAndAppl.surveyQuestionTypeId == "TEXTAREA">
<textarea class="textAreaBox" cols="40" rows="5" name="answers_${surveyQuestionAndAppl.surveyQuestionId}">${(answer.textResponse)!}</textarea>
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy Mon Jan 5 08:50:30 2015
@@ -34,20 +34,18 @@ context.productStore = ProductStoreWorke
if (parameters.add_product_id) { // check if a parameter is passed
add_product_id = parameters.add_product_id;
- product = delegator.findOne("Product", [productId : add_product_id], true);
+ product = from("Product").where("productId", add_product_id).cache(true).queryOne();
context.product = product;
}
// get all the possible gift wrap options
-allgiftWraps = delegator.findByAnd("ProductFeature", [productFeatureTypeId : "GIFT_WRAP"], ["defaultSequenceNum"], false);
+allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList();
context.allgiftWraps = allgiftWraps;
// get the shopping lists for the logged in user
if (userLogin) {
- exprList = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId),
- EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")];
- condition = EntityCondition.makeCondition(exprList, EntityOperator.AND);
- allShoppingLists = delegator.findList("ShoppingList", condition, null, ["listName"], null, false);
+ allShoppingLists = from("ShoppingList").where(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId),
+ EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")).orderBy("listName").queryList();
context.shoppingLists = allShoppingLists;
}
@@ -70,7 +68,7 @@ if(shoppingCartItems) {
}
context.parentProductId = parentProductId;
}
- productCategoryMembers = delegator.findList("ProductCategoryMember", EntityCondition.makeCondition("productId", EntityOperator.EQUALS, parentProductId), null, null, null, false);
+ productCategoryMembers = from("ProductCategoryMember").where("productId", parentProductId).queryList();
if (productCategoryMembers) {
productCategoryMember = EntityUtil.getFirst(productCategoryMembers);
productCategory = productCategoryMember.getRelatedOne("ProductCategory", false);
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/LayeredNavigation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/LayeredNavigation.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/LayeredNavigation.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/LayeredNavigation.groovy Mon Jan 5 08:50:30 2015
@@ -30,7 +30,7 @@ if (!searchCategoryId) {
searchCategoryId = context.productCategoryId;
}
if (searchCategoryId) {
- currentSearchCategory = delegator.findOne("ProductCategory", [productCategoryId: searchCategoryId], false);
+ currentSearchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne();
CategoryWorker.getRelatedCategories(request, "subCategoryList", searchCategoryId, false);
subCategoryList = request.getAttribute("subCategoryList");
CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(currentSearchCategory, request);
@@ -39,7 +39,7 @@ if (searchCategoryId) {
}
productCategoryId = context.productCategoryId;
if (productCategoryId) {
- context.productCategory = delegator.findOne("ProductCategory", [productCategoryId: productCategoryId], false);
+ context.productCategory = from("ProductCategory").where("productCategoryId", productCategoryId).queryOne();
parameters.SEARCH_CATEGORY_ID = productCategoryId;
}
@@ -56,8 +56,7 @@ context.index = ProductSearchSession.get
searchConstraintList = ProductSearchSession.getProductSearchOptions(session).getConstraintList();
if (searchCategoryId) {
- productCategoryRollups = delegator.findByAnd("ProductCategoryRollup", [productCategoryId: searchCategoryId], null, false);
- productCategoryRollups = EntityUtil.filterByDate(productCategoryRollups);
+ productCategoryRollups = from("ProductCategoryRollup").where("productCategoryId", searchCategoryId).filterByDate().queryList();
previousCategoryId = null;
if (productCategoryRollups) {
for (GenericValue categoryRollup : productCategoryRollups) {
@@ -91,7 +90,7 @@ if (subCategoryList) {
context.showColors = true;
colors = ProductSearchSession.listCountByFeatureForType("COLOR", session, delegator);
-colorFeatureType = delegator.findOne("ProductFeatureType", [productFeatureTypeId: "COLOR"], false);
+colorFeatureType = from("ProductFeatureType").where("productFeatureTypeId", "COLOR").queryOne();
if (colors) {
colors.each { color ->
featureConstraint = new ProductSearch.FeatureConstraint(color.productFeatureId, false);