1 package org.andromda.metafacades.uml14;
2
3 import java.util.Collection;
4 import java.util.Iterator;
5 import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
6 import org.omg.uml.behavioralelements.activitygraphs.Partition;
7 import org.omg.uml.behavioralelements.statemachines.CompositeState;
8 import org.omg.uml.behavioralelements.statemachines.StateMachine;
9 import org.omg.uml.behavioralelements.statemachines.StateVertex;
10
11
12
13
14
15
16
17 public class StateVertexFacadeLogicImpl
18 extends StateVertexFacadeLogic
19 {
20 private static final long serialVersionUID = 34L;
21
22
23
24
25 public StateVertexFacadeLogicImpl(StateVertex metaObject,
26 String context)
27 {
28 super(metaObject, context);
29 }
30
31
32
33
34 protected StateMachine handleGetStateMachine()
35 {
36
37 if (metaObject.getContainer()==null)
38 {
39 return null;
40 }
41 return metaObject.getContainer().getStateMachine();
42 }
43
44
45
46
47 protected CompositeState handleGetContainer()
48 {
49 return metaObject.getContainer();
50 }
51
52
53
54
55 protected Collection handleGetIncomings()
56 {
57 return metaObject.getIncoming();
58 }
59
60
61
62
63 protected Collection handleGetOutgoings()
64 {
65 return metaObject.getOutgoing();
66 }
67
68
69
70
71 public Object handleGetValidationOwner()
72 {
73 return getStateMachine();
74 }
75
76
77
78
79 protected Partition handleGetPartition()
80 {
81 Partition thePartition = null;
82
83 final StateMachine stateMachine = metaObject.getContainer().getStateMachine();
84 if (stateMachine instanceof ActivityGraph)
85 {
86 final ActivityGraph activityGraph = (ActivityGraph)stateMachine;
87 final Collection<Partition> partitions = activityGraph.getPartition();
88 for (final Iterator<Partition> partitionIterator = partitions.iterator(); partitionIterator.hasNext() && thePartition == null;)
89 {
90 final Partition partition = partitionIterator.next();
91 if (partition.getContents().contains(metaObject))
92 {
93 thePartition = partition;
94 }
95 }
96 }
97
98 return thePartition;
99 }
100 }