From b38ecde4e28b2a0c70637ea0a95bfe349a25087a Mon Sep 17 00:00:00 2001 From: Omar Sweidan Date: Fri, 3 Jun 2022 19:11:34 +0200 Subject: [PATCH] =?utf8?q?toXmlDocument=20m=C5=B1k=C3=B6d=C3=A9s=20jav?= =?utf8?q?=C3=ADt=C3=A1s=200=20variable=20eset=C3=A9n?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jobengine/server/ast/JobTemplate.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/server/ast/JobTemplate.java b/server/user.jobengine.osgi.server/src/user/jobengine/server/ast/JobTemplate.java index bee3a695..8835f0bc 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/server/ast/JobTemplate.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/server/ast/JobTemplate.java @@ -248,13 +248,10 @@ public class JobTemplate extends AST implements Serializable { root.appendChild(declarations); Element parameters = document.createElement("parameters"); Element variables = document.createElement("variables"); - declarations.appendChild(parameters); - declarations.appendChild(variables); - - List declarationsList = getDeclarationSequence().getDeclarations(); - for (int i = 0; i < declarationsList.size(); i++) { + + for (int i = 0; i < getDeclarationSequence().getDeclarations().size(); i++) { Element declarationElement = null; - Declaration declaration = declarationsList.get(i); + Declaration declaration = getDeclarationSequence().getDeclarations().get(i); if (declaration.getClass().getSimpleName().equals("ParameterDeclaration")) { declarationElement = document.createElement("parameter"); @@ -268,13 +265,16 @@ public class JobTemplate extends AST implements Serializable { variables.appendChild(declarationElement); } } + declarations.appendChild(parameters); + if (variables.hasChildNodes()) { + declarations.appendChild(variables); + } } if (getCommandSequence() != null) { Element commands = document.createElement("commands"); root.appendChild(commands); - List commandsList = getCommandSequence().getCommands(); - for (int i = 0; i < commandsList.size(); i++) { - CallJobStepCommand cjs = (CallJobStepCommand) commandsList.get(i); + for (int i = 0; i < getCommandSequence().getCommands().size(); i++) { + CallJobStepCommand cjs = (CallJobStepCommand) getCommandSequence().getCommands().get(i); Element command = document.createElement("calljobstep"); command.setAttribute("type", cjs.getType()); command.setAttribute("weight", Integer.toString(cjs.getWeight())); @@ -298,12 +298,11 @@ public class JobTemplate extends AST implements Serializable { } command.appendChild(inputs); - if (cjs.getOutputParameterSequence() != null) { - OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence(); + OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence(); + if (ops != null) { Element outputs = document.createElement("outputs"); - List outputParameters = ops.getParameters(); - for (int j = 0; j < outputParameters.size(); j++) { - OutputParameter op = (OutputParameter) (outputParameters.get(j)); + for (int j = 0; j < ops.getParameters().size(); j++) { + OutputParameter op = (OutputParameter) (ops.getParameters().get(j)); Element output = document.createElement("output"); Element variable = document.createElement("variable"); variable.setAttribute("name", op.getVariableName().getName()); -- 2.54.0