1 package org.andromda.metafacades.emf.uml22;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.LinkedHashSet;
6 import java.util.List;
7 import org.andromda.metafacades.uml.DependencyFacade;
8 import org.andromda.metafacades.uml.FilteredCollection;
9 import org.andromda.metafacades.uml.FrontEndAction;
10 import org.andromda.metafacades.uml.FrontEndControllerOperation;
11 import org.andromda.metafacades.uml.OperationFacade;
12 import org.andromda.metafacades.uml.Service;
13 import org.eclipse.uml2.uml.Classifier;
14 import org.eclipse.uml2.uml.Element;
15 import org.eclipse.uml2.uml.UseCase;
16
17
18
19
20
21
22
23 public class FrontEndControllerLogicImpl
24 extends FrontEndControllerLogic
25 {
26 private static final long serialVersionUID = -8765076432370916838L;
27
28
29
30
31
32
33
34
35
36
37 public FrontEndControllerLogicImpl(
38 final Object metaObject,
39 final String context)
40 {
41 super(metaObject, context);
42 }
43
44
45
46
47 @Override
48 protected List<DependencyFacade> handleGetServiceReferences()
49 {
50 return new FilteredCollection(this.getSourceDependencies())
51 {
52 private static final long serialVersionUID = 34L;
53 @Override
54 public boolean evaluate(final Object object)
55 {
56 return ((DependencyFacade)object).getTargetElement() instanceof Service;
57 }
58 };
59 }
60
61
62
63
64 @Override
65 protected Element handleGetUseCase()
66 {
67 Element owner = (Classifier)this.metaObject;
68 while (!(owner == null || owner instanceof UseCase))
69 {
70 owner = owner.getOwner();
71 }
72 return owner;
73 }
74
75
76
77
78 @Override
79 protected List<FrontEndAction> handleGetDeferringActions()
80 {
81 final Collection<FrontEndAction> deferringActions = new LinkedHashSet<FrontEndAction>();
82
83 for (final OperationFacade operation : this.getOperations())
84 {
85 final FrontEndControllerOperation controllerOperation = (FrontEndControllerOperation)operation;
86 deferringActions.addAll(controllerOperation.getDeferringActions());
87 }
88 return new ArrayList<FrontEndAction>(deferringActions);
89 }
90
91
92
93
94
95 }