Skip to content

Commit

Permalink
enables to bind worklfow with variables even when it don't have varia…
Browse files Browse the repository at this point in the history
  • Loading branch information
MaelAudren committed Apr 30, 2018
1 parent cb8f043 commit 647f453
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public JobType getType() {
// the final value of the variable can either be overwritten by a value of the replacement map or
// use in a pattern such value
commonPropertiesHolder.getVariables()
.putAll(createJobVariables(cursorJob, replacementVariables));
.putAll(createJobVariables(cursorJob));

} else if (XMLTags.COMMON_GENERIC_INFORMATION.matches(current)) {
commonPropertiesHolder.setGenericInformation(getGenericInformation(cursorJob,
Expand Down Expand Up @@ -389,6 +389,9 @@ public JobType getType() {
}
}

//replace variables
commonPropertiesHolder.getVariables().putAll(replaceVariablesInJobVariablesMap(commonPropertiesHolder.getVariables(),replacementVariables));

handleJobAttributes(commonPropertiesHolder, delayedJobAttributes);

//if this point is reached, fill the real job using the temporary one
Expand Down Expand Up @@ -468,12 +471,11 @@ private void handleCancelJobOnErrorAttribute(CommonAttribute commonPropertiesHol
* Leave the method with the cursor at the end of 'ELEMENT_VARIABLES' tag
*
* @param cursorVariables the streamReader with the cursor on the 'ELEMENT_VARIABLES' tag.
* @param replacementVariables variables which have precedence over the one defined in the job
//* @param replacementVariables variables which have precedence over the one defined in the job
* @return the map in which the variables were added.
* @throws JobCreationException
*/
private Map<String, JobVariable> createJobVariables(XMLStreamReader cursorVariables,
Map<String, String> replacementVariables) throws JobCreationException {
private Map<String, JobVariable> createJobVariables(XMLStreamReader cursorVariables) throws JobCreationException {
HashMap<String, JobVariable> variablesMap = new LinkedHashMap<>();
try {
int eventType;
Expand All @@ -492,7 +494,7 @@ private Map<String, JobVariable> createJobVariables(XMLStreamReader cursorVariab
break;
case XMLEvent.END_ELEMENT:
if (XMLTags.VARIABLES.matches(cursorVariables.getLocalName())) {
return replaceVariablesInJobVariablesMap(variablesMap, replacementVariables);
return variablesMap;
}
break;
}
Expand Down

0 comments on commit 647f453

Please sign in to comment.