copy.setConstraint(node.getConstraint());
if (node instanceof ITimed && ((ITimed) node).timerExist()) {
((ITimed) copy).setDueDate(((ITimed) node).getDuration().getDuration());
String variableName = ((ITimed) node).getDuration().getVariableName();
if (variableName != null) {
Variable variable = copyBuffer.getSourceDefinition().getVariablesMap().get(variableName);
CopyVariableAction copyAction = new CopyVariableAction(variable);
elements.add(copyAction);
}
}
if (node instanceof State) {
((State) copy).setMinimizedView(((State) node).isMinimizedView());
}
if (node instanceof Decision) {
copy.setDelegationConfiguration(node.getDelegationConfiguration());
copy.setDelegationClassName(node.getDelegationClassName());
}
if (node instanceof Subprocess) {
((Subprocess) copy).setSubProcessName(((Subprocess) node).getSubProcessName());
List<VariableMapping> variables = ((Subprocess) node).getVariablesList();
((Subprocess) copy).setVariablesList(variables);
for (VariableMapping varMapping : variables) {
Variable variable = copyBuffer.getSourceDefinition().getVariablesMap().get(varMapping.getProcessVariable());
if (variable != null) {
CopyVariableAction copyAction = new CopyVariableAction(variable);
elements.add(copyAction);
}
}
copy.setDelegationClassName(node.getDelegationClassName());
}
targetDefinition.addChild(copy);
targetNodeList.put(copy.getName(), copy);
if (node instanceof FormNode) {
FormNode formNode = (FormNode) node;
if (formNode.hasForm() || formNode.hasFormValidation()) {
CopyFormFilesAction copyAction = new CopyFormFilesAction(formNode, (FormNode) copy);
copyAction.setSourceFolder(copyBuffer.getSourceFolder());
copyAction.setTargetFolder(targetFolder);
elements.add(copyAction);
}
Map<String, Integer> variables = formNode.getFormVariables(copyBuffer.getSourceFolder());
for (String varName : variables.keySet()) {
Variable variable = copyBuffer.getSourceDefinition().getVariablesMap().get(varName);
if (variable != null) {
CopyVariableAction copyAction = new CopyVariableAction(variable);
elements.add(copyAction);
}
}