01: package org.andromda.metafacades.uml14;
02:
03: import java.util.ArrayList;
04: import java.util.Collection;
05: import java.util.Iterator;
06: import java.util.LinkedHashSet;
07: import java.util.List;
08:
09: import org.andromda.metafacades.uml.ActivityGraphFacade;
10: import org.andromda.metafacades.uml.FrontEndAction;
11: import org.andromda.metafacades.uml.FrontEndActivityGraph;
12: import org.andromda.metafacades.uml.FrontEndUseCase;
13: import org.andromda.metafacades.uml.StateMachineFacade;
14: import org.andromda.metafacades.uml.TransitionFacade;
15: import org.andromda.metafacades.uml.UseCaseFacade;
16:
17: /**
18: * MetafacadeLogic implementation for org.andromda.metafacades.uml.FrontEndPseudostate.
19: *
20: * @see org.andromda.metafacades.uml.FrontEndPseudostate
21: */
22: public class FrontEndPseudostateLogicImpl extends
23: FrontEndPseudostateLogic {
24: public FrontEndPseudostateLogicImpl(Object metaObject,
25: String context) {
26: super (metaObject, context);
27: }
28:
29: /**
30: * @see org.andromda.metafacades.uml.FrontEndPseudostate#isContainedInFrontEndUseCase()
31: */
32: protected boolean handleIsContainedInFrontEndUseCase() {
33: return this .getStateMachine() instanceof FrontEndActivityGraph;
34: }
35:
36: /**
37: * @see org.andromda.metafacades.uml.FrontEndPseudostate#getContainerActions()
38: */
39: protected List handleGetContainerActions() {
40: final Collection actionSet = new LinkedHashSet();
41: final StateMachineFacade graphContext = getStateMachine();
42:
43: if (graphContext instanceof ActivityGraphFacade) {
44: final UseCaseFacade useCase = ((ActivityGraphFacade) graphContext)
45: .getUseCase();
46:
47: if (useCase instanceof FrontEndUseCase) {
48: for (final Iterator actionIterator = ((FrontEndUseCase) useCase)
49: .getActions().iterator(); actionIterator
50: .hasNext();) {
51: final FrontEndAction action = (FrontEndAction) actionIterator
52: .next();
53: final Collection transitions = action
54: .getTransitions();
55: for (final Iterator transitionIterator = transitions
56: .iterator(); transitionIterator.hasNext();) {
57: TransitionFacade transition = (TransitionFacade) transitionIterator
58: .next();
59: if (this .equals(transition.getTarget())) {
60: actionSet.add(action);
61: }
62: }
63: }
64: }
65: }
66: return new ArrayList(actionSet);
67: }
68: }
|