01: package org.andromda.metafacades.emf.uml2;
02:
03: import java.util.Iterator;
04:
05: import org.eclipse.uml2.Action;
06: import org.eclipse.uml2.Activity;
07:
08: /**
09: * MetafacadeLogic implementation for
10: * org.andromda.metafacades.uml.ActionStateFacade.
11: *
12: * @see org.andromda.metafacades.uml.ActionStateFacade
13: */
14: public class ActionStateFacadeLogicImpl extends ActionStateFacadeLogic {
15: public ActionStateFacadeLogicImpl(
16: final org.eclipse.uml2.State metaObject,
17: final String context) {
18: super (metaObject, context);
19: }
20:
21: /**
22: * UML1.4 Entry is an Action, where as in UML2 it's an activity. We have
23: * then to return the first action of the activity.
24: *
25: * @see org.andromda.metafacades.uml.ActionStateFacade#getEntry()
26: */
27: protected java.lang.Object handleGetEntry() {
28: Activity activity = this .metaObject.getEntry();
29: if (activity != null) {
30: for (Iterator nodesIt = activity.getNodes().iterator(); nodesIt
31: .hasNext();) {
32: Object nextNode = nodesIt.next();
33: if (nextNode instanceof Action) {
34: return nextNode;
35: }
36: }
37: }
38:
39: // No action has been found.
40: return null;
41: }
42: }
|