1 package org.andromda.metafacades.emf.uml22;
2
3 import java.util.ArrayList;
4 import java.util.Collection;
5 import java.util.List;
6 import org.andromda.metafacades.uml.OperationFacade;
7 import org.eclipse.uml2.uml.Activity;
8 import org.eclipse.uml2.uml.ActivityNode;
9 import org.eclipse.uml2.uml.CallOperationAction;
10 import org.eclipse.uml2.uml.Operation;
11
12
13
14
15
16
17
18
19 public class CallEventFacadeLogicImpl extends CallEventFacadeLogic
20 {
21 private static final long serialVersionUID = 7223650138117667366L;
22
23
24
25
26
27 public CallEventFacadeLogicImpl(final Activity metaObject,
28 final String context)
29 {
30 super(metaObject, context);
31 }
32
33
34
35
36 @Override
37 protected OperationFacade handleGetOperation()
38 {
39 final Collection<OperationFacade> operations = this.getOperations();
40 return operations.isEmpty() ? null : operations.iterator().next();
41 }
42
43
44
45
46 @Override
47 public List<Operation> handleGetOperations()
48 {
49
50 final List<Operation> operations = new ArrayList<Operation>();
51 Collection<ActivityNode> nodes = this.metaObject.getNodes();
52
53
54
55 if (nodes==null || nodes.isEmpty())
56 {
57 nodes = this.metaObject.getOwnedNodes();
58 }
59 for (final ActivityNode nextNode : nodes)
60 {
61 if (nextNode instanceof CallOperationAction)
62 {
63 final Operation operation = ((CallOperationAction) nextNode).getOperation();
64 if (operation != null)
65 {
66 operations.add(operation);
67 }
68 }
69 }
70 return operations;
71 }
72
73 }