01: package org.andromda.metafacades.emf.uml2;
02:
03: import org.eclipse.uml2.Element;
04: import org.eclipse.uml2.StateMachine;
05: import org.eclipse.uml2.UseCase;
06:
07: /**
08: * MetafacadeLogic implementation for
09: * org.andromda.metafacades.uml.ActivityGraphFacade. It seem strange that
10: * ActivityGraph are mapped with StateMachine. UML 1.4's ActivityGraph are an
11: * extension of State Machine, whereas UML2's Activity is like petri-nets. This
12: * explain this choice.
13: *
14: * @see org.andromda.metafacades.uml.ActivityGraphFacade
15: */
16: public class ActivityGraphFacadeLogicImpl extends
17: ActivityGraphFacadeLogic {
18: public ActivityGraphFacadeLogicImpl(final StateMachine metaObject,
19: final String context) {
20: super (metaObject, context);
21: }
22:
23: /**
24: * @see org.andromda.metafacades.uml.ActivityGraphFacade#getActionStates()
25: */
26: protected java.util.Collection handleGetActionStates() {
27: // There is no action states within uml2's statemachine.
28: // But "simple" states will do the jobs.
29: return this .getStates();
30: }
31:
32: /**
33: * @see org.andromda.metafacades.uml.ActivityGraphFacade#getObjectFlowStates()
34: */
35: protected java.util.Collection handleGetObjectFlowStates() {
36: // TODO: add your implementation here!
37: return null;
38: }
39:
40: /**
41: * @see org.andromda.metafacades.uml.ActivityGraphFacade#getUseCase()
42: */
43: protected java.lang.Object handleGetUseCase() {
44: Element owner = (this .metaObject).getOwner();
45: if (owner instanceof UseCase) {
46: return owner;
47: }
48:
49: return null;
50: }
51:
52: /**
53: * @see org.andromda.metafacades.uml.ActivityGraphFacade#getPartitions()
54: */
55: protected java.util.Collection handleGetPartitions() {
56: // Since we mapped ActivityGraph to StateMachine, dividers are Regions,
57: // not Partitions
58: return (this .metaObject).getRegions();
59: }
60:
61: /**
62: * @see org.andromda.core.metafacade.MetafacadeBase#getValidationOwner()
63: */
64: public Object getValidationOwner() {
65: Object validationOwner = getUseCase();
66:
67: if (validationOwner == null) {
68: validationOwner = getStateMachineContext();
69: }
70: if (validationOwner == null) {
71: validationOwner = getPackage();
72: }
73:
74: return validationOwner;
75: }
76: }
|