View Javadoc
1   package org.andromda.metafacades.emf.uml22;
2   
3   import java.util.ArrayList;
4   import java.util.Collection;
5   import java.util.Iterator;
6   import org.andromda.metafacades.uml.ModelElementFacade;
7   import org.andromda.utils.StringUtilsHelper;
8   import org.eclipse.uml2.uml.Behavior;
9   import org.eclipse.uml2.uml.Extend;
10  import org.eclipse.uml2.uml.ExtensionPoint;
11  import org.eclipse.uml2.uml.Include;
12  import org.eclipse.uml2.uml.StateMachine;
13  import org.eclipse.uml2.uml.UseCase;
14  
15  /**
16   * MetafacadeLogic implementation for
17   * org.andromda.metafacades.uml.UseCaseFacade.
18   *
19   * @see org.andromda.metafacades.uml.UseCaseFacade
20   */
21  public class UseCaseFacadeLogicImpl
22      extends UseCaseFacadeLogic
23  {
24      private static final long serialVersionUID = 34L;
25      /**
26       * @param metaObjectIn
27       * @param context
28       */
29      public UseCaseFacadeLogicImpl(
30          final UseCase metaObjectIn,
31          final String context)
32      {
33          super(metaObjectIn, context);
34      }
35  
36      /**
37       * @see org.andromda.metafacades.uml.UseCaseFacade#getFirstActivityGraph()
38       */
39      @Override
40      protected StateMachine handleGetFirstActivityGraph()
41      {
42          StateMachine activityGraph = null;
43          final Collection<Behavior> behaviors = new ArrayList<Behavior>();
44          behaviors.addAll(this.metaObject.getOwnedBehaviors()); // For MD11.5
45          //behaviors.addAll(this.metaObject.getOwnedStateMachines()); // For RSM // No longer exists in UML2 2.x
46          for (final Iterator<Behavior> iterator = behaviors.iterator(); iterator.hasNext() && activityGraph == null;)
47          {
48              final Behavior modelElement = iterator.next();
49              if (modelElement instanceof StateMachine)
50              {
51                  activityGraph = (StateMachine)modelElement;
52              }
53          }
54  
55          return activityGraph;
56      }
57  
58      /**
59       * @see org.andromda.metafacades.uml.UseCaseFacade#getExtensionPoints()
60       */
61      @Override
62      protected Collection<ExtensionPoint> handleGetExtensionPoints()
63      {
64          return this.metaObject.getExtensionPoints();
65      }
66  
67      /**
68       * @see org.andromda.metafacades.uml.UseCaseFacade#getExtends()
69       */
70      @Override
71      protected Collection<Extend> handleGetExtends()
72      {
73          return this.metaObject.getExtends();
74      }
75  
76      /**
77       * @see org.andromda.metafacades.emf.uml22.ClassifierFacadeLogicImpl#handleGetName()
78       */
79      @Override
80      protected String handleGetName()
81      {
82          return StringUtilsHelper.toSingleLine(super.handleGetName());
83      }
84  
85      /**
86       * @see org.andromda.metafacades.emf.uml22.UseCaseFacadeLogic#handleGetIncludes()
87       */
88      @Override
89      protected Collection<Include> handleGetIncludes()
90      {
91          return this.metaObject.getIncludes();
92      }
93  
94      /**
95       * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
96       */
97      @Override
98      public ModelElementFacade getValidationOwner()
99      {
100         return this.getPackage();
101     }
102 }