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
17
18
19
20
21 public class UseCaseFacadeLogicImpl
22 extends UseCaseFacadeLogic
23 {
24 private static final long serialVersionUID = 34L;
25
26
27
28
29 public UseCaseFacadeLogicImpl(
30 final UseCase metaObjectIn,
31 final String context)
32 {
33 super(metaObjectIn, context);
34 }
35
36
37
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());
45
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
60
61 @Override
62 protected Collection<ExtensionPoint> handleGetExtensionPoints()
63 {
64 return this.metaObject.getExtensionPoints();
65 }
66
67
68
69
70 @Override
71 protected Collection<Extend> handleGetExtends()
72 {
73 return this.metaObject.getExtends();
74 }
75
76
77
78
79 @Override
80 protected String handleGetName()
81 {
82 return StringUtilsHelper.toSingleLine(super.handleGetName());
83 }
84
85
86
87
88 @Override
89 protected Collection<Include> handleGetIncludes()
90 {
91 return this.metaObject.getIncludes();
92 }
93
94
95
96
97 @Override
98 public ModelElementFacade getValidationOwner()
99 {
100 return this.getPackage();
101 }
102 }