if (element instanceof SequenceFlow) {
updateSequenceFlow((SequenceFlow) element);
} else if (element instanceof FlowElement) {
updateFlowElement(element);
if(element instanceof SubProcess) {
SubProcess subProcess = (SubProcess) element;
loopThroughElements(subProcess.getFlowElements(), subProcess);
loopThroughElements(subProcess.getArtifacts(), subProcess);
}
if(element instanceof Activity) {
Activity activity = (Activity) element;
for (BoundaryEvent boundaryEvent : activity.getBoundaryEvents()) {
updateFlowElement(boundaryEvent);
}
}
} else if (element instanceof Artifact) {
if (element instanceof Association) {
updateAssociation((Association) element);
} else {
updateFlowElement(element);
}
}
} else {
// no pictogram exist so delete it from the model as well
toDeleteElementList.add(element);
}
}
if (toDeleteElementList.size() > 0) {
if (parentElement instanceof Process) {
Process process = (Process) parentElement;
for (BaseElement toDeleteElement : toDeleteElementList) {
process.removeFlowElement(toDeleteElement.getId());
model.getBpmnModel().removeGraphicInfo(toDeleteElement.getId());
model.getBpmnModel().removeFlowGraphicInfoList(toDeleteElement.getId());
model.getBpmnModel().removeLabelGraphicInfo(toDeleteElement.getId());
}
} else if (parentElement instanceof SubProcess) {
SubProcess subProcess = (SubProcess) parentElement;
for (BaseElement toDeleteElement : toDeleteElementList) {
subProcess.removeFlowElement(toDeleteElement.getId());
model.getBpmnModel().removeGraphicInfo(toDeleteElement.getId());
model.getBpmnModel().removeFlowGraphicInfoList(toDeleteElement.getId());
model.getBpmnModel().removeLabelGraphicInfo(toDeleteElement.getId());
}
}