1 package org.andromda.metafacades.uml14;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.Iterator;
6 import java.util.LinkedHashSet;
7 import java.util.List;
8 import org.andromda.metafacades.uml.ActivityGraphFacade;
9 import org.andromda.metafacades.uml.FrontEndAction;
10 import org.andromda.metafacades.uml.FrontEndActivityGraph;
11 import org.andromda.metafacades.uml.FrontEndForward;
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
19
20
21
22
23 public class FrontEndPseudostateLogicImpl
24 extends FrontEndPseudostateLogic
25 {
26 private static final long serialVersionUID = -3741898725444635931L;
27
28
29
30
31
32 public FrontEndPseudostateLogicImpl(
33 Object metaObject,
34 String context)
35 {
36 super(metaObject, context);
37 }
38
39
40
41
42 @Override
43 protected boolean handleIsContainedInFrontEndUseCase()
44 {
45 return this.getStateMachine() instanceof FrontEndActivityGraph;
46 }
47
48
49
50
51 @Override
52 protected List<FrontEndAction> handleGetContainerActions()
53 {
54 final Collection<FrontEndAction> actionSet = new LinkedHashSet<FrontEndAction>();
55 final StateMachineFacade graphContext = getStateMachine();
56
57 if (graphContext instanceof ActivityGraphFacade)
58 {
59 final UseCaseFacade useCase = ((ActivityGraphFacade)graphContext).getUseCase();
60
61 if (useCase instanceof FrontEndUseCase)
62 {
63 for (
64 final Iterator actionIterator = ((FrontEndUseCase)useCase).getActions().iterator();
65 actionIterator.hasNext();)
66 {
67 final FrontEndAction action = (FrontEndAction)actionIterator.next();
68 final Collection<FrontEndForward> transitions = action.getTransitions();
69 for (final Iterator<FrontEndForward> transitionIterator = transitions.iterator(); transitionIterator.hasNext();)
70 {
71 TransitionFacade transition = (TransitionFacade)transitionIterator.next();
72 if (this.equals(transition.getTarget()))
73 {
74 actionSet.add(action);
75 }
76 }
77 }
78 }
79 }
80 return new ArrayList<FrontEndAction>(actionSet);
81 }
82 }