1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.repository.impl; |
7 | |
8 | import java.util.Collection; |
9 | import java.util.Map; |
10 | |
11 | import org.eclipse.emf.common.notify.Notification; |
12 | import org.eclipse.emf.common.notify.NotificationChain; |
13 | import org.eclipse.emf.common.util.BasicDiagnostic; |
14 | import org.eclipse.emf.common.util.Diagnostic; |
15 | import org.eclipse.emf.common.util.DiagnosticChain; |
16 | import org.eclipse.emf.common.util.EList; |
17 | import org.eclipse.emf.ecore.EClass; |
18 | import org.eclipse.emf.ecore.InternalEObject; |
19 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
20 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
21 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
22 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
23 | import org.eclipse.emf.ecore.util.EObjectValidator; |
24 | import org.eclipse.emf.ecore.util.EcoreUtil; |
25 | import org.eclipse.emf.ecore.util.InternalEList; |
26 | import org.eclipse.ocl.ParserException; |
27 | import org.eclipse.ocl.ecore.Constraint; |
28 | import org.eclipse.ocl.ecore.OCL; |
29 | |
30 | import de.uka.ipd.sdq.pcm.core.entity.impl.ComposedProvidingRequiringEntityImpl; |
31 | import de.uka.ipd.sdq.pcm.parameter.VariableUsage; |
32 | import de.uka.ipd.sdq.pcm.repository.CompleteComponentType; |
33 | import de.uka.ipd.sdq.pcm.repository.ComponentType; |
34 | import de.uka.ipd.sdq.pcm.repository.CompositeComponent; |
35 | import de.uka.ipd.sdq.pcm.repository.ImplementationComponentType; |
36 | import de.uka.ipd.sdq.pcm.repository.Repository; |
37 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
38 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
39 | import de.uka.ipd.sdq.pcm.repository.util.RepositoryValidator; |
40 | |
41 | /** |
42 | * <!-- begin-user-doc --> |
43 | * An implementation of the model object '<em><b>Composite Component</b></em>'. |
44 | * <!-- end-user-doc --> |
45 | * <p> |
46 | * The following features are implemented: |
47 | * <ul> |
48 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.CompositeComponentImpl#getRepository__RepositoryComponent <em>Repository Repository Component</em>}</li> |
49 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.CompositeComponentImpl#getParentCompleteComponentTypes <em>Parent Complete Component Types</em>}</li> |
50 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.CompositeComponentImpl#getComponentParameterUsage_ImplementationComponentType <em>Component Parameter Usage Implementation Component Type</em>}</li> |
51 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.CompositeComponentImpl#getComponentType <em>Component Type</em>}</li> |
52 | * </ul> |
53 | * </p> |
54 | * |
55 | * @generated |
56 | */ |
57 | public class CompositeComponentImpl extends ComposedProvidingRequiringEntityImpl implements CompositeComponent { |
58 | /** |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
64 | |
65 | /** |
66 | * The cached value of the '{@link #getParentCompleteComponentTypes() <em>Parent Complete Component Types</em>}' reference list. |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @see #getParentCompleteComponentTypes() |
70 | * @generated |
71 | * @ordered |
72 | */ |
73 | protected EList<CompleteComponentType> parentCompleteComponentTypes; |
74 | |
75 | /** |
76 | * The cached value of the '{@link #getComponentParameterUsage_ImplementationComponentType() <em>Component Parameter Usage Implementation Component Type</em>}' containment reference list. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @see #getComponentParameterUsage_ImplementationComponentType() |
80 | * @generated |
81 | * @ordered |
82 | */ |
83 | protected EList<VariableUsage> componentParameterUsage_ImplementationComponentType; |
84 | |
85 | /** |
86 | * The default value of the '{@link #getComponentType() <em>Component Type</em>}' attribute. |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @see #getComponentType() |
90 | * @generated |
91 | * @ordered |
92 | */ |
93 | protected static final ComponentType COMPONENT_TYPE_EDEFAULT = ComponentType.BUSINESS_COMPONENT; |
94 | |
95 | /** |
96 | * The cached value of the '{@link #getComponentType() <em>Component Type</em>}' attribute. |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @see #getComponentType() |
100 | * @generated |
101 | * @ordered |
102 | */ |
103 | protected ComponentType componentType = COMPONENT_TYPE_EDEFAULT; |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | protected CompositeComponentImpl() { |
111 | super(); |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | @Override |
120 | protected EClass eStaticClass() { |
121 | return RepositoryPackage.Literals.COMPOSITE_COMPONENT; |
122 | } |
123 | |
124 | /** |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | public Repository getRepository__RepositoryComponent() { |
130 | if (eContainerFeatureID() != RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT) return null; |
131 | return (Repository)eContainer(); |
132 | } |
133 | |
134 | /** |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | public NotificationChain basicSetRepository__RepositoryComponent(Repository newRepository__RepositoryComponent, NotificationChain msgs) { |
140 | msgs = eBasicSetContainer((InternalEObject)newRepository__RepositoryComponent, RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT, msgs); |
141 | return msgs; |
142 | } |
143 | |
144 | /** |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | public void setRepository__RepositoryComponent(Repository newRepository__RepositoryComponent) { |
150 | if (newRepository__RepositoryComponent != eInternalContainer() || (eContainerFeatureID() != RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT && newRepository__RepositoryComponent != null)) { |
151 | if (EcoreUtil.isAncestor(this, newRepository__RepositoryComponent)) |
152 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
153 | NotificationChain msgs = null; |
154 | if (eInternalContainer() != null) |
155 | msgs = eBasicRemoveFromContainer(msgs); |
156 | if (newRepository__RepositoryComponent != null) |
157 | msgs = ((InternalEObject)newRepository__RepositoryComponent).eInverseAdd(this, RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY, Repository.class, msgs); |
158 | msgs = basicSetRepository__RepositoryComponent(newRepository__RepositoryComponent, msgs); |
159 | if (msgs != null) msgs.dispatch(); |
160 | } |
161 | else if (eNotificationRequired()) |
162 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT, newRepository__RepositoryComponent, newRepository__RepositoryComponent)); |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | public EList<CompleteComponentType> getParentCompleteComponentTypes() { |
171 | if (parentCompleteComponentTypes == null) { |
172 | parentCompleteComponentTypes = new EObjectResolvingEList<CompleteComponentType>(CompleteComponentType.class, this, RepositoryPackage.COMPOSITE_COMPONENT__PARENT_COMPLETE_COMPONENT_TYPES); |
173 | } |
174 | return parentCompleteComponentTypes; |
175 | } |
176 | |
177 | /** |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | public EList<VariableUsage> getComponentParameterUsage_ImplementationComponentType() { |
183 | if (componentParameterUsage_ImplementationComponentType == null) { |
184 | componentParameterUsage_ImplementationComponentType = new EObjectContainmentEList<VariableUsage>(VariableUsage.class, this, RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE); |
185 | } |
186 | return componentParameterUsage_ImplementationComponentType; |
187 | } |
188 | |
189 | /** |
190 | * <!-- begin-user-doc --> |
191 | * <!-- end-user-doc --> |
192 | * @generated |
193 | */ |
194 | public ComponentType getComponentType() { |
195 | return componentType; |
196 | } |
197 | |
198 | /** |
199 | * <!-- begin-user-doc --> |
200 | * <!-- end-user-doc --> |
201 | * @generated |
202 | */ |
203 | public void setComponentType(ComponentType newComponentType) { |
204 | ComponentType oldComponentType = componentType; |
205 | componentType = newComponentType == null ? COMPONENT_TYPE_EDEFAULT : newComponentType; |
206 | if (eNotificationRequired()) |
207 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_TYPE, oldComponentType, componentType)); |
208 | } |
209 | |
210 | /** |
211 | * The cached OCL expression body for the '{@link #RequiredInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Required Interfaces Have To Conform To Complete Type</em>}' operation. |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @see #RequiredInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
215 | * @generated |
216 | * @ordered |
217 | */ |
218 | protected static final String REQUIRED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "-- ImplementationTypes required Interfaces have to be a subset\n"+"-- of CompleteComponentType required Interfaces #\n"+"--\n"+"-- ACCx are used to accumulate Sets/Bags; usually only the very inner ACCx is used at all.\n"+"--\n"+"-- Recursive Query for parent Interface IDs\n"+"-- see 'lpar2005.pdf' (Second-order principles in specification languages for Object-Oriented Programs; Beckert, Tretelman) pp. 11 #\n"+"--let parentInterfaces : Bag(Interface) =\n"+"-- self.parentCompleteComponentTypes->iterate(pt : CompleteComponentType; acc1 : Bag(Interface) = Bag{} |\n"+"-- acc1->union(pt.requiredRoles->iterate(r : RequiredRole; acc2 : Bag(Interface) = Bag{} |\n"+"-- acc2->union(r.requiredInterface.parentInterface->asBag()) -- asBag required to allow Set operations #\n"+"-- ))\n"+"-- ) in\n"+"--let anchestorInterfaces : Bag(Interface) =\n"+"-- self.parentCompleteComponentTypes->iterate(pt : CompleteComponentType; acc3 : Bag(Interface) = Bag{} |\n"+"-- acc3->union(pt.requiredRoles->iterate(r : RequiredRole; acc4 : Bag(Interface) = Bag{} |\n"+"-- acc4->union(r.requiredInterface.parentInterface->asBag()) -- asBag required to allow Set operations #\n"+"-- ))\n"+"-- )->union( -- union with anchestors found in former recursion #\n"+"-- self.parentCompleteComponentTypes->iterate(pt : CompleteComponentType; acc5 : Bag(Interface) = Bag{} |\n"+"-- acc5->union(pt.requiredRoles->iterate(r : RequiredRole; acc6 : Bag(Interface) = Bag{} |\n"+"-- acc6->union(r.requiredInterface.parentInterface.anchestorInterfaces) --already Set/Bag\n"+"-- ))\n"+"-- )\n"+"-- ) in\n"+"-- Directly required interfaces need to be a subset of required anchestorInterfaces of Supertype #\n"+"--anchestorInterfaces.identifier.id->includesAll(\n"+"-- self.requiredRoles->iterate(p : RequiredRole; acc7 : Bag(String) = Bag{} |\n"+"-- acc7->union(p.requiredInterface.identifier.id->asBag())\n"+"-- ) \n"+"--)\n"+"true"; |
219 | |
220 | /** |
221 | * The cached OCL invariant for the '{@link #RequiredInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Required Interfaces Have To Conform To Complete Type</em>}' invariant operation. |
222 | * <!-- begin-user-doc --> |
223 | * <!-- end-user-doc --> |
224 | * @see #RequiredInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
225 | * @generated |
226 | * @ordered |
227 | */ |
228 | protected static Constraint REQUIRED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
229 | |
230 | /** |
231 | * <!-- begin-user-doc --> |
232 | * <!-- end-user-doc --> |
233 | * @generated |
234 | */ |
235 | public boolean RequiredInterfacesHaveToConformToCompleteType(DiagnosticChain diagnostics, Map<Object, Object> context) { |
236 | if (REQUIRED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
237 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
238 | helper.setContext(RepositoryPackage.Literals.IMPLEMENTATION_COMPONENT_TYPE); |
239 | try { |
240 | REQUIRED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(REQUIRED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
241 | } |
242 | catch (ParserException pe) { |
243 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
244 | } |
245 | } |
246 | if (!EOCL_ENV.createQuery(REQUIRED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
247 | if (diagnostics != null) { |
248 | diagnostics.add |
249 | (new BasicDiagnostic |
250 | (Diagnostic.ERROR, |
251 | RepositoryValidator.DIAGNOSTIC_SOURCE, |
252 | RepositoryValidator.IMPLEMENTATION_COMPONENT_TYPE__REQUIRED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE, |
253 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "RequiredInterfacesHaveToConformToCompleteType", EObjectValidator.getObjectLabel(this, context) }), |
254 | new Object [] { this })); |
255 | } |
256 | return false; |
257 | } |
258 | return true; |
259 | } |
260 | |
261 | /** |
262 | * The cached OCL expression body for the '{@link #providedInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Provided Interfaces Have To Conform To Complete Type</em>}' operation. |
263 | * <!-- begin-user-doc --> |
264 | * <!-- end-user-doc --> |
265 | * @see #providedInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
266 | * @generated |
267 | * @ordered |
268 | */ |
269 | protected static final String PROVIDED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "-- ### EXACT COPY FROM ABOVE ###\n"+"-- ImplementationComponentTypes provided Interfaces have to be a superset\n"+"-- of CompleteComponentType provided Interfaces #\n"+"--\n"+"-- ACCx are used to accumulate Sets/Bags; usually only the very inner ACCx is used at all.\n"+"--\n"+"-- Recursive Query for parent Interface IDs\n"+"-- see 'lpar2005.pdf' (Second-order principles in specification languages for Object-Oriented Programs; Beckert, Tretelman) pp. 11 #\n"+"--let parentInterfaces : Bag(Interface) =\n"+"-- self.providedRoles->iterate(r : ProvidedRole; acc2 : Bag(Interface) = Bag{} |\n"+"-- acc2->union(r.providedInterface.parentInterface->asBag()) -- asBag required to allow Set operations #\n"+"-- ) in\n"+"--let anchestorInterfaces : Bag(Interface) =\n"+"-- self.providedRoles->iterate(r : ProvidedRole; acc4 : Bag(Interface) = Bag{} |\n"+"-- acc4->union(r.providedInterface.parentInterface->asBag()) -- asBag required to allow Set operations #\n"+"-- )->union( -- union with anchestors found in former recursion #\n"+"-- self.providedRoles->iterate(r : ProvidedRole; acc6 : Bag(Interface) = Bag{} |\n"+"-- acc6->union(r.providedInterface.parentInterface.anchestorInterfaces) --already Set/Bag\n"+"-- )\n"+"-- ) in\n"+" -- Directly provided anchestorInterfaces need to be a superset of provided interfaces of Supertype #\n"+"-- anchestorInterfaces.identifier.id->includesAll(\n"+"-- self.parentProvidesComponentTypes->iterate(pt : ProvidesComponentType; acc1 : Bag(String) = Bag{} |\n"+"-- pt.providedRoles->iterate(r : ProvidedRole; acc2 : Bag(String) = Bag{} |\n"+"-- acc2->union(r.providedInterface.identifier.id->asBag()) -- asBag required to allow Set operations #\n"+"-- )\n"+"-- )\n"+"-- )\n"+"true"; |
270 | |
271 | /** |
272 | * The cached OCL invariant for the '{@link #providedInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Provided Interfaces Have To Conform To Complete Type</em>}' invariant operation. |
273 | * <!-- begin-user-doc --> |
274 | * <!-- end-user-doc --> |
275 | * @see #providedInterfacesHaveToConformToCompleteType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
276 | * @generated |
277 | * @ordered |
278 | */ |
279 | protected static Constraint PROVIDED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
280 | |
281 | /** |
282 | * <!-- begin-user-doc --> |
283 | * <!-- end-user-doc --> |
284 | * @generated |
285 | */ |
286 | public boolean providedInterfacesHaveToConformToCompleteType(DiagnosticChain diagnostics, Map<Object, Object> context) { |
287 | if (PROVIDED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
288 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
289 | helper.setContext(RepositoryPackage.Literals.IMPLEMENTATION_COMPONENT_TYPE); |
290 | try { |
291 | PROVIDED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(PROVIDED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
292 | } |
293 | catch (ParserException pe) { |
294 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
295 | } |
296 | } |
297 | if (!EOCL_ENV.createQuery(PROVIDED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
298 | if (diagnostics != null) { |
299 | diagnostics.add |
300 | (new BasicDiagnostic |
301 | (Diagnostic.ERROR, |
302 | RepositoryValidator.DIAGNOSTIC_SOURCE, |
303 | RepositoryValidator.IMPLEMENTATION_COMPONENT_TYPE__PROVIDED_INTERFACES_HAVE_TO_CONFORM_TO_COMPLETE_TYPE, |
304 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "providedInterfacesHaveToConformToCompleteType", EObjectValidator.getObjectLabel(this, context) }), |
305 | new Object [] { this })); |
306 | } |
307 | return false; |
308 | } |
309 | return true; |
310 | } |
311 | |
312 | /** |
313 | * The cached OCL expression body for the '{@link #ProvidedInterfaceHaveToConformToComponentType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Provided Interface Have To Conform To Component Type</em>}' operation. |
314 | * <!-- begin-user-doc --> |
315 | * <!-- end-user-doc --> |
316 | * @see #ProvidedInterfaceHaveToConformToComponentType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
317 | * @generated |
318 | * @ordered |
319 | */ |
320 | protected static final String PROVIDED_INTERFACE_HAVE_TO_CONFORM_TO_COMPONENT_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "if self.componentType = ComponentType::INFRASTRUCTURE_COMPONENT then\n"+" self.providedRoles_InterfaceProvidingEntity->select(role | role.oclIsTypeOf(OperationInterface) or role.oclIsTypeOf(EventGroup))->size() = 0\n"+"else if self.componentType = ComponentType::BUSINESS_COMPONENT then\n"+" self.providedRoles_InterfaceProvidingEntity->select(role | role.oclIsTypeOf(InfrastructureInterface))->size() = 0\n"+"else\n"+" 1 = 0\n"+"endif\n"+"endif"; |
321 | |
322 | /** |
323 | * The cached OCL invariant for the '{@link #ProvidedInterfaceHaveToConformToComponentType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Provided Interface Have To Conform To Component Type</em>}' invariant operation. |
324 | * <!-- begin-user-doc --> |
325 | * <!-- end-user-doc --> |
326 | * @see #ProvidedInterfaceHaveToConformToComponentType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
327 | * @generated |
328 | * @ordered |
329 | */ |
330 | protected static Constraint PROVIDED_INTERFACE_HAVE_TO_CONFORM_TO_COMPONENT_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
331 | |
332 | /** |
333 | * <!-- begin-user-doc --> |
334 | * <!-- end-user-doc --> |
335 | * @generated |
336 | */ |
337 | public boolean ProvidedInterfaceHaveToConformToComponentType(DiagnosticChain diagnostics, Map<Object, Object> context) { |
338 | if (PROVIDED_INTERFACE_HAVE_TO_CONFORM_TO_COMPONENT_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
339 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
340 | helper.setContext(RepositoryPackage.Literals.IMPLEMENTATION_COMPONENT_TYPE); |
341 | try { |
342 | PROVIDED_INTERFACE_HAVE_TO_CONFORM_TO_COMPONENT_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(PROVIDED_INTERFACE_HAVE_TO_CONFORM_TO_COMPONENT_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
343 | } |
344 | catch (ParserException pe) { |
345 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
346 | } |
347 | } |
348 | if (!EOCL_ENV.createQuery(PROVIDED_INTERFACE_HAVE_TO_CONFORM_TO_COMPONENT_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
349 | if (diagnostics != null) { |
350 | diagnostics.add |
351 | (new BasicDiagnostic |
352 | (Diagnostic.ERROR, |
353 | RepositoryValidator.DIAGNOSTIC_SOURCE, |
354 | RepositoryValidator.IMPLEMENTATION_COMPONENT_TYPE__PROVIDED_INTERFACE_HAVE_TO_CONFORM_TO_COMPONENT_TYPE, |
355 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ProvidedInterfaceHaveToConformToComponentType", EObjectValidator.getObjectLabel(this, context) }), |
356 | new Object [] { this })); |
357 | } |
358 | return false; |
359 | } |
360 | return true; |
361 | } |
362 | |
363 | /** |
364 | * The cached OCL expression body for the '{@link #ProvideSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Provide Same Interfaces</em>}' operation. |
365 | * <!-- begin-user-doc --> |
366 | * <!-- end-user-doc --> |
367 | * @see #ProvideSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
368 | * @generated |
369 | * @ordered |
370 | */ |
371 | protected static final String PROVIDE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "-- CC has to provide the same interfaces like the implementationComponentType (if set) (same OCL code like BC)#\n"+"if\n"+" -- apply constraint only for non-empty ImplementationComponentTypes of a BC #\n"+" self.parentCompleteComponentTypes->notEmpty()\n"+"then\n"+" --own interface IDs:\n"+" self.providedRoles_InterfaceProvidingEntity->select(pr|pr.oclIsTypeOf(OperationProvidedRole))->collect(pr : ProvidedRole | pr.oclAsType (OperationProvidedRole).providedInterface__OperationProvidedRole.id)->asSet()\n"+" =\n"+" --complete type interface IDs:\n"+" self.parentCompleteComponentTypes.providedRoles_InterfaceProvidingEntity->select(pr|pr.oclIsTypeOf(OperationProvidedRole))->collect(pr : ProvidedRole | pr.oclAsType (OperationProvidedRole).providedInterface__OperationProvidedRole.id)->asSet()\n"+"else\n"+" true\n"+"endif"; |
372 | |
373 | /** |
374 | * The cached OCL invariant for the '{@link #ProvideSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Provide Same Interfaces</em>}' invariant operation. |
375 | * <!-- begin-user-doc --> |
376 | * <!-- end-user-doc --> |
377 | * @see #ProvideSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
378 | * @generated |
379 | * @ordered |
380 | */ |
381 | protected static Constraint PROVIDE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
382 | |
383 | /** |
384 | * <!-- begin-user-doc --> |
385 | * <!-- end-user-doc --> |
386 | * @generated |
387 | */ |
388 | public boolean ProvideSameInterfaces(DiagnosticChain diagnostics, Map<Object, Object> context) { |
389 | if (PROVIDE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
390 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
391 | helper.setContext(RepositoryPackage.Literals.COMPOSITE_COMPONENT); |
392 | try { |
393 | PROVIDE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(PROVIDE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
394 | } |
395 | catch (ParserException pe) { |
396 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
397 | } |
398 | } |
399 | if (!EOCL_ENV.createQuery(PROVIDE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
400 | if (diagnostics != null) { |
401 | diagnostics.add |
402 | (new BasicDiagnostic |
403 | (Diagnostic.ERROR, |
404 | RepositoryValidator.DIAGNOSTIC_SOURCE, |
405 | RepositoryValidator.COMPOSITE_COMPONENT__PROVIDE_SAME_INTERFACES, |
406 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ProvideSameInterfaces", EObjectValidator.getObjectLabel(this, context) }), |
407 | new Object [] { this })); |
408 | } |
409 | return false; |
410 | } |
411 | return true; |
412 | } |
413 | |
414 | /** |
415 | * The cached OCL expression body for the '{@link #RequireSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Require Same Interfaces</em>}' operation. |
416 | * <!-- begin-user-doc --> |
417 | * <!-- end-user-doc --> |
418 | * @see #RequireSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
419 | * @generated |
420 | * @ordered |
421 | */ |
422 | protected static final String REQUIRE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "-- CC has to require the same interfaces like the implementationComponentType (if set) (same OCL code like BC) #\n"+"if\n"+" -- apply constraint only for non-empty ImplementationComponentTypes of a BC #\n"+" self.parentCompleteComponentTypes->notEmpty()\n"+"then\n"+" --own interface IDs:\n"+" self.requiredRoles_InterfaceRequiringEntity->select(pr|pr.oclIsTypeOf(OperationRequiredRole))->collect(rr : RequiredRole | rr.oclAsType (OperationRequiredRole).requiredInterface__OperationRequiredRole.id)->asSet()\n"+" =\n"+" --complete type interface IDs:\n"+" self.parentCompleteComponentTypes.requiredRoles_InterfaceRequiringEntity->select(pr|pr.oclIsTypeOf(OperationRequiredRole))->collect(rr : RequiredRole | rr.oclAsType (OperationRequiredRole).requiredInterface__OperationRequiredRole.id)->asSet()\n"+"else\n"+" true\n"+"endif"; |
423 | |
424 | /** |
425 | * The cached OCL invariant for the '{@link #RequireSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Require Same Interfaces</em>}' invariant operation. |
426 | * <!-- begin-user-doc --> |
427 | * <!-- end-user-doc --> |
428 | * @see #RequireSameInterfaces(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
429 | * @generated |
430 | * @ordered |
431 | */ |
432 | protected static Constraint REQUIRE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
433 | |
434 | /** |
435 | * <!-- begin-user-doc --> |
436 | * <!-- end-user-doc --> |
437 | * @generated |
438 | */ |
439 | public boolean RequireSameInterfaces(DiagnosticChain diagnostics, Map<Object, Object> context) { |
440 | if (REQUIRE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
441 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
442 | helper.setContext(RepositoryPackage.Literals.COMPOSITE_COMPONENT); |
443 | try { |
444 | REQUIRE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(REQUIRE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
445 | } |
446 | catch (ParserException pe) { |
447 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
448 | } |
449 | } |
450 | if (!EOCL_ENV.createQuery(REQUIRE_SAME_INTERFACES__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
451 | if (diagnostics != null) { |
452 | diagnostics.add |
453 | (new BasicDiagnostic |
454 | (Diagnostic.ERROR, |
455 | RepositoryValidator.DIAGNOSTIC_SOURCE, |
456 | RepositoryValidator.COMPOSITE_COMPONENT__REQUIRE_SAME_INTERFACES, |
457 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "RequireSameInterfaces", EObjectValidator.getObjectLabel(this, context) }), |
458 | new Object [] { this })); |
459 | } |
460 | return false; |
461 | } |
462 | return true; |
463 | } |
464 | |
465 | /** |
466 | * <!-- begin-user-doc --> |
467 | * <!-- end-user-doc --> |
468 | * @generated |
469 | */ |
470 | @Override |
471 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
472 | switch (featureID) { |
473 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: |
474 | if (eInternalContainer() != null) |
475 | msgs = eBasicRemoveFromContainer(msgs); |
476 | return basicSetRepository__RepositoryComponent((Repository)otherEnd, msgs); |
477 | } |
478 | return super.eInverseAdd(otherEnd, featureID, msgs); |
479 | } |
480 | |
481 | /** |
482 | * <!-- begin-user-doc --> |
483 | * <!-- end-user-doc --> |
484 | * @generated |
485 | */ |
486 | @Override |
487 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
488 | switch (featureID) { |
489 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: |
490 | return basicSetRepository__RepositoryComponent(null, msgs); |
491 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE: |
492 | return ((InternalEList<?>)getComponentParameterUsage_ImplementationComponentType()).basicRemove(otherEnd, msgs); |
493 | } |
494 | return super.eInverseRemove(otherEnd, featureID, msgs); |
495 | } |
496 | |
497 | /** |
498 | * <!-- begin-user-doc --> |
499 | * <!-- end-user-doc --> |
500 | * @generated |
501 | */ |
502 | @Override |
503 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
504 | switch (eContainerFeatureID()) { |
505 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: |
506 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.REPOSITORY__COMPONENTS_REPOSITORY, Repository.class, msgs); |
507 | } |
508 | return super.eBasicRemoveFromContainerFeature(msgs); |
509 | } |
510 | |
511 | /** |
512 | * <!-- begin-user-doc --> |
513 | * <!-- end-user-doc --> |
514 | * @generated |
515 | */ |
516 | @Override |
517 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
518 | switch (featureID) { |
519 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: |
520 | return getRepository__RepositoryComponent(); |
521 | case RepositoryPackage.COMPOSITE_COMPONENT__PARENT_COMPLETE_COMPONENT_TYPES: |
522 | return getParentCompleteComponentTypes(); |
523 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE: |
524 | return getComponentParameterUsage_ImplementationComponentType(); |
525 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_TYPE: |
526 | return getComponentType(); |
527 | } |
528 | return super.eGet(featureID, resolve, coreType); |
529 | } |
530 | |
531 | /** |
532 | * <!-- begin-user-doc --> |
533 | * <!-- end-user-doc --> |
534 | * @generated |
535 | */ |
536 | @SuppressWarnings("unchecked") |
537 | @Override |
538 | public void eSet(int featureID, Object newValue) { |
539 | switch (featureID) { |
540 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: |
541 | setRepository__RepositoryComponent((Repository)newValue); |
542 | return; |
543 | case RepositoryPackage.COMPOSITE_COMPONENT__PARENT_COMPLETE_COMPONENT_TYPES: |
544 | getParentCompleteComponentTypes().clear(); |
545 | getParentCompleteComponentTypes().addAll((Collection<? extends CompleteComponentType>)newValue); |
546 | return; |
547 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE: |
548 | getComponentParameterUsage_ImplementationComponentType().clear(); |
549 | getComponentParameterUsage_ImplementationComponentType().addAll((Collection<? extends VariableUsage>)newValue); |
550 | return; |
551 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_TYPE: |
552 | setComponentType((ComponentType)newValue); |
553 | return; |
554 | } |
555 | super.eSet(featureID, newValue); |
556 | } |
557 | |
558 | /** |
559 | * <!-- begin-user-doc --> |
560 | * <!-- end-user-doc --> |
561 | * @generated |
562 | */ |
563 | @Override |
564 | public void eUnset(int featureID) { |
565 | switch (featureID) { |
566 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: |
567 | setRepository__RepositoryComponent((Repository)null); |
568 | return; |
569 | case RepositoryPackage.COMPOSITE_COMPONENT__PARENT_COMPLETE_COMPONENT_TYPES: |
570 | getParentCompleteComponentTypes().clear(); |
571 | return; |
572 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE: |
573 | getComponentParameterUsage_ImplementationComponentType().clear(); |
574 | return; |
575 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_TYPE: |
576 | setComponentType(COMPONENT_TYPE_EDEFAULT); |
577 | return; |
578 | } |
579 | super.eUnset(featureID); |
580 | } |
581 | |
582 | /** |
583 | * <!-- begin-user-doc --> |
584 | * <!-- end-user-doc --> |
585 | * @generated |
586 | */ |
587 | @Override |
588 | public boolean eIsSet(int featureID) { |
589 | switch (featureID) { |
590 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: |
591 | return getRepository__RepositoryComponent() != null; |
592 | case RepositoryPackage.COMPOSITE_COMPONENT__PARENT_COMPLETE_COMPONENT_TYPES: |
593 | return parentCompleteComponentTypes != null && !parentCompleteComponentTypes.isEmpty(); |
594 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE: |
595 | return componentParameterUsage_ImplementationComponentType != null && !componentParameterUsage_ImplementationComponentType.isEmpty(); |
596 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_TYPE: |
597 | return componentType != COMPONENT_TYPE_EDEFAULT; |
598 | } |
599 | return super.eIsSet(featureID); |
600 | } |
601 | |
602 | /** |
603 | * <!-- begin-user-doc --> |
604 | * <!-- end-user-doc --> |
605 | * @generated |
606 | */ |
607 | @Override |
608 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
609 | if (baseClass == RepositoryComponent.class) { |
610 | switch (derivedFeatureID) { |
611 | case RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: return RepositoryPackage.REPOSITORY_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT; |
612 | default: return -1; |
613 | } |
614 | } |
615 | if (baseClass == ImplementationComponentType.class) { |
616 | switch (derivedFeatureID) { |
617 | case RepositoryPackage.COMPOSITE_COMPONENT__PARENT_COMPLETE_COMPONENT_TYPES: return RepositoryPackage.IMPLEMENTATION_COMPONENT_TYPE__PARENT_COMPLETE_COMPONENT_TYPES; |
618 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE: return RepositoryPackage.IMPLEMENTATION_COMPONENT_TYPE__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE; |
619 | case RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_TYPE: return RepositoryPackage.IMPLEMENTATION_COMPONENT_TYPE__COMPONENT_TYPE; |
620 | default: return -1; |
621 | } |
622 | } |
623 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
624 | } |
625 | |
626 | /** |
627 | * <!-- begin-user-doc --> |
628 | * <!-- end-user-doc --> |
629 | * @generated |
630 | */ |
631 | @Override |
632 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
633 | if (baseClass == RepositoryComponent.class) { |
634 | switch (baseFeatureID) { |
635 | case RepositoryPackage.REPOSITORY_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT: return RepositoryPackage.COMPOSITE_COMPONENT__REPOSITORY_REPOSITORY_COMPONENT; |
636 | default: return -1; |
637 | } |
638 | } |
639 | if (baseClass == ImplementationComponentType.class) { |
640 | switch (baseFeatureID) { |
641 | case RepositoryPackage.IMPLEMENTATION_COMPONENT_TYPE__PARENT_COMPLETE_COMPONENT_TYPES: return RepositoryPackage.COMPOSITE_COMPONENT__PARENT_COMPLETE_COMPONENT_TYPES; |
642 | case RepositoryPackage.IMPLEMENTATION_COMPONENT_TYPE__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE: return RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_PARAMETER_USAGE_IMPLEMENTATION_COMPONENT_TYPE; |
643 | case RepositoryPackage.IMPLEMENTATION_COMPONENT_TYPE__COMPONENT_TYPE: return RepositoryPackage.COMPOSITE_COMPONENT__COMPONENT_TYPE; |
644 | default: return -1; |
645 | } |
646 | } |
647 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
648 | } |
649 | |
650 | /** |
651 | * <!-- begin-user-doc --> |
652 | * <!-- end-user-doc --> |
653 | * @generated |
654 | */ |
655 | @Override |
656 | public String toString() { |
657 | if (eIsProxy()) return super.toString(); |
658 | |
659 | StringBuffer result = new StringBuffer(super.toString()); |
660 | result.append(" (componentType: "); |
661 | result.append(componentType); |
662 | result.append(')'); |
663 | return result.toString(); |
664 | } |
665 | |
666 | } //CompositeComponentImpl |