1 package org.andromda.metafacades.uml14;
2
3 import java.util.Collection;
4 import org.andromda.metafacades.uml.FrontEndController;
5 import org.andromda.metafacades.uml.FrontEndUseCase;
6 import org.andromda.metafacades.uml.ModelElementFacade;
7 import org.andromda.metafacades.uml.PseudostateFacade;
8 import org.andromda.metafacades.uml.TransitionFacade;
9 import org.andromda.metafacades.uml.UMLProfile;
10 import org.andromda.metafacades.uml.UseCaseFacade;
11
12
13
14
15
16
17
18
19 public class FrontEndActivityGraphLogicImpl
20 extends FrontEndActivityGraphLogic
21 {
22 private static final long serialVersionUID = 815773525076250652L;
23
24
25
26
27
28 public FrontEndActivityGraphLogicImpl (Object metaObject, String context)
29 {
30 super (metaObject, context);
31 }
32
33
34
35
36 @Override
37 protected boolean handleIsContainedInFrontEndUseCase()
38 {
39 return this.getUseCase() instanceof FrontEndUseCase;
40 }
41
42
43
44
45
46
47 protected Object handleGetUseCase()
48 {
49 Object useCase = super.handleGetUseCase();
50 if (useCase == null)
51 {
52 useCase = getModel().findUseCaseWithTaggedValueOrHyperlink(UMLProfile.TAGGEDVALUE_PRESENTATION_USECASE_ACTIVITY,
53 getName());
54 }
55 return useCase;
56 }
57
58
59
60
61 @Override
62 protected TransitionFacade handleGetInitialAction()
63 {
64 TransitionFacade firstAction = null;
65 final Collection<PseudostateFacade> initialStates = getInitialStates();
66 if (!initialStates.isEmpty())
67 {
68 final PseudostateFacade initialState = initialStates.iterator().next();
69 final Collection<TransitionFacade> outgoings = initialState.getOutgoings();
70 firstAction = outgoings.isEmpty() ? null : outgoings.iterator().next();
71 }
72 return firstAction;
73 }
74
75
76
77
78 @Override
79 protected Object handleGetController()
80 {
81 Object controller = null;
82
83 final ModelElementFacade contextElement = this.getContextElement();
84 if (contextElement instanceof FrontEndController)
85 {
86 controller = contextElement;
87 }
88
89
90
91
92
93 if (controller == null)
94 {
95 final UseCaseFacade useCase = this.getUseCase();
96 if (useCase != null)
97 {
98 final String useCaseName = useCase.getName();
99 controller = this.getModel().findClassWithTaggedValueOrHyperlink(
100 UMLProfile.TAGGEDVALUE_PRESENTATION_CONTROLLER_USECASE, useCaseName);
101 }
102 }
103 return controller;
104 }
105 }