if (flowElement instanceof SequenceFlow) {
continue;
}
AddContext context = new AddContext(new AreaContext(), flowElement);
IAddFeature addFeature = featureProvider.getAddFeature(context);
if (addFeature == null) {
System.out.println("Element not supported: " + flowElement);
return;
}
GraphicInfo graphicInfo = locationMap.get(flowElement.getId());
if (graphicInfo == null) {
noDIList.add(flowElement);
} else {
context.setNewObject(flowElement);
context.setSize((int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());
ContainerShape parentContainer = null;
if (parentShape instanceof Diagram) {
parentContainer = getParentContainer(flowElement.getId(), process, (Diagram) parentShape);
} else {
parentContainer = parentShape;
}
context.setTargetContainer(parentContainer);
if (parentContainer instanceof Diagram == false) {
Point location = getLocation(parentContainer);
context.setLocation((int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y);
} else {
context.setLocation((int) graphicInfo.getX(), (int) graphicInfo.getY());
}
if (flowElement instanceof ServiceTask) {
ServiceTask serviceTask = (ServiceTask) flowElement;
if (serviceTask.isExtended()) {
CustomServiceTask targetTask = findCustomServiceTask(serviceTask);
if (targetTask != null) {
serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
serviceTask.setImplementation(targetTask.getRuntimeClassname());
for (FieldExtension field : serviceTask.getFieldExtensions()) {
CustomProperty customFieldProperty = new CustomProperty();
customFieldProperty.setName(field.getFieldName());
if (StringUtils.isNotEmpty(field.getExpression())) {
customFieldProperty.setSimpleValue(field.getExpression());
} else {
customFieldProperty.setSimpleValue(field.getStringValue());
}
serviceTask.getCustomProperties().add(customFieldProperty);
}
serviceTask.getFieldExtensions().clear();
}
}
}
if (flowElement instanceof BoundaryEvent) {
BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
if (boundaryEvent.getAttachedToRef() != null) {
ContainerShape container = (ContainerShape) featureProvider.getPictogramElementForBusinessObject(boundaryEvent.getAttachedToRef());
if (container != null) {
AddContext boundaryContext = new AddContext(new AreaContext(), boundaryEvent);
boundaryContext.setTargetContainer(container);
Point location = getLocation(container);
boundaryContext.setLocation((int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y);
if (addFeature.canAdd(boundaryContext)) {