root.appendChild(declarations);\r
Element parameters = document.createElement("parameters");\r
Element variables = document.createElement("variables");\r
- declarations.appendChild(parameters);\r
- declarations.appendChild(variables);\r
- \r
- List<Declaration> declarationsList = getDeclarationSequence().getDeclarations();\r
- for (int i = 0; i < declarationsList.size(); i++) {\r
+\r
+ for (int i = 0; i < getDeclarationSequence().getDeclarations().size(); i++) {\r
Element declarationElement = null;\r
- Declaration declaration = declarationsList.get(i);\r
+ Declaration declaration = getDeclarationSequence().getDeclarations().get(i);\r
\r
if (declaration.getClass().getSimpleName().equals("ParameterDeclaration")) {\r
declarationElement = document.createElement("parameter");\r
variables.appendChild(declarationElement);\r
}\r
}\r
+ declarations.appendChild(parameters);\r
+ if (variables.hasChildNodes()) {\r
+ declarations.appendChild(variables);\r
+ }\r
}\r
if (getCommandSequence() != null) {\r
Element commands = document.createElement("commands");\r
root.appendChild(commands);\r
- List<Command> commandsList = getCommandSequence().getCommands();\r
- for (int i = 0; i < commandsList.size(); i++) {\r
- CallJobStepCommand cjs = (CallJobStepCommand) commandsList.get(i);\r
+ for (int i = 0; i < getCommandSequence().getCommands().size(); i++) {\r
+ CallJobStepCommand cjs = (CallJobStepCommand) getCommandSequence().getCommands().get(i);\r
Element command = document.createElement("calljobstep");\r
command.setAttribute("type", cjs.getType());\r
command.setAttribute("weight", Integer.toString(cjs.getWeight()));\r
}\r
command.appendChild(inputs);\r
\r
- if (cjs.getOutputParameterSequence() != null) {\r
- OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence();\r
+ OutputParameterSequence ops = (OutputParameterSequence) cjs.getOutputParameterSequence();\r
+ if (ops != null) {\r
Element outputs = document.createElement("outputs");\r
- List<Parameter> outputParameters = ops.getParameters();\r
- for (int j = 0; j < outputParameters.size(); j++) {\r
- OutputParameter op = (OutputParameter) (outputParameters.get(j));\r
+ for (int j = 0; j < ops.getParameters().size(); j++) {\r
+ OutputParameter op = (OutputParameter) (ops.getParameters().get(j));\r
Element output = document.createElement("output");\r
Element variable = document.createElement("variable");\r
variable.setAttribute("name", op.getVariableName().getName());\r