01: package org.andromda.metafacades.uml14;
02:
03: import org.omg.uml.behavioralelements.activitygraphs.Partition;
04: import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
05: import org.omg.uml.behavioralelements.statemachines.StateMachine;
06:
07: import java.util.Collection;
08: import java.util.Iterator;
09:
10: /**
11: * MetafacadeLogic implementation.
12: *
13: * @see org.andromda.metafacades.uml.StateVertexFacade
14: */
15: public class StateVertexFacadeLogicImpl extends StateVertexFacadeLogic {
16: public StateVertexFacadeLogicImpl(
17: org.omg.uml.behavioralelements.statemachines.StateVertex metaObject,
18: java.lang.String context) {
19: super (metaObject, context);
20: }
21:
22: protected Object handleGetStateMachine() {
23: return metaObject.getContainer().getStateMachine();
24: }
25:
26: protected Object handleGetContainer() {
27: return metaObject.getContainer();
28: }
29:
30: protected Collection handleGetIncoming() {
31: return metaObject.getIncoming();
32: }
33:
34: protected Collection handleGetOutgoing() {
35: return metaObject.getOutgoing();
36: }
37:
38: public Object getValidationOwner() {
39: return getStateMachine();
40: }
41:
42: protected Object handleGetPartition() {
43: Partition thePartition = null;
44:
45: final StateMachine stateMachine = metaObject.getContainer()
46: .getStateMachine();
47: if (stateMachine instanceof ActivityGraph) {
48: final ActivityGraph activityGraph = (ActivityGraph) stateMachine;
49: final Collection partitions = activityGraph.getPartition();
50: for (final Iterator partitionIterator = partitions
51: .iterator(); partitionIterator.hasNext()
52: && thePartition == null;) {
53: final Partition partition = (Partition) partitionIterator
54: .next();
55: if (partition.getContents().contains(metaObject)) {
56: thePartition = partition;
57: }
58: }
59: }
60:
61: return thePartition;
62: }
63: }
|