01: package org.andromda.metafacades.uml14;
02:
03: import java.lang.reflect.Method;
04: import java.util.Collections;
05: import java.util.List;
06:
07: import org.andromda.metafacades.uml.FrontEndAction;
08: import org.andromda.metafacades.uml.FrontEndForward;
09: import org.andromda.metafacades.uml.TransitionFacade;
10:
11: /**
12: * MetafacadeLogic implementation for org.andromda.metafacades.uml.FrontEndEvent.
13: *
14: * @see org.andromda.metafacades.uml.FrontEndEvent
15: */
16: public class FrontEndEventLogicImpl extends FrontEndEventLogic {
17:
18: public FrontEndEventLogicImpl(Object metaObject, String context) {
19: super (metaObject, context);
20: }
21:
22: /**
23: * @see org.andromda.metafacades.uml.FrontEndEvent#isContainedInFrontEndUseCase()
24: */
25: protected boolean handleIsContainedInFrontEndUseCase() {
26: return this .getTransition() instanceof FrontEndForward;
27: }
28:
29: /**
30: * @see org.andromda.metafacades.uml.FrontEndEvent#getControllerCall()
31: */
32: protected Object handleGetControllerCall() {
33: // - hack until a solution is found to workaround the JMI multiple inheritance (through interfaces)
34: try {
35: final Method method = metaObject.getClass().getMethod(
36: "getOperation", (Class[]) null);
37: return method.invoke(metaObject, (Object[]) null);
38: } catch (Exception ex) {
39: return null;
40: }
41: }
42:
43: /**
44: * @see org.andromda.metafacades.uml.FrontEndEvent#getAction()
45: */
46: protected Object handleGetAction() {
47: FrontEndAction action = null;
48: TransitionFacade transition = getTransition();
49: if (transition instanceof FrontEndAction) {
50: action = (FrontEndAction) transition;
51: }
52: return action;
53: }
54:
55: /**
56: * @see org.andromda.metafacades.uml14.FrontEndEvent#getControllerCalls()
57: */
58: protected List handleGetControllerCalls() {
59: Object controllerCall = this.getControllerCall();
60: return controllerCall == null ? Collections.EMPTY_LIST
61: : Collections.singletonList(controllerCall);
62: }
63:
64: }
|