From: Omar Sweidan Date: Fri, 3 Jun 2022 17:11:34 +0000 (+0200) Subject: toXmlDocument működés javítás 0 variable esetén X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=b38ecde4e28b2a0c70637ea0a95bfe349a25087a;p=mediacube.git toXmlDocument működés javítás 0 variable esetén --- 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());