[ofbiz-framework] branch release17.12 updated: Fixed: Compound-widget not works with condition

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch release17.12 updated: Fixed: Compound-widget not works with condition

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new 0e20d16  Fixed: Compound-widget not works with condition
0e20d16 is described below

commit 0e20d16cfd53e79a94c884ec5e5d2e18cf333f98
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Mon Apr 27 17:43:14 2020 +0200

    Fixed: Compound-widget not works with condition
   
    (OFBIZ-11606)
   
    Fixes "<**:condition" not well managed and generating an error
   
    Changes all the getNodeName() by getLocalName() in the ModelX****Condition.java
   
    Thanks: Olivier
---
 .../ofbiz/widget/model/AbstractModelCondition.java |  2 +-
 .../apache/ofbiz/widget/model/ModelFormAction.java | 11 +++++----
 .../apache/ofbiz/widget/model/ModelMenuAction.java |  2 +-
 .../ofbiz/widget/model/ModelScreenCondition.java   |  2 +-
 .../ofbiz/widget/model/ModelWidgetCondition.java   | 27 +++++++++++-----------
 5 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java
index 80fc76e..e58580d 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/AbstractModelCondition.java
@@ -179,7 +179,7 @@ public abstract class AbstractModelCondition implements Serializable, ModelCondi
             if (conditionElement == null) {
                 return TRUE;
             }
-            String nodeName = conditionElement.getNodeName();
+            String nodeName = conditionElement.getLocalName();
             if ("and".equals(nodeName)) {
                 return new And(factory, modelWidget, conditionElement);
             } else if ("xor".equals(nodeName)) {
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java
index 026d0a6..2792cec 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormAction.java
@@ -48,10 +48,11 @@ public abstract class ModelFormAction {
         List<? extends Element> actionElementList = UtilXml.childElementList(parentElement);
         List<ModelAction> actions = new ArrayList<>(actionElementList.size());
         for (Element actionElement : UtilXml.childElementList(parentElement)) {
-            if ("service".equals(actionElement.getNodeName())) {
+            String nodeName = actionElement.getLocalName();
+            if ("service".equals(nodeName)) {
                 actions.add(new Service(modelForm, actionElement));
-            } else if ("entity-and".equals(actionElement.getNodeName()) || "entity-condition".equals(actionElement.getNodeName())
-                    || "get-related".equals(actionElement.getNodeName())) {
+            } else if ("entity-and".equals(nodeName) || "entity-condition".equals(nodeName)
+                    || "get-related".equals(nodeName)) {
                 if (!actionElement.hasAttribute("list")) {
                     String listName = modelForm.getListName();
                     if (UtilValidate.isEmpty(listName)) {
@@ -60,7 +61,7 @@ public abstract class ModelFormAction {
                     actionElement.setAttribute("list", listName);
                 }
                 actions.add(AbstractModelAction.newInstance(modelForm, actionElement));
-            } else if ("call-parent-actions".equals(actionElement.getNodeName())) {
+            } else if ("call-parent-actions".equals(nodeName)) {
                 actions.add(new CallParentActions(modelForm, actionElement));
             } else {
                 actions.add(AbstractModelAction.newInstance(modelForm, actionElement));
@@ -81,7 +82,7 @@ public abstract class ModelFormAction {
 
         public CallParentActions(ModelForm modelForm, Element callParentActionsElement) {
             super(modelForm, callParentActionsElement);
-            String parentName = callParentActionsElement.getParentNode().getNodeName();
+            String parentName = callParentActionsElement.getParentNode().getLocalName();
             if ("actions".equals(parentName)) {
                 kind = ActionsKind.ACTIONS;
             } else if ("row-actions".equals(parentName)) {
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java
index ee37519..e53835c 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java
@@ -51,7 +51,7 @@ public abstract class ModelMenuAction {
         List<? extends Element> actionElementList = UtilXml.childElementList(parentElement);
         List<ModelAction> actions = new ArrayList<>(actionElementList.size());
         for (Element actionElement : actionElementList) {
-            if ("set".equals(actionElement.getNodeName())) {
+            if ("set".equals(actionElement.getLocalName())) {
                 actions.add(new SetField(modelMenu, actionElement));
             } else {
                 actions.add(AbstractModelAction.newInstance(modelMenu, actionElement));
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java
index 4d7eb6b..08d78db 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java
@@ -81,7 +81,7 @@ public final class ModelScreenCondition {
             if (conditionElement == null) {
                 return DefaultConditionFactory.TRUE;
             }
-            if ("if-empty-section".equals(conditionElement.getNodeName())) {
+            if ("if-empty-section".equals(conditionElement.getLocalName())) {
                 return new IfEmptySection(this, modelWidget, conditionElement);
             }
             return super.newInstance(this, modelWidget,conditionElement);
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java
index 4b351e8..8fe2119 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java
@@ -164,32 +164,33 @@ public abstract class ModelWidgetCondition implements Serializable {
             if (conditionElement == null) {
                 return TRUE;
             }
-            if ("and".equals(conditionElement.getNodeName())) {
+            String nodeName = conditionElement.getLocalName();
+            if ("and".equals(nodeName)) {
                 return new And(this, modelWidget, conditionElement);
-            } else if ("xor".equals(conditionElement.getNodeName())) {
+            } else if ("xor".equals(nodeName)) {
                 return new Xor(this, modelWidget, conditionElement);
-            } else if ("or".equals(conditionElement.getNodeName())) {
+            } else if ("or".equals(nodeName)) {
                 return new Or(this, modelWidget, conditionElement);
-            } else if ("not".equals(conditionElement.getNodeName())) {
+            } else if ("not".equals(nodeName)) {
                 return new Not(this, modelWidget, conditionElement);
-            } else if ("if-service-permission".equals(conditionElement.getNodeName())) {
+            } else if ("if-service-permission".equals(nodeName)) {
                 return new IfServicePermission(this, modelWidget, conditionElement);
-            } else if ("if-has-permission".equals(conditionElement.getNodeName())) {
+            } else if ("if-has-permission".equals(nodeName)) {
                 return new IfHasPermission(this, modelWidget, conditionElement);
-            } else if ("if-validate-method".equals(conditionElement.getNodeName())) {
+            } else if ("if-validate-method".equals(nodeName)) {
                 return new IfValidateMethod(this, modelWidget, conditionElement);
-            } else if ("if-compare".equals(conditionElement.getNodeName())) {
+            } else if ("if-compare".equals(nodeName)) {
                 return new IfCompare(this, modelWidget, conditionElement);
-            } else if ("if-compare-field".equals(conditionElement.getNodeName())) {
+            } else if ("if-compare-field".equals(nodeName)) {
                 return new IfCompareField(this, modelWidget, conditionElement);
-            } else if ("if-regexp".equals(conditionElement.getNodeName())) {
+            } else if ("if-regexp".equals(nodeName)) {
                 return new IfRegexp(this, modelWidget, conditionElement);
-            } else if ("if-empty".equals(conditionElement.getNodeName())) {
+            } else if ("if-empty".equals(nodeName)) {
                 return new IfEmpty(this, modelWidget, conditionElement);
-            } else if ("if-entity-permission".equals(conditionElement.getNodeName())) {
+            } else if ("if-entity-permission".equals(nodeName)) {
                 return new IfEntityPermission(this, modelWidget, conditionElement);
             } else {
-                throw new IllegalArgumentException("Condition element not supported with name: " + conditionElement.getNodeName());
+                throw new IllegalArgumentException("Condition element not supported with name: " + nodeName);
             }
         }
     }