01: package org.andromda.metafacades.uml14;
02:
03: import org.omg.uml.behavioralelements.activitygraphs.ActionState;
04: import org.omg.uml.behavioralelements.statemachines.Transition;
05:
06: import java.util.Collection;
07: import java.util.Iterator;
08:
09: /**
10: * MetafacadeLogic implementation.
11: *
12: * @see org.andromda.metafacades.uml.ActionFacade
13: */
14: public class ActionFacadeLogicImpl extends ActionFacadeLogic {
15: public ActionFacadeLogicImpl(
16: org.omg.uml.behavioralelements.commonbehavior.Action metaObject,
17: java.lang.String context) {
18: super (metaObject, context);
19: }
20:
21: protected Object handleGetTransition() {
22: Transition effectTransition = null;
23:
24: final Collection allTransitions = UML14MetafacadeUtils
25: .getModel().getStateMachines().getTransition()
26: .refAllOfType();
27: for (final Iterator iterator = allTransitions.iterator(); iterator
28: .hasNext()
29: && effectTransition == null;) {
30: Transition transition = (Transition) iterator.next();
31: if (metaObject.equals(transition.getEffect())) {
32: effectTransition = transition;
33: }
34: }
35:
36: return effectTransition;
37: }
38:
39: protected Object handleGetActionState() {
40: ActionState entryState = null;
41:
42: final Collection allActionStates = UML14MetafacadeUtils
43: .getModel().getActivityGraphs().getActionState()
44: .refAllOfType();
45: for (final Iterator iterator = allActionStates.iterator(); iterator
46: .hasNext()
47: && entryState == null;) {
48: final ActionState actionState = (ActionState) iterator
49: .next();
50: if (metaObject.equals(actionState.getEntry())) {
51: entryState = actionState;
52: }
53: }
54:
55: return entryState;
56: }
57:
58: public Object getValidationOwner() {
59: Object validationOwner = getTransition();
60:
61: if (validationOwner == null) {
62: validationOwner = getActionState();
63: }
64:
65: return validationOwner;
66: }
67: }
|