1
2
3
4
5
6
7 package BusinessDomainDsl.impl;
8
9 import BusinessDomainDsl.AbstractBusinessClass;
10 import BusinessDomainDsl.Association;
11 import BusinessDomainDsl.BusinessClass;
12 import BusinessDomainDsl.BusinessDomainDslPackage;
13 import BusinessDomainDsl.BusinessDomainModel;
14 import BusinessDomainDsl.Multiplicity;
15
16 import org.eclipse.emf.common.notify.Notification;
17 import org.eclipse.emf.common.notify.NotificationChain;
18
19 import org.eclipse.emf.ecore.EClass;
20 import org.eclipse.emf.ecore.InternalEObject;
21
22 import org.eclipse.emf.ecore.impl.ENotificationImpl;
23
24 import org.eclipse.emf.ecore.util.EcoreUtil;
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 public class AssociationImpl extends ModelElementImpl implements Association {
49
50
51
52
53
54
55
56
57 protected BusinessClass source;
58
59
60
61
62
63
64
65
66
67 protected AbstractBusinessClass target;
68
69
70
71
72
73
74
75
76
77 protected static final String SOURCE_ROLE_NAME_EDEFAULT = "sourceRoleName";
78
79
80
81
82
83
84
85
86
87 protected String sourceRoleName = SOURCE_ROLE_NAME_EDEFAULT;
88
89
90
91
92
93
94
95
96
97 protected static final Multiplicity SOURCE_MULTIPLICITY_EDEFAULT = Multiplicity.ONE;
98
99
100
101
102
103
104
105
106
107 protected Multiplicity sourceMultiplicity = SOURCE_MULTIPLICITY_EDEFAULT;
108
109
110
111
112
113
114
115
116
117 protected static final String TARGET_ROLE_NAME_EDEFAULT = "targetRoleName";
118
119
120
121
122
123
124
125
126
127 protected String targetRoleName = TARGET_ROLE_NAME_EDEFAULT;
128
129
130
131
132
133
134
135
136
137 protected static final Multiplicity TARGET_MULTIPLICITY_EDEFAULT = Multiplicity.ZERO_MANY;
138
139
140
141
142
143
144
145
146
147 protected Multiplicity targetMultiplicity = TARGET_MULTIPLICITY_EDEFAULT;
148
149
150
151
152
153
154
155
156
157 protected static final boolean COMPOSITE_EDEFAULT = false;
158
159
160
161
162
163
164
165
166
167 protected boolean composite = COMPOSITE_EDEFAULT;
168
169
170
171
172
173
174
175
176
177 protected static final boolean BIDIRECTIONAL_EDEFAULT = false;
178
179
180
181
182
183
184
185
186
187 protected boolean bidirectional = BIDIRECTIONAL_EDEFAULT;
188
189
190
191
192
193
194
195
196
197 protected static final boolean ORDERED_EDEFAULT = false;
198
199
200
201
202
203
204
205
206
207 protected boolean ordered = ORDERED_EDEFAULT;
208
209
210
211
212
213
214 protected AssociationImpl() {
215 super();
216 }
217
218
219
220
221
222
223 @Override
224 protected EClass eStaticClass() {
225 return BusinessDomainDslPackage.Literals.ASSOCIATION;
226 }
227
228
229
230
231
232
233 public BusinessClass getSource() {
234 if (source != null && source.eIsProxy()) {
235 InternalEObject oldSource = (InternalEObject)source;
236 source = (BusinessClass)eResolveProxy(oldSource);
237 if (source != oldSource) {
238 if (eNotificationRequired())
239 eNotify(new ENotificationImpl(this, Notification.RESOLVE, BusinessDomainDslPackage.ASSOCIATION__SOURCE, oldSource, source));
240 }
241 }
242 return source;
243 }
244
245
246
247
248
249
250 public BusinessClass basicGetSource() {
251 return source;
252 }
253
254
255
256
257
258
259 public NotificationChain basicSetSource(BusinessClass newSource, NotificationChain msgs) {
260 BusinessClass oldSource = source;
261 source = newSource;
262 if (eNotificationRequired()) {
263 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__SOURCE, oldSource, newSource);
264 if (msgs == null) msgs = notification; else msgs.add(notification);
265 }
266 return msgs;
267 }
268
269
270
271
272
273
274 public void setSource(BusinessClass newSource) {
275 if (newSource != source) {
276 NotificationChain msgs = null;
277 if (source != null)
278 msgs = ((InternalEObject)source).eInverseRemove(this, BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO, BusinessClass.class, msgs);
279 if (newSource != null)
280 msgs = ((InternalEObject)newSource).eInverseAdd(this, BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO, BusinessClass.class, msgs);
281 msgs = basicSetSource(newSource, msgs);
282 if (msgs != null) msgs.dispatch();
283 }
284 else if (eNotificationRequired())
285 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__SOURCE, newSource, newSource));
286 }
287
288
289
290
291
292
293 public AbstractBusinessClass getTarget() {
294 if (target != null && target.eIsProxy()) {
295 InternalEObject oldTarget = (InternalEObject)target;
296 target = (AbstractBusinessClass)eResolveProxy(oldTarget);
297 if (target != oldTarget) {
298 if (eNotificationRequired())
299 eNotify(new ENotificationImpl(this, Notification.RESOLVE, BusinessDomainDslPackage.ASSOCIATION__TARGET, oldTarget, target));
300 }
301 }
302 return target;
303 }
304
305
306
307
308
309
310 public AbstractBusinessClass basicGetTarget() {
311 return target;
312 }
313
314
315
316
317
318
319 public NotificationChain basicSetTarget(AbstractBusinessClass newTarget, NotificationChain msgs) {
320 AbstractBusinessClass oldTarget = target;
321 target = newTarget;
322 if (eNotificationRequired()) {
323 ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__TARGET, oldTarget, newTarget);
324 if (msgs == null) msgs = notification; else msgs.add(notification);
325 }
326 return msgs;
327 }
328
329
330
331
332
333
334 public void setTarget(AbstractBusinessClass newTarget) {
335 if (newTarget != target) {
336 NotificationChain msgs = null;
337 if (target != null)
338 msgs = ((InternalEObject)target).eInverseRemove(this, BusinessDomainDslPackage.ABSTRACT_BUSINESS_CLASS__ASSOCIATIONS_FROM, AbstractBusinessClass.class, msgs);
339 if (newTarget != null)
340 msgs = ((InternalEObject)newTarget).eInverseAdd(this, BusinessDomainDslPackage.ABSTRACT_BUSINESS_CLASS__ASSOCIATIONS_FROM, AbstractBusinessClass.class, msgs);
341 msgs = basicSetTarget(newTarget, msgs);
342 if (msgs != null) msgs.dispatch();
343 }
344 else if (eNotificationRequired())
345 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__TARGET, newTarget, newTarget));
346 }
347
348
349
350
351
352
353 public String getSourceRoleName() {
354 return sourceRoleName;
355 }
356
357
358
359
360
361
362 public void setSourceRoleName(String newSourceRoleName) {
363 String oldSourceRoleName = sourceRoleName;
364 sourceRoleName = newSourceRoleName;
365 if (eNotificationRequired())
366 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__SOURCE_ROLE_NAME, oldSourceRoleName, sourceRoleName));
367 }
368
369
370
371
372
373
374 public Multiplicity getSourceMultiplicity() {
375 return sourceMultiplicity;
376 }
377
378
379
380
381
382
383 public void setSourceMultiplicity(Multiplicity newSourceMultiplicity) {
384 Multiplicity oldSourceMultiplicity = sourceMultiplicity;
385 sourceMultiplicity = newSourceMultiplicity == null ? SOURCE_MULTIPLICITY_EDEFAULT : newSourceMultiplicity;
386 if (eNotificationRequired())
387 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__SOURCE_MULTIPLICITY, oldSourceMultiplicity, sourceMultiplicity));
388 }
389
390
391
392
393
394
395 public String getTargetRoleName() {
396 return targetRoleName;
397 }
398
399
400
401
402
403
404 public void setTargetRoleName(String newTargetRoleName) {
405 String oldTargetRoleName = targetRoleName;
406 targetRoleName = newTargetRoleName;
407 if (eNotificationRequired())
408 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__TARGET_ROLE_NAME, oldTargetRoleName, targetRoleName));
409 }
410
411
412
413
414
415
416 public Multiplicity getTargetMultiplicity() {
417 return targetMultiplicity;
418 }
419
420
421
422
423
424
425 public void setTargetMultiplicity(Multiplicity newTargetMultiplicity) {
426 Multiplicity oldTargetMultiplicity = targetMultiplicity;
427 targetMultiplicity = newTargetMultiplicity == null ? TARGET_MULTIPLICITY_EDEFAULT : newTargetMultiplicity;
428 if (eNotificationRequired())
429 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__TARGET_MULTIPLICITY, oldTargetMultiplicity, targetMultiplicity));
430 }
431
432
433
434
435
436
437 public boolean isComposite() {
438 return composite;
439 }
440
441
442
443
444
445
446 public void setComposite(boolean newComposite) {
447 boolean oldComposite = composite;
448 composite = newComposite;
449 if (eNotificationRequired())
450 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__COMPOSITE, oldComposite, composite));
451 }
452
453
454
455
456
457
458 public boolean isBidirectional() {
459 return bidirectional;
460 }
461
462
463
464
465
466
467 public void setBidirectional(boolean newBidirectional) {
468 boolean oldBidirectional = bidirectional;
469 bidirectional = newBidirectional;
470 if (eNotificationRequired())
471 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__BIDIRECTIONAL, oldBidirectional, bidirectional));
472 }
473
474
475
476
477
478
479 public boolean isOrdered() {
480 return ordered;
481 }
482
483
484
485
486
487
488 public void setOrdered(boolean newOrdered) {
489 boolean oldOrdered = ordered;
490 ordered = newOrdered;
491 if (eNotificationRequired())
492 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__ORDERED, oldOrdered, ordered));
493 }
494
495
496
497
498
499
500 public BusinessDomainModel getModel() {
501 if (eContainerFeatureID() != BusinessDomainDslPackage.ASSOCIATION__MODEL) return null;
502 return (BusinessDomainModel)eContainer();
503 }
504
505
506
507
508
509
510 public NotificationChain basicSetModel(BusinessDomainModel newModel, NotificationChain msgs) {
511 msgs = eBasicSetContainer((InternalEObject)newModel, BusinessDomainDslPackage.ASSOCIATION__MODEL, msgs);
512 return msgs;
513 }
514
515
516
517
518
519
520 public void setModel(BusinessDomainModel newModel) {
521 if (newModel != eInternalContainer() || (eContainerFeatureID() != BusinessDomainDslPackage.ASSOCIATION__MODEL && newModel != null)) {
522 if (EcoreUtil.isAncestor(this, newModel))
523 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
524 NotificationChain msgs = null;
525 if (eInternalContainer() != null)
526 msgs = eBasicRemoveFromContainer(msgs);
527 if (newModel != null)
528 msgs = ((InternalEObject)newModel).eInverseAdd(this, BusinessDomainDslPackage.BUSINESS_DOMAIN_MODEL__ASSOCIATIONS, BusinessDomainModel.class, msgs);
529 msgs = basicSetModel(newModel, msgs);
530 if (msgs != null) msgs.dispatch();
531 }
532 else if (eNotificationRequired())
533 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ASSOCIATION__MODEL, newModel, newModel));
534 }
535
536
537
538
539
540
541 @Override
542 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
543 switch (featureID) {
544 case BusinessDomainDslPackage.ASSOCIATION__SOURCE:
545 if (source != null)
546 msgs = ((InternalEObject)source).eInverseRemove(this, BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO, BusinessClass.class, msgs);
547 return basicSetSource((BusinessClass)otherEnd, msgs);
548 case BusinessDomainDslPackage.ASSOCIATION__TARGET:
549 if (target != null)
550 msgs = ((InternalEObject)target).eInverseRemove(this, BusinessDomainDslPackage.ABSTRACT_BUSINESS_CLASS__ASSOCIATIONS_FROM, AbstractBusinessClass.class, msgs);
551 return basicSetTarget((AbstractBusinessClass)otherEnd, msgs);
552 case BusinessDomainDslPackage.ASSOCIATION__MODEL:
553 if (eInternalContainer() != null)
554 msgs = eBasicRemoveFromContainer(msgs);
555 return basicSetModel((BusinessDomainModel)otherEnd, msgs);
556 }
557 return super.eInverseAdd(otherEnd, featureID, msgs);
558 }
559
560
561
562
563
564
565 @Override
566 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
567 switch (featureID) {
568 case BusinessDomainDslPackage.ASSOCIATION__SOURCE:
569 return basicSetSource(null, msgs);
570 case BusinessDomainDslPackage.ASSOCIATION__TARGET:
571 return basicSetTarget(null, msgs);
572 case BusinessDomainDslPackage.ASSOCIATION__MODEL:
573 return basicSetModel(null, msgs);
574 }
575 return super.eInverseRemove(otherEnd, featureID, msgs);
576 }
577
578
579
580
581
582
583 @Override
584 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
585 switch (eContainerFeatureID()) {
586 case BusinessDomainDslPackage.ASSOCIATION__MODEL:
587 return eInternalContainer().eInverseRemove(this, BusinessDomainDslPackage.BUSINESS_DOMAIN_MODEL__ASSOCIATIONS, BusinessDomainModel.class, msgs);
588 }
589 return super.eBasicRemoveFromContainerFeature(msgs);
590 }
591
592
593
594
595
596
597 @Override
598 public Object eGet(int featureID, boolean resolve, boolean coreType) {
599 switch (featureID) {
600 case BusinessDomainDslPackage.ASSOCIATION__SOURCE:
601 if (resolve) return getSource();
602 return basicGetSource();
603 case BusinessDomainDslPackage.ASSOCIATION__TARGET:
604 if (resolve) return getTarget();
605 return basicGetTarget();
606 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_ROLE_NAME:
607 return getSourceRoleName();
608 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_MULTIPLICITY:
609 return getSourceMultiplicity();
610 case BusinessDomainDslPackage.ASSOCIATION__TARGET_ROLE_NAME:
611 return getTargetRoleName();
612 case BusinessDomainDslPackage.ASSOCIATION__TARGET_MULTIPLICITY:
613 return getTargetMultiplicity();
614 case BusinessDomainDslPackage.ASSOCIATION__COMPOSITE:
615 return isComposite();
616 case BusinessDomainDslPackage.ASSOCIATION__BIDIRECTIONAL:
617 return isBidirectional();
618 case BusinessDomainDslPackage.ASSOCIATION__ORDERED:
619 return isOrdered();
620 case BusinessDomainDslPackage.ASSOCIATION__MODEL:
621 return getModel();
622 }
623 return super.eGet(featureID, resolve, coreType);
624 }
625
626
627
628
629
630
631 @Override
632 public void eSet(int featureID, Object newValue) {
633 switch (featureID) {
634 case BusinessDomainDslPackage.ASSOCIATION__SOURCE:
635 setSource((BusinessClass)newValue);
636 return;
637 case BusinessDomainDslPackage.ASSOCIATION__TARGET:
638 setTarget((AbstractBusinessClass)newValue);
639 return;
640 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_ROLE_NAME:
641 setSourceRoleName((String)newValue);
642 return;
643 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_MULTIPLICITY:
644 setSourceMultiplicity((Multiplicity)newValue);
645 return;
646 case BusinessDomainDslPackage.ASSOCIATION__TARGET_ROLE_NAME:
647 setTargetRoleName((String)newValue);
648 return;
649 case BusinessDomainDslPackage.ASSOCIATION__TARGET_MULTIPLICITY:
650 setTargetMultiplicity((Multiplicity)newValue);
651 return;
652 case BusinessDomainDslPackage.ASSOCIATION__COMPOSITE:
653 setComposite((Boolean)newValue);
654 return;
655 case BusinessDomainDslPackage.ASSOCIATION__BIDIRECTIONAL:
656 setBidirectional((Boolean)newValue);
657 return;
658 case BusinessDomainDslPackage.ASSOCIATION__ORDERED:
659 setOrdered((Boolean)newValue);
660 return;
661 case BusinessDomainDslPackage.ASSOCIATION__MODEL:
662 setModel((BusinessDomainModel)newValue);
663 return;
664 }
665 super.eSet(featureID, newValue);
666 }
667
668
669
670
671
672
673 @Override
674 public void eUnset(int featureID) {
675 switch (featureID) {
676 case BusinessDomainDslPackage.ASSOCIATION__SOURCE:
677 setSource((BusinessClass)null);
678 return;
679 case BusinessDomainDslPackage.ASSOCIATION__TARGET:
680 setTarget((AbstractBusinessClass)null);
681 return;
682 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_ROLE_NAME:
683 setSourceRoleName(SOURCE_ROLE_NAME_EDEFAULT);
684 return;
685 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_MULTIPLICITY:
686 setSourceMultiplicity(SOURCE_MULTIPLICITY_EDEFAULT);
687 return;
688 case BusinessDomainDslPackage.ASSOCIATION__TARGET_ROLE_NAME:
689 setTargetRoleName(TARGET_ROLE_NAME_EDEFAULT);
690 return;
691 case BusinessDomainDslPackage.ASSOCIATION__TARGET_MULTIPLICITY:
692 setTargetMultiplicity(TARGET_MULTIPLICITY_EDEFAULT);
693 return;
694 case BusinessDomainDslPackage.ASSOCIATION__COMPOSITE:
695 setComposite(COMPOSITE_EDEFAULT);
696 return;
697 case BusinessDomainDslPackage.ASSOCIATION__BIDIRECTIONAL:
698 setBidirectional(BIDIRECTIONAL_EDEFAULT);
699 return;
700 case BusinessDomainDslPackage.ASSOCIATION__ORDERED:
701 setOrdered(ORDERED_EDEFAULT);
702 return;
703 case BusinessDomainDslPackage.ASSOCIATION__MODEL:
704 setModel((BusinessDomainModel)null);
705 return;
706 }
707 super.eUnset(featureID);
708 }
709
710
711
712
713
714
715 @Override
716 public boolean eIsSet(int featureID) {
717 switch (featureID) {
718 case BusinessDomainDslPackage.ASSOCIATION__SOURCE:
719 return source != null;
720 case BusinessDomainDslPackage.ASSOCIATION__TARGET:
721 return target != null;
722 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_ROLE_NAME:
723 return SOURCE_ROLE_NAME_EDEFAULT == null ? sourceRoleName != null : !SOURCE_ROLE_NAME_EDEFAULT.equals(sourceRoleName);
724 case BusinessDomainDslPackage.ASSOCIATION__SOURCE_MULTIPLICITY:
725 return sourceMultiplicity != SOURCE_MULTIPLICITY_EDEFAULT;
726 case BusinessDomainDslPackage.ASSOCIATION__TARGET_ROLE_NAME:
727 return TARGET_ROLE_NAME_EDEFAULT == null ? targetRoleName != null : !TARGET_ROLE_NAME_EDEFAULT.equals(targetRoleName);
728 case BusinessDomainDslPackage.ASSOCIATION__TARGET_MULTIPLICITY:
729 return targetMultiplicity != TARGET_MULTIPLICITY_EDEFAULT;
730 case BusinessDomainDslPackage.ASSOCIATION__COMPOSITE:
731 return composite != COMPOSITE_EDEFAULT;
732 case BusinessDomainDslPackage.ASSOCIATION__BIDIRECTIONAL:
733 return bidirectional != BIDIRECTIONAL_EDEFAULT;
734 case BusinessDomainDslPackage.ASSOCIATION__ORDERED:
735 return ordered != ORDERED_EDEFAULT;
736 case BusinessDomainDslPackage.ASSOCIATION__MODEL:
737 return getModel() != null;
738 }
739 return super.eIsSet(featureID);
740 }
741
742
743
744
745
746
747 @Override
748 public String toString() {
749 if (eIsProxy()) return super.toString();
750
751 StringBuffer result = new StringBuffer(super.toString());
752 result.append(" (sourceRoleName: ");
753 result.append(sourceRoleName);
754 result.append(", sourceMultiplicity: ");
755 result.append(sourceMultiplicity);
756 result.append(", targetRoleName: ");
757 result.append(targetRoleName);
758 result.append(", targetMultiplicity: ");
759 result.append(targetMultiplicity);
760 result.append(", composite: ");
761 result.append(composite);
762 result.append(", bidirectional: ");
763 result.append(bidirectional);
764 result.append(", ordered: ");
765 result.append(ordered);
766 result.append(')');
767 return result.toString();
768 }
769
770 }