@@ -520,7 +520,7 @@ protected void doExecute() {
520
520
521
521
for (Process process : model .getBpmnModel ().getProcesses ()) {
522
522
drawFlowElements (process .getFlowElements (), model .getBpmnModel ().getLocationMap (), diagram , process );
523
- drawArtifacts (process . getArtifacts () , model .getBpmnModel ().getLocationMap (), diagram , process );
523
+ drawArtifacts (process , model .getBpmnModel ().getLocationMap (), diagram , process );
524
524
}
525
525
drawAllFlows (model );
526
526
drawMessageFlows (model .getBpmnModel ().getMessageFlows ().values (), model );
@@ -561,6 +561,7 @@ private PictogramElement addContainerElement(BaseElement element, BpmnMemoryMode
561
561
return pictElement ;
562
562
}
563
563
564
+ @ SuppressWarnings ({ "rawtypes" , "unchecked" })
564
565
protected void drawFlowElements (Collection <FlowElement > elementList , Map <String , GraphicInfo > locationMap , ContainerShape parentShape , Process process ) {
565
566
566
567
final IFeatureProvider featureProvider = getDiagramTypeProvider ().getFeatureProvider ();
@@ -778,7 +779,7 @@ protected Point getLocation(ContainerShape containerShape) {
778
779
return new Point (location .x + containerShape .getGraphicsAlgorithm ().getX (), location .y + containerShape .getGraphicsAlgorithm ().getY ());
779
780
}
780
781
781
- private void drawMessageFlows (final Collection <MessageFlow > messageFlows , final BpmnMemoryModel model ) {
782
+ protected void drawMessageFlows (final Collection <MessageFlow > messageFlows , final BpmnMemoryModel model ) {
782
783
783
784
for (final MessageFlow messageFlow : messageFlows ) {
784
785
@@ -833,13 +834,13 @@ private void drawMessageFlows(final Collection<MessageFlow> messageFlows, final
833
834
}
834
835
}
835
836
836
- private void drawArtifacts (final Collection < Artifact > artifacts , final Map <String , GraphicInfo > locationMap , final ContainerShape parent ,
837
- final Process process ) {
837
+ protected void drawArtifacts (final FlowElementsContainer container , final Map <String , GraphicInfo > locationMap ,
838
+ final ContainerShape parent , final Process process ) {
838
839
839
840
final IFeatureProvider featureProvider = getDiagramTypeProvider ().getFeatureProvider ();
840
841
841
842
final List <Artifact > artifactsWithoutDI = new ArrayList <Artifact >();
842
- for (final Artifact artifact : artifacts ) {
843
+ for (final Artifact artifact : container . getArtifacts () ) {
843
844
844
845
if (artifact instanceof Association ) {
845
846
continue ;
@@ -862,7 +863,25 @@ private void drawArtifacts(final Collection<Artifact> artifacts, final Map<Strin
862
863
863
864
ContainerShape parentContainer = null ;
864
865
if (parent instanceof Diagram ) {
865
- parentContainer = getParentContainer (artifact .getId (), process , (Diagram ) parent );
866
+ FlowElement connectingElement = null ;
867
+ for (final Artifact associationArtifact : container .getArtifacts ()) {
868
+ if (associationArtifact instanceof Association ) {
869
+ Association association = (Association ) associationArtifact ;
870
+
871
+ if (association .getSourceRef ().equals (artifact .getId ())) {
872
+ connectingElement = container .getFlowElement (association .getTargetRef ());
873
+
874
+ } else if (association .getTargetRef ().equals (artifact .getId ())) {
875
+ connectingElement = container .getFlowElement (association .getSourceRef ());
876
+ }
877
+ }
878
+ }
879
+
880
+ if (connectingElement != null ) {
881
+ parentContainer = getParentContainer (connectingElement .getId (), process , (Diagram ) parent );
882
+ } else {
883
+ parentContainer = parent ;
884
+ }
866
885
} else {
867
886
parentContainer = parent ;
868
887
}
@@ -884,11 +903,18 @@ private void drawArtifacts(final Collection<Artifact> artifacts, final Map<Strin
884
903
}
885
904
886
905
for (final Artifact artifact : artifactsWithoutDI ) {
887
- artifacts .remove (artifact );
906
+ container .getArtifacts ().remove (artifact );
907
+ }
908
+
909
+ for (FlowElement flowElement : container .getFlowElements ()) {
910
+ if (flowElement instanceof SubProcess ) {
911
+ ContainerShape subProcessShape = (ContainerShape ) featureProvider .getPictogramElementForBusinessObject (flowElement );
912
+ drawArtifacts ((SubProcess ) flowElement , locationMap , subProcessShape , process );
913
+ }
888
914
}
889
915
}
890
916
891
- private void drawAllFlows (BpmnMemoryModel model ) {
917
+ protected void drawAllFlows (BpmnMemoryModel model ) {
892
918
BpmnModel bpmnModel = model .getBpmnModel ();
893
919
894
920
for (Process process : bpmnModel .getProcesses ()) {
@@ -897,7 +923,7 @@ private void drawAllFlows(BpmnMemoryModel model) {
897
923
}
898
924
}
899
925
900
- private void drawSequenceFlowsInList (Collection <FlowElement > flowList , BpmnMemoryModel model ) {
926
+ protected void drawSequenceFlowsInList (Collection <FlowElement > flowList , BpmnMemoryModel model ) {
901
927
for (FlowElement flowElement : flowList ) {
902
928
903
929
if (flowElement instanceof SubProcess ) {
@@ -913,7 +939,7 @@ private void drawSequenceFlowsInList(Collection<FlowElement> flowList, BpmnMemor
913
939
}
914
940
}
915
941
916
- private void drawSequenceFlow (SequenceFlow sequenceFlow , BpmnMemoryModel model ) {
942
+ protected void drawSequenceFlow (SequenceFlow sequenceFlow , BpmnMemoryModel model ) {
917
943
Anchor sourceAnchor = null ;
918
944
Anchor targetAnchor = null ;
919
945
ContainerShape sourceShape = (ContainerShape ) getDiagramTypeProvider ().getFeatureProvider ().getPictogramElementForBusinessObject (
@@ -964,7 +990,7 @@ private void drawSequenceFlow(SequenceFlow sequenceFlow, BpmnMemoryModel model)
964
990
getDiagramTypeProvider ().getFeatureProvider ().addIfPossible (addContext );
965
991
}
966
992
967
- private void drawAssociationsInList (Collection <Artifact > artifactList , BpmnMemoryModel model ) {
993
+ protected void drawAssociationsInList (Collection <Artifact > artifactList , BpmnMemoryModel model ) {
968
994
for (Artifact artifact : artifactList ) {
969
995
970
996
if (artifact instanceof Association == false ) {
@@ -976,8 +1002,7 @@ private void drawAssociationsInList(Collection<Artifact> artifactList, BpmnMemor
976
1002
}
977
1003
}
978
1004
979
- private void drawAssociation (Association association , BpmnMemoryModel model ) {
980
-
1005
+ protected void drawAssociation (Association association , BpmnMemoryModel model ) {
981
1006
Anchor sourceAnchor = null ;
982
1007
Anchor targetAnchor = null ;
983
1008
BaseElement sourceElement = model .getFlowElement (association .getSourceRef ());
0 commit comments