01: package org.andromda.metafacades.emf.uml2;
02:
03: import java.util.ArrayList;
04: import java.util.Collection;
05: import java.util.Iterator;
06: import java.util.List;
07:
08: import org.eclipse.uml2.CallOperationAction;
09:
10: /**
11: * MetafacadeLogic implementation for
12: * org.andromda.metafacades.uml.CallEventFacade. UML1.4 Event are mapped to UML2
13: * Activity (because UML2 Event doesn't contain parameter)
14: *
15: * @see org.andromda.metafacades.uml.CallEventFacade
16: */
17: public class CallEventFacadeLogicImpl extends CallEventFacadeLogic {
18:
19: public CallEventFacadeLogicImpl(
20: final org.eclipse.uml2.Activity metaObject,
21: final String context) {
22: super (metaObject, context);
23: }
24:
25: /**
26: * @see org.andromda.metafacades.uml.CallEventFacade#getOperation()
27: */
28: protected java.lang.Object handleGetOperation() {
29: final List operations = this .getOperations();
30: return operations.isEmpty() ? null : operations.iterator()
31: .next();
32: }
33:
34: /**
35: * @see org.andromda.metafacades.uml.CallEventFacade#getOperations()
36: */
37: public List handleGetOperations() {
38: // We get every operation from each CallOperationAction instance.
39: final List operations = new ArrayList();
40: Collection nodes = this .metaObject.getNodes();
41: for (final Iterator iterator = nodes.iterator(); iterator
42: .hasNext();) {
43: final Object nextNode = iterator.next();
44: if (nextNode instanceof CallOperationAction) {
45: operations.add(((CallOperationAction) nextNode)
46: .getOperation());
47: }
48: }
49: return operations;
50: }
51:
52: }
|