1
2
3
4
5 package org.andromda.metafacades.emf.uml22;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.metafacade.MetafacadeBase;
10 import org.andromda.core.metafacade.ModelValidationMessage;
11 import org.andromda.metafacades.uml.CallEventFacade;
12 import org.andromda.metafacades.uml.OperationFacade;
13 import org.apache.log4j.Logger;
14 import org.eclipse.uml2.uml.Activity;
15
16
17
18
19
20
21
22
23 public abstract class CallEventFacadeLogic
24 extends EventFacadeLogicImpl
25 implements CallEventFacade
26 {
27
28
29
30
31 protected Activity metaObject;
32
33
34
35
36
37 protected CallEventFacadeLogic(Activity metaObjectIn, String context)
38 {
39 super(metaObjectIn, getContext(context));
40 this.metaObject = metaObjectIn;
41 }
42
43
44
45
46 private static final Logger logger = Logger.getLogger(CallEventFacadeLogic.class);
47
48
49
50
51
52
53 private static String getContext(String context)
54 {
55 if (context == null)
56 {
57 context = "org.andromda.metafacades.uml.CallEventFacade";
58 }
59 return context;
60 }
61
62
63
64
65 @Override
66 public void resetMetafacadeContext(String context)
67 {
68 if (!this.contextRoot)
69 {
70 context = getContext(context);
71 setMetafacadeContext (context);
72 }
73 }
74
75
76
77
78
79 public boolean isCallEventFacadeMetaType()
80 {
81 return true;
82 }
83
84
85
86
87
88
89
90
91
92 public final OperationFacade getOperation()
93 {
94 OperationFacade getOperation1r = null;
95
96 Object result = handleGetOperation();
97 MetafacadeBase shieldedResult = this.shieldedElement(result);
98 try
99 {
100 getOperation1r = (OperationFacade)shieldedResult;
101 }
102 catch (ClassCastException ex)
103 {
104
105 CallEventFacadeLogic.logger.warn("incorrect metafacade cast for CallEventFacadeLogic.getOperation OperationFacade " + result + ": " + shieldedResult);
106 }
107
108 return getOperation1r;
109 }
110
111
112
113
114
115 protected abstract Object handleGetOperation();
116
117
118
119
120
121
122
123 public final Collection<OperationFacade> getOperations()
124 {
125 Collection<OperationFacade> getOperations2r = null;
126
127 Collection result = handleGetOperations();
128 List shieldedResult = this.shieldedElements(result);
129 try
130 {
131 getOperations2r = (Collection<OperationFacade>)shieldedResult;
132 }
133 catch (ClassCastException ex)
134 {
135
136 CallEventFacadeLogic.logger.warn("incorrect metafacade cast for CallEventFacadeLogic.getOperations Collection<OperationFacade> " + result + ": " + shieldedResult);
137 }
138
139 return getOperations2r;
140 }
141
142
143
144
145
146 protected abstract Collection handleGetOperations();
147
148
149
150
151
152 @Override
153 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
154 {
155 super.validateInvariants(validationMessages);
156 }
157 }