private void setAdHocSubProcessProperties(final AdHocSubProcess subProcess,
final Map<String, Object> properties) {
if (subProcess.getOrdering().equals(AdHocOrdering.PARALLEL)) {
properties.put(ADHOCORDERING,
"Parallel");
} else if (subProcess.getOrdering().equals(AdHocOrdering.SEQUENTIAL)) {
properties.put(ADHOCORDERING,
"Sequential");
} else {
properties.put(ADHOCORDERING,
"Parallel");
}
if (subProcess.getCompletionCondition() != null) {
final FormalExpression expression = (FormalExpression) subProcess.getCompletionCondition();
final String language = Utils.getScriptLanguage(expression.getLanguage());
final String script = expression.getBody().replaceAll("\n",
"\\\\n");
final ScriptTypeValue value = new ScriptTypeValue(language,
script);
properties.put(ADHOCCOMPLETIONCONDITION,
new ScriptTypeTypeSerializer().serialize(value));
}
}