[ofbiz-framework] branch release18.12 updated (81a14e8 -> 1bdd636)

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

[ofbiz-framework] branch release18.12 updated (81a14e8 -> 1bdd636)

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

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


    from 81a14e8  Fixed: Used the jdk 8 compatible version for gradle-svntools-plugin (OFBIZ-11601) build.grale using latest.release of gradle-svntools-plugin, and gradle-svntools-plugin release its latest release on 19th with jdk11 compatible. So this is causing build failure
     new 0805e57  Fixed: Compound-widget not works with condition
     new 1bdd636  Fixed: Compound-widget not works with condition

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../ofbiz/widget/model/AbstractModelCondition.java |  2 +-
 .../org/apache/ofbiz/widget/model/GridFactory.java | 14 +++++++++--
 .../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 +++++++++++-----------
 6 files changed, 35 insertions(+), 23 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 01/02: 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 release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 0805e57f08164b4d4dde00dd1d3614bd64b6aa24
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Mon Apr 27 14:31:31 2020 +0200

    Fixed: Compound-widget not works with condition
   
    (OFBIZ-11606)
   
    rootElement is not correct for a compound file, it's necessary to do a
    UtilXml.firstChildElement(rootElement, "forms"); to be correct.
    It's done for screen, form but not for grid !
   
    So correction is now added the correct read of rootElement.
   
    Thanks: Olivier
---
 .../java/org/apache/ofbiz/widget/model/GridFactory.java    | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/GridFactory.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/GridFactory.java
index c80c54d..e79217a 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/GridFactory.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/GridFactory.java
@@ -104,6 +104,9 @@ public class GridFactory {
         if (gridFileDoc != null) {
             // read document and construct ModelGrid for each grid element
             Element rootElement = gridFileDoc.getDocumentElement();
+            if (!"forms".equalsIgnoreCase(rootElement.getTagName())) {
+                rootElement = UtilXml.firstChildElement(rootElement, "forms");
+            }
             List<? extends Element> gridElements = UtilXml.childElementList(rootElement, "grid");
             for (Element gridElement : gridElements) {
                 String gridName = gridElement.getAttribute("name");
@@ -120,12 +123,19 @@ public class GridFactory {
     }
 
     public static ModelGrid createModelGrid(Document gridFileDoc, ModelReader entityModelReader, DispatchContext dispatchContext, String gridLocation, String gridName) {
-        Element gridElement = UtilXml.firstChildElement(gridFileDoc.getDocumentElement(), "grid", "name", gridName);
+        Element rootElement = gridFileDoc.getDocumentElement();
+        if (!"forms".equalsIgnoreCase(rootElement.getTagName())) {
+            rootElement = UtilXml.firstChildElement(rootElement, "forms");
+        }
+        Element gridElement = UtilXml.firstChildElement(rootElement, "grid", "name", gridName);
         if (gridElement == null) {
             // Backwards compatibility - look for form definition
             gridElement = UtilXml.firstChildElement(gridFileDoc.getDocumentElement(), "form", "name", gridName);
         }
-        return createModelGrid(gridElement, entityModelReader, dispatchContext, gridLocation, gridName);
+        if (gridElement == null) {
+            throw new IllegalArgumentException("Could not find grid with name [" + gridName + "] in class resource [" + gridLocation + "]");
+        }
+        return createModelGrid(gridElement, entityModelReader, visualTheme, dispatchContext, gridLocation, gridName);
     }
 
     public static ModelGrid createModelGrid(Element gridElement, ModelReader entityModelReader, DispatchContext dispatchContext, String gridLocation, String gridName) {

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 02/02: Fixed: Compound-widget not works with condition

jleroux@apache.org
In reply to this post by jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

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

commit 1bdd636146f0d1d498a190f2fe85c2d2b0f6bc3b
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 bea38fa..1549fa8 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 0959831..1d34176 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);
             }
         }
     }