Skip to content

Commit

Permalink
Fixed: Add missing form-name retrieval for auto-parameters-form (OFBI…
Browse files Browse the repository at this point in the history
…Z-12684)

Although it is defined in the xsd, the form-name parameters is not retrieved during the generation or link informations.
This add the retrieval and update the link when this parameter is used
  • Loading branch information
MkLeila authored Jan 22, 2025
1 parent 5cbbe63 commit ffaa7ad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,20 @@ public Link(Element linkElement) {
}
Element autoFormParamsElement = UtilXml.firstChildElement(linkElement, "auto-parameters-form");
if (autoFormParamsElement != null) {
Node formElement = autoFormParamsElement;
while (formElement != null
&& formElement.getLocalName() != "form") {
formElement = formElement.getParentNode();
}
if (formElement != null && formElement.getLocalName() != null) {
parameterList.add(new Parameter("_FORM_NAME_", ((Element) formElement).getAttribute("name") + "_AS_PARAM_", false));
String formName = null;
if (autoFormParamsElement.hasAttribute("form-name") && autoFormParamsElement.getAttribute("form-name") != null) {
formName = autoFormParamsElement.getAttribute("form-name");
} else {
Node formElement = autoFormParamsElement;
while (formElement != null
&& formElement.getLocalName() != "form") {
formElement = formElement.getParentNode();
}
if (formElement != null && formElement.getLocalName() != null) {
formName = ((Element) formElement).getAttribute("name");
}
}
parameterList.add(new Parameter("_FORM_NAME_", formName + "_AS_PARAM_", false));
}
this.parameterList = Collections.unmodifiableList(parameterList);
Element autoServiceParamsElement = UtilXml.firstChildElement(linkElement, "auto-parameters-service");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2317,15 +2317,20 @@ public UpdateArea(Element updateAreaElement, String defaultServiceName, String d
}
Element autoFormParamsElement = UtilXml.firstChildElement(updateAreaElement, "auto-parameters-form");
if (autoFormParamsElement != null) {
Node formElement = autoFormParamsElement;
while (formElement != null
&& formElement.getLocalName() != "form") {
formElement = formElement.getParentNode();
}
if (formElement != null && formElement.getLocalName() != null) {
parameterList.add(new CommonWidgetModels.Parameter("_FORM_NAME_", ((Element) formElement).getAttribute("name") + "_AS_PARAM_",
false));
String formName = null;
if (autoFormParamsElement.hasAttribute("form-name") && autoFormParamsElement.getAttribute("form-name") != null) {
formName = autoFormParamsElement.getAttribute("form-name");
} else {
Node formElement = autoFormParamsElement;
while (formElement != null
&& formElement.getLocalName() != "form") {
formElement = formElement.getParentNode();
}
if (formElement != null && formElement.getLocalName() != null) {
formName = ((Element) formElement).getAttribute("name");
}
}
parameterList.add(new CommonWidgetModels.Parameter("_FORM_NAME_", formName + "_AS_PARAM_", false));
}
this.parameterList = Collections.unmodifiableList(parameterList);
Element autoServiceParamsElement = UtilXml.firstChildElement(updateAreaElement, "auto-parameters-service");
Expand Down

0 comments on commit ffaa7ad

Please sign in to comment.