From: Omar Sweidan Date: Fri, 3 Jun 2022 17:09:54 +0000 (+0200) Subject: JobTemplate futó változó refaktor X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=df912e5dd0614b326107da79891db2a06b8ca0b2;p=mediacube.git JobTemplate futó változó refaktor --- 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 71ee6171..bee3a695 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 @@ -20,6 +20,11 @@ import org.w3c.dom.Element; * Gyökér osztály. */ public class JobTemplate extends AST implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + private static final Logger logger = LogManager.getLogger(JobTemplate.class); private CommandSequence commandSequence = null; @@ -112,7 +117,6 @@ public class JobTemplate extends AST implements Serializable { this.useSessionLog = useSessionLog; } - // TODO foreach ellenorzes public List validate() throws Exception { Map parameters = new HashMap<>(); Map variables = new HashMap<>(); @@ -246,23 +250,21 @@ public class JobTemplate extends AST implements Serializable { Element variables = document.createElement("variables"); declarations.appendChild(parameters); declarations.appendChild(variables); - - for (int i = 0; i < getDeclarationSequence().getDeclarations().size(); i++) { + + List declarationsList = getDeclarationSequence().getDeclarations(); + for (int i = 0; i < declarationsList.size(); i++) { Element declarationElement = null; - if (getDeclarationSequence().getDeclarations().get(i).getClass().getSimpleName() - .equals("ParameterDeclaration")) { + Declaration declaration = declarationsList.get(i); + + if (declaration.getClass().getSimpleName().equals("ParameterDeclaration")) { declarationElement = document.createElement("parameter"); - declarationElement.setAttribute("name", - getDeclarationSequence().getDeclarations().get(i).getName()); - declarationElement.setAttribute("type", - getDeclarationSequence().getDeclarations().get(i).getType()); + declarationElement.setAttribute("name", declaration.getName()); + declarationElement.setAttribute("type", declaration.getType()); parameters.appendChild(declarationElement); } else { declarationElement = document.createElement("variable"); - declarationElement.setAttribute("name", - getDeclarationSequence().getDeclarations().get(i).getName()); - declarationElement.setAttribute("type", - getDeclarationSequence().getDeclarations().get(i).getType()); + declarationElement.setAttribute("name", declaration.getName()); + declarationElement.setAttribute("type", declaration.getType()); variables.appendChild(declarationElement); } } @@ -270,8 +272,9 @@ public class JobTemplate extends AST implements Serializable { if (getCommandSequence() != null) { Element commands = document.createElement("commands"); root.appendChild(commands); - for (int i = 0; i < getCommandSequence().getCommands().size(); i++) { - CallJobStepCommand cjs = (CallJobStepCommand) getCommandSequence().getCommands().get(i); + List commandsList = getCommandSequence().getCommands(); + for (int i = 0; i < commandsList.size(); i++) { + CallJobStepCommand cjs = (CallJobStepCommand) commandsList.get(i); Element command = document.createElement("calljobstep"); command.setAttribute("type", cjs.getType()); command.setAttribute("weight", Integer.toString(cjs.getWeight())); @@ -295,11 +298,12 @@ public class JobTemplate extends AST implements Serializable { } command.appendChild(inputs); - OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence(); - if (ops != null) { + if (cjs.getOutputParameterSequence() != null) { + OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence(); Element outputs = document.createElement("outputs"); - for (int j = 0; j < ops.getParameters().size(); j++) { - OutputParameter op = (OutputParameter) (ops.getParameters().get(j)); + List outputParameters = ops.getParameters(); + for (int j = 0; j < outputParameters.size(); j++) { + OutputParameter op = (OutputParameter) (outputParameters.get(j)); Element output = document.createElement("output"); Element variable = document.createElement("variable"); variable.setAttribute("name", op.getVariableName().getName());