01: package org.andromda.metafacades.emf.uml2;
02:
03: import java.util.ArrayList;
04: import java.util.Collection;
05: import java.util.Iterator;
06:
07: import org.andromda.utils.StringUtilsHelper;
08: import org.eclipse.uml2.Behavior;
09: import org.eclipse.uml2.StateMachine;
10:
11: /**
12: * MetafacadeLogic implementation for
13: * org.andromda.metafacades.uml.UseCaseFacade.
14: *
15: * @see org.andromda.metafacades.uml.UseCaseFacade
16: */
17: public class UseCaseFacadeLogicImpl extends UseCaseFacadeLogic {
18: public UseCaseFacadeLogicImpl(
19: final org.eclipse.uml2.UseCase metaObject,
20: final String context) {
21: super (metaObject, context);
22: }
23:
24: /**
25: * @see org.andromda.metafacades.uml.UseCaseFacade#getFirstActivityGraph()
26: */
27: protected java.lang.Object handleGetFirstActivityGraph() {
28: StateMachine activityGraph = null;
29: Collection behaviors = new ArrayList();
30: behaviors.addAll(this .metaObject.getOwnedBehaviors()); // For MD11.5
31: behaviors.addAll(this .metaObject.getOwnedStateMachines()); // For RSM
32: for (final Iterator iterator = behaviors.iterator(); iterator
33: .hasNext()
34: && activityGraph == null;) {
35: final Behavior modelElement = (Behavior) iterator.next();
36: if (modelElement instanceof StateMachine) {
37: activityGraph = (StateMachine) modelElement;
38: }
39: }
40:
41: return activityGraph;
42: }
43:
44: /**
45: * @see org.andromda.metafacades.uml.UseCaseFacade#getExtensionPoints()
46: */
47: protected java.util.Collection handleGetExtensionPoints() {
48: return this .metaObject.getExtensionPoints();
49: }
50:
51: /**
52: * @see org.andromda.metafacades.uml.UseCaseFacade#getExtends()
53: */
54: protected java.util.Collection handleGetExtends() {
55: return this .metaObject.getExtends();
56: }
57:
58: protected String handleGetName() {
59: return StringUtilsHelper.toSingleLine(super .handleGetName());
60: }
61:
62: protected java.util.Collection handleGetIncludes() {
63: return this .metaObject.getIncludes();
64: }
65:
66: public Object getValidationOwner() {
67: return this.getPackage();
68: }
69: }
|