1
2
3
4
5
6
7 package org.mod4j.dsl.service.mm.ServiceDsl.impl;
8
9 import org.eclipse.emf.common.notify.Notification;
10 import org.eclipse.emf.common.notify.NotificationChain;
11
12 import org.eclipse.emf.ecore.EClass;
13 import org.eclipse.emf.ecore.InternalEObject;
14
15 import org.eclipse.emf.ecore.impl.ENotificationImpl;
16
17 import org.eclipse.emf.ecore.util.EcoreUtil;
18
19 import org.mod4j.dsl.service.mm.ServiceDsl.CrudService;
20 import org.mod4j.dsl.service.mm.ServiceDsl.DtoReference;
21 import org.mod4j.dsl.service.mm.ServiceDsl.ServiceDslPackage;
22 import org.mod4j.dsl.service.mm.ServiceDsl.ServiceModel;
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 public class CrudServiceImpl extends ModelElementImpl implements CrudService {
39
40
41
42
43
44
45
46
47 protected DtoReference dto;
48
49
50
51
52
53
54 protected CrudServiceImpl() {
55 super();
56 }
57
58
59
60
61
62
63 @Override
64 protected EClass eStaticClass() {
65 return ServiceDslPackage.Literals.CRUD_SERVICE;
66 }
67
68
69
70
71
72
73 public DtoReference getDto() {
74 if (dto != null && dto.eIsProxy()) {
75 InternalEObject oldDto = (InternalEObject)dto;
76 dto = (DtoReference)eResolveProxy(oldDto);
77 if (dto != oldDto) {
78 if (eNotificationRequired())
79 eNotify(new ENotificationImpl(this, Notification.RESOLVE, ServiceDslPackage.CRUD_SERVICE__DTO, oldDto, dto));
80 }
81 }
82 return dto;
83 }
84
85
86
87
88
89
90 public DtoReference basicGetDto() {
91 return dto;
92 }
93
94
95
96
97
98
99 public void setDto(DtoReference newDto) {
100 DtoReference oldDto = dto;
101 dto = newDto;
102 if (eNotificationRequired())
103 eNotify(new ENotificationImpl(this, Notification.SET, ServiceDslPackage.CRUD_SERVICE__DTO, oldDto, dto));
104 }
105
106
107
108
109
110
111 public ServiceModel getModel() {
112 if (eContainerFeatureID() != ServiceDslPackage.CRUD_SERVICE__MODEL) return null;
113 return (ServiceModel)eContainer();
114 }
115
116
117
118
119
120
121 public NotificationChain basicSetModel(ServiceModel newModel, NotificationChain msgs) {
122 msgs = eBasicSetContainer((InternalEObject)newModel, ServiceDslPackage.CRUD_SERVICE__MODEL, msgs);
123 return msgs;
124 }
125
126
127
128
129
130
131 public void setModel(ServiceModel newModel) {
132 if (newModel != eInternalContainer() || (eContainerFeatureID() != ServiceDslPackage.CRUD_SERVICE__MODEL && newModel != null)) {
133 if (EcoreUtil.isAncestor(this, newModel))
134 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
135 NotificationChain msgs = null;
136 if (eInternalContainer() != null)
137 msgs = eBasicRemoveFromContainer(msgs);
138 if (newModel != null)
139 msgs = ((InternalEObject)newModel).eInverseAdd(this, ServiceDslPackage.SERVICE_MODEL__CRUD_SERVICES, ServiceModel.class, msgs);
140 msgs = basicSetModel(newModel, msgs);
141 if (msgs != null) msgs.dispatch();
142 }
143 else if (eNotificationRequired())
144 eNotify(new ENotificationImpl(this, Notification.SET, ServiceDslPackage.CRUD_SERVICE__MODEL, newModel, newModel));
145 }
146
147
148
149
150
151
152 @Override
153 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
154 switch (featureID) {
155 case ServiceDslPackage.CRUD_SERVICE__MODEL:
156 if (eInternalContainer() != null)
157 msgs = eBasicRemoveFromContainer(msgs);
158 return basicSetModel((ServiceModel)otherEnd, msgs);
159 }
160 return super.eInverseAdd(otherEnd, featureID, msgs);
161 }
162
163
164
165
166
167
168 @Override
169 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
170 switch (featureID) {
171 case ServiceDslPackage.CRUD_SERVICE__MODEL:
172 return basicSetModel(null, msgs);
173 }
174 return super.eInverseRemove(otherEnd, featureID, msgs);
175 }
176
177
178
179
180
181
182 @Override
183 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
184 switch (eContainerFeatureID()) {
185 case ServiceDslPackage.CRUD_SERVICE__MODEL:
186 return eInternalContainer().eInverseRemove(this, ServiceDslPackage.SERVICE_MODEL__CRUD_SERVICES, ServiceModel.class, msgs);
187 }
188 return super.eBasicRemoveFromContainerFeature(msgs);
189 }
190
191
192
193
194
195
196 @Override
197 public Object eGet(int featureID, boolean resolve, boolean coreType) {
198 switch (featureID) {
199 case ServiceDslPackage.CRUD_SERVICE__DTO:
200 if (resolve) return getDto();
201 return basicGetDto();
202 case ServiceDslPackage.CRUD_SERVICE__MODEL:
203 return getModel();
204 }
205 return super.eGet(featureID, resolve, coreType);
206 }
207
208
209
210
211
212
213 @Override
214 public void eSet(int featureID, Object newValue) {
215 switch (featureID) {
216 case ServiceDslPackage.CRUD_SERVICE__DTO:
217 setDto((DtoReference)newValue);
218 return;
219 case ServiceDslPackage.CRUD_SERVICE__MODEL:
220 setModel((ServiceModel)newValue);
221 return;
222 }
223 super.eSet(featureID, newValue);
224 }
225
226
227
228
229
230
231 @Override
232 public void eUnset(int featureID) {
233 switch (featureID) {
234 case ServiceDslPackage.CRUD_SERVICE__DTO:
235 setDto((DtoReference)null);
236 return;
237 case ServiceDslPackage.CRUD_SERVICE__MODEL:
238 setModel((ServiceModel)null);
239 return;
240 }
241 super.eUnset(featureID);
242 }
243
244
245
246
247
248
249 @Override
250 public boolean eIsSet(int featureID) {
251 switch (featureID) {
252 case ServiceDslPackage.CRUD_SERVICE__DTO:
253 return dto != null;
254 case ServiceDslPackage.CRUD_SERVICE__MODEL:
255 return getModel() != null;
256 }
257 return super.eIsSet(featureID);
258 }
259
260 }