View Javadoc
1   package org.andromda.metafacades.emf.uml22;
2   
3   import java.util.ArrayList;
4   import java.util.Collection;
5   import java.util.List;
6   import org.eclipse.uml2.uml.Element;
7   import org.eclipse.uml2.uml.Namespace;
8   import org.eclipse.uml2.uml.Region;
9   import org.eclipse.uml2.uml.StateMachine;
10  import org.eclipse.uml2.uml.Transition;
11  import org.eclipse.uml2.uml.Vertex;
12  
13  /**
14   * MetafacadeLogic implementation for
15   * org.andromda.metafacades.uml.StateVertexFacade.
16   *
17   * @see org.andromda.metafacades.uml.StateVertexFacade
18   */
19  public class StateVertexFacadeLogicImpl
20      extends StateVertexFacadeLogic
21  {
22      private static final long serialVersionUID = 34L;
23      /**
24       * @param metaObject
25       * @param context
26       */
27      public StateVertexFacadeLogicImpl(
28          final Vertex metaObject,
29          final String context)
30      {
31          super(metaObject, context);
32      }
33  
34      /**
35       * @see org.andromda.metafacades.uml.StateVertexFacade#getOutgoings()
36       */
37      @Override
38      protected Collection<Transition> handleGetOutgoings()
39      {
40          final List<Transition> outList = new ArrayList<Transition>();
41          outList.addAll(this.metaObject.getOutgoings());
42          return outList;
43      }
44  
45      /**
46       * @see org.andromda.metafacades.uml.StateVertexFacade#getIncomings()
47       */
48      @Override
49      protected Collection<Transition> handleGetIncomings()
50      {
51          final List<Transition> inList = new ArrayList<Transition>();
52          inList.addAll(this.metaObject.getIncomings());
53          return inList;
54      }
55  
56      /**
57       * @see org.andromda.metafacades.uml.StateVertexFacade#getContainer()
58       */
59      @Override
60      protected Namespace handleGetContainer()
61      {
62          //TODO: What's this ?
63          return this.metaObject.getContainer().getNamespace();
64      }
65  
66      /**
67       * @see org.andromda.metafacades.uml.StateVertexFacade#getPartition()
68       */
69      @Override
70      protected Region handleGetPartition()
71      {
72          return this.metaObject.getContainer();
73      }
74  
75      /**
76       * @see org.andromda.metafacades.uml.StateVertexFacade#getStateMachine()
77       */
78      @Override
79      protected Element handleGetStateMachine()
80      {
81          Element owner = this.metaObject;
82          while (!(owner instanceof StateMachine))
83          {
84              owner = owner.getOwner();
85          }
86          return owner;
87      }
88  
89      /**
90       * getStateMachine
91       * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
92       */
93      @Override
94      public Object getValidationOwner()
95      {
96          return getStateMachine();
97      }
98  }