View Javadoc
1   package org.andromda.metafacades.emf.uml22;
2   
3   import java.util.Collection;
4   import org.eclipse.uml2.uml.Activity;
5   import org.eclipse.uml2.uml.Element;
6   import org.eclipse.uml2.uml.Parameter;
7   import org.eclipse.uml2.uml.State;
8   import org.eclipse.uml2.uml.Transition;
9   
10  /**
11   * MetafacadeLogic implementation for org.andromda.metafacades.uml.EventFacade.
12   * UML1.4 Event are mapped to UML2 Activity (because UML2 Event doesn't contain
13   * parameter)
14   *
15   * @see org.andromda.metafacades.uml.EventFacade
16   */
17  public class EventFacadeLogicImpl
18      extends EventFacadeLogic
19  {
20      private static final long serialVersionUID = 34L;
21      /**
22       * @param metaObject
23       * @param context
24       */
25      public EventFacadeLogicImpl(
26          final Activity metaObject,
27          final String context)
28      {
29          super(metaObject, context);
30      }
31  
32      /**
33       * @see org.andromda.metafacades.uml.EventFacade#getTransition()
34       */
35      @Override
36      protected Transition handleGetTransition()
37      {
38          final Element owner = this.metaObject.getOwner();
39          if (owner instanceof Transition)
40          {
41              return (Transition) owner;
42          }
43          return null;
44      }
45  
46      /**
47       * @see org.andromda.metafacades.uml.EventFacade#getParameters()
48       */
49      @Override
50      protected Collection<Parameter> handleGetParameters()
51      {
52          return this.metaObject.getOwnedParameters();
53      }
54  
55      /**
56       * @see org.andromda.metafacades.uml.EventFacade#getState()
57       */
58      @Override
59      protected State handleGetState()
60      {
61          final Element owner = this.metaObject.getOwner();
62          if (owner instanceof State)
63          {
64              return (State)owner;
65          }
66          return null;
67      }
68  
69      /**
70       * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
71       */
72      @Override
73      public Object getValidationOwner()
74      {
75          Object validationOwner = this.getTransition();
76          if (validationOwner == null)
77          {
78              validationOwner = this.getState();
79          }
80          return validationOwner;
81      }
82  }