JobTemplate futó változó refaktor
authorOmar Sweidan <omar.sweidan@userrendszerhaz.hu>
Fri, 3 Jun 2022 17:09:54 +0000 (19:09 +0200)
committerOmar Sweidan <omar.sweidan@userrendszerhaz.hu>
Fri, 3 Jun 2022 18:42:59 +0000 (20:42 +0200)
server/user.jobengine.osgi.server/src/user/jobengine/server/ast/JobTemplate.java

index 71ee6171e1e122f4421bb13640c0f9814fb02264..bee3a695f664b7e798d57da59d0e1c5de46a4439 100644 (file)
@@ -20,6 +20,11 @@ import org.w3c.dom.Element;
  * Gyökér osztály.\r
  */\r
 public class JobTemplate extends AST implements Serializable {\r
+       /**\r
+        * \r
+        */\r
+       private static final long serialVersionUID = 1L;\r
+\r
        private static final Logger logger = LogManager.getLogger(JobTemplate.class);\r
 \r
        private CommandSequence commandSequence = null;\r
@@ -112,7 +117,6 @@ public class JobTemplate extends AST implements Serializable {
                this.useSessionLog = useSessionLog;\r
        }\r
 \r
-       // TODO foreach ellenorzes\r
        public List<String> validate() throws Exception {\r
                Map<String, String> parameters = new HashMap<>();\r
                Map<String, String> variables = new HashMap<>();\r
@@ -246,23 +250,21 @@ public class JobTemplate extends AST implements Serializable {
                                Element variables = document.createElement("variables");\r
                                declarations.appendChild(parameters);\r
                                declarations.appendChild(variables);\r
-\r
-                               for (int i = 0; i < getDeclarationSequence().getDeclarations().size(); i++) {\r
+                               \r
+                               List<Declaration> declarationsList = getDeclarationSequence().getDeclarations();\r
+                               for (int i = 0; i < declarationsList.size(); i++) {\r
                                        Element declarationElement = null;\r
-                                       if (getDeclarationSequence().getDeclarations().get(i).getClass().getSimpleName()\r
-                                                       .equals("ParameterDeclaration")) {\r
+                                       Declaration declaration = declarationsList.get(i);\r
+\r
+                                       if (declaration.getClass().getSimpleName().equals("ParameterDeclaration")) {\r
                                                declarationElement = document.createElement("parameter");\r
-                                               declarationElement.setAttribute("name",\r
-                                                               getDeclarationSequence().getDeclarations().get(i).getName());\r
-                                               declarationElement.setAttribute("type",\r
-                                                               getDeclarationSequence().getDeclarations().get(i).getType());\r
+                                               declarationElement.setAttribute("name", declaration.getName());\r
+                                               declarationElement.setAttribute("type", declaration.getType());\r
                                                parameters.appendChild(declarationElement);\r
                                        } else {\r
                                                declarationElement = document.createElement("variable");\r
-                                               declarationElement.setAttribute("name",\r
-                                                               getDeclarationSequence().getDeclarations().get(i).getName());\r
-                                               declarationElement.setAttribute("type",\r
-                                                               getDeclarationSequence().getDeclarations().get(i).getType());\r
+                                               declarationElement.setAttribute("name", declaration.getName());\r
+                                               declarationElement.setAttribute("type", declaration.getType());\r
                                                variables.appendChild(declarationElement);\r
                                        }\r
                                }\r
@@ -270,8 +272,9 @@ public class JobTemplate extends AST implements Serializable {
                        if (getCommandSequence() != null) {\r
                                Element commands = document.createElement("commands");\r
                                root.appendChild(commands);\r
-                               for (int i = 0; i < getCommandSequence().getCommands().size(); i++) {\r
-                                       CallJobStepCommand cjs = (CallJobStepCommand) getCommandSequence().getCommands().get(i);\r
+                               List<Command> commandsList = getCommandSequence().getCommands();\r
+                               for (int i = 0; i < commandsList.size(); i++) {\r
+                                       CallJobStepCommand cjs = (CallJobStepCommand) commandsList.get(i);\r
                                        Element command = document.createElement("calljobstep");\r
                                        command.setAttribute("type", cjs.getType());\r
                                        command.setAttribute("weight", Integer.toString(cjs.getWeight()));\r
@@ -295,11 +298,12 @@ public class JobTemplate extends AST implements Serializable {
                                        }\r
                                        command.appendChild(inputs);\r
 \r
-                                       OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence();\r
-                                       if (ops != null) {\r
+                                       if (cjs.getOutputParameterSequence() != null) {\r
+                                               OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence();\r
                                                Element outputs = document.createElement("outputs");\r
-                                               for (int j = 0; j < ops.getParameters().size(); j++) {\r
-                                                       OutputParameter op = (OutputParameter) (ops.getParameters().get(j));\r
+                                               List<Parameter> outputParameters = ops.getParameters();\r
+                                               for (int j = 0; j < outputParameters.size(); j++) {\r
+                                                       OutputParameter op = (OutputParameter) (outputParameters.get(j));\r
                                                        Element output = document.createElement("output");\r
                                                        Element variable = document.createElement("variable");\r
                                                        variable.setAttribute("name", op.getVariableName().getName());\r