View Javadoc
1   package org.andromda.metafacades.emf.uml22;
2   
3   import org.eclipse.uml2.uml.Action;
4   import org.eclipse.uml2.uml.Behavior;
5   import org.eclipse.uml2.uml.ConnectableElement;
6   import org.eclipse.uml2.uml.State;
7   
8   /**
9    * MetafacadeLogic implementation for
10   * org.andromda.metafacades.uml.ActionStateFacade.
11   *
12   * @see org.andromda.metafacades.uml.ActionStateFacade
13   */
14  public class ActionStateFacadeLogicImpl
15      extends ActionStateFacadeLogic
16  {
17      private static final long serialVersionUID = 34L;
18      /**
19       * @param metaObject
20       * @param context
21       */
22      public ActionStateFacadeLogicImpl(
23          final State metaObject,
24          final String context)
25      {
26          super(metaObject, context);
27      }
28  
29      /**
30       * UML1.4 Entry is an Action, where as in UML2 it's an activity. We have
31       * then to return the first action of the activity.
32       *
33       * @see org.andromda.metafacades.uml.ActionStateFacade#getEntry()
34       */
35      @Override
36      protected Action handleGetEntry()
37      {
38          final Behavior activity = this.metaObject.getEntry();
39          if (activity != null)
40          {
41              for (ConnectableElement nextNode : activity.getRoles())
42              {
43                  if (nextNode instanceof Action)
44                  {
45                      return (Action) nextNode;
46                  }
47              }
48          }
49  
50          // No action has been found.
51          return null;
52      }
53  }