001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl;
007:
008: import java.util.Collection;
009:
010: import org.eclipse.emf.common.notify.Notification;
011: import org.eclipse.emf.common.notify.NotificationChain;
012: import org.eclipse.emf.common.util.EList;
013: import org.eclipse.emf.ecore.EClass;
014: import org.eclipse.emf.ecore.InternalEObject;
015: import org.eclipse.emf.ecore.impl.ENotificationImpl;
016: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
017: import org.eclipse.emf.ecore.util.InternalEList;
018:
019: import com.bostechcorp.cbesb.common.util.custcomponent.ICustComponent;
020: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Consumer;
021: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Custom;
022: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.CustomConsumer;
023: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.PropertyObject;
024: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Provider;
025: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Scheduler;
026: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.componentflowFactory;
027: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.componentflowPackage;
028:
029: /**
030: * <!-- begin-user-doc -->
031: * An implementation of the model object '<em><b>Custom</b></em>'.
032: * <!-- end-user-doc -->
033: * <p>
034: * The following features are implemented:
035: * <ul>
036: * <li>{@link com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl.CustomImpl#getType <em>Type</em>}</li>
037: * <li>{@link com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl.CustomImpl#getCustomProvider <em>Custom Provider</em>}</li>
038: * <li>{@link com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl.CustomImpl#getConsumerProperties <em>Consumer Properties</em>}</li>
039: * <li>{@link com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl.CustomImpl#getProviderProperties <em>Provider Properties</em>}</li>
040: * <li>{@link com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl.CustomImpl#getCustomConsumer <em>Custom Consumer</em>}</li>
041: * </ul>
042: * </p>
043: *
044: * @generated
045: */
046: public class CustomImpl extends BindingComponentImpl implements Custom {
047: /**
048: * <!-- begin-user-doc -->
049: * <!-- end-user-doc -->
050: * @generated
051: */
052: public static final String copyright = "Copyright, Bostech Corp.";
053:
054: /**
055: * The default value of the '{@link #getType() <em>Type</em>}' attribute.
056: * <!-- begin-user-doc -->
057: * <!-- end-user-doc -->
058: * @see #getType()
059: * @generated
060: * @ordered
061: */
062: protected static final String TYPE_EDEFAULT = null;
063:
064: /**
065: * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
066: * <!-- begin-user-doc -->
067: * <!-- end-user-doc -->
068: * @see #getType()
069: * @generated
070: * @ordered
071: */
072: protected String type = TYPE_EDEFAULT;
073:
074: /**
075: * @generated NOT
076: *
077: */
078: protected ICustComponent cusComp;
079:
080: /**
081: * The cached value of the '{@link #getCustomProvider() <em>Custom Provider</em>}' containment reference.
082: * <!-- begin-user-doc -->
083: * <!-- end-user-doc -->
084: * @see #getCustomProvider()
085: * @generated
086: * @ordered
087: */
088: protected Provider customProvider = null;
089:
090: /**
091: * The cached value of the '{@link #getConsumerProperties() <em>Consumer Properties</em>}' containment reference list.
092: * <!-- begin-user-doc -->
093: * <!-- end-user-doc -->
094: * @see #getConsumerProperties()
095: * @generated
096: * @ordered
097: */
098: protected EList consumerProperties = null;
099:
100: /**
101: * The cached value of the '{@link #getProviderProperties() <em>Provider Properties</em>}' containment reference list.
102: * <!-- begin-user-doc -->
103: * <!-- end-user-doc -->
104: * @see #getProviderProperties()
105: * @generated
106: * @ordered
107: */
108: protected EList providerProperties = null;
109:
110: /**
111: * The cached value of the '{@link #getCustomConsumer() <em>Custom Consumer</em>}' containment reference.
112: * <!-- begin-user-doc -->
113: * <!-- end-user-doc -->
114: * @see #getCustomConsumer()
115: * @generated
116: * @ordered
117: */
118: protected CustomConsumer customConsumer = null;
119:
120: /**
121: * <!-- begin-user-doc -->
122: * <!-- end-user-doc -->
123: * @generated NOT
124: */
125: protected CustomImpl() {
126: super ();
127: CustomConsumer consumer = componentflowFactory.eINSTANCE
128: .createCustomConsumer();
129: Provider provider = componentflowFactory.eINSTANCE
130: .createProvider();
131: this .setCustomConsumer(consumer);
132: this .setCustomProvider(provider);
133: Scheduler scheduler = componentflowFactory.eINSTANCE
134: .createScheduler();
135: this .getCustomConsumer().setScheduler(scheduler);
136:
137: }
138:
139: /**
140: * <!-- begin-user-doc -->
141: * <!-- end-user-doc -->
142: * @generated
143: */
144: protected EClass eStaticClass() {
145: return componentflowPackage.Literals.CUSTOM;
146: }
147:
148: /**
149: * <!-- begin-user-doc -->
150: * <!-- end-user-doc -->
151: * @generated
152: */
153: public String getType() {
154: return type;
155: }
156:
157: /**
158: * <!-- begin-user-doc -->
159: * <!-- end-user-doc -->
160: * @generated
161: */
162: public void setType(String newType) {
163: String oldType = type;
164: type = newType;
165: if (eNotificationRequired())
166: eNotify(new ENotificationImpl(this , Notification.SET,
167: componentflowPackage.CUSTOM__TYPE, oldType, type));
168: }
169:
170: /**
171: * <!-- begin-user-doc -->
172: * <!-- end-user-doc -->
173: * @generated
174: */
175: public CustomConsumer getCustomConsumer() {
176: return customConsumer;
177: }
178:
179: /**
180: * <!-- begin-user-doc -->
181: * <!-- end-user-doc -->
182: * @generated
183: */
184: public NotificationChain basicSetCustomConsumer(
185: CustomConsumer newCustomConsumer, NotificationChain msgs) {
186: CustomConsumer oldCustomConsumer = customConsumer;
187: customConsumer = newCustomConsumer;
188: if (eNotificationRequired()) {
189: ENotificationImpl notification = new ENotificationImpl(
190: this , Notification.SET,
191: componentflowPackage.CUSTOM__CUSTOM_CONSUMER,
192: oldCustomConsumer, newCustomConsumer);
193: if (msgs == null)
194: msgs = notification;
195: else
196: msgs.add(notification);
197: }
198: return msgs;
199: }
200:
201: /**
202: * <!-- begin-user-doc -->
203: * <!-- end-user-doc -->
204: * @generated
205: */
206: public void setCustomConsumer(CustomConsumer newCustomConsumer) {
207: if (newCustomConsumer != customConsumer) {
208: NotificationChain msgs = null;
209: if (customConsumer != null)
210: msgs = ((InternalEObject) customConsumer)
211: .eInverseRemove(
212: this ,
213: EOPPOSITE_FEATURE_BASE
214: - componentflowPackage.CUSTOM__CUSTOM_CONSUMER,
215: null, msgs);
216: if (newCustomConsumer != null)
217: msgs = ((InternalEObject) newCustomConsumer)
218: .eInverseAdd(
219: this ,
220: EOPPOSITE_FEATURE_BASE
221: - componentflowPackage.CUSTOM__CUSTOM_CONSUMER,
222: null, msgs);
223: msgs = basicSetCustomConsumer(newCustomConsumer, msgs);
224: if (msgs != null)
225: msgs.dispatch();
226: } else if (eNotificationRequired())
227: eNotify(new ENotificationImpl(this , Notification.SET,
228: componentflowPackage.CUSTOM__CUSTOM_CONSUMER,
229: newCustomConsumer, newCustomConsumer));
230: }
231:
232: /**
233: * <!-- begin-user-doc -->
234: * <!-- end-user-doc -->
235: * @generated
236: */
237: public Provider getCustomProvider() {
238: return customProvider;
239: }
240:
241: /**
242: * <!-- begin-user-doc -->
243: * <!-- end-user-doc -->
244: * @generated
245: */
246: public NotificationChain basicSetCustomProvider(
247: Provider newCustomProvider, NotificationChain msgs) {
248: Provider oldCustomProvider = customProvider;
249: customProvider = newCustomProvider;
250: if (eNotificationRequired()) {
251: ENotificationImpl notification = new ENotificationImpl(
252: this , Notification.SET,
253: componentflowPackage.CUSTOM__CUSTOM_PROVIDER,
254: oldCustomProvider, newCustomProvider);
255: if (msgs == null)
256: msgs = notification;
257: else
258: msgs.add(notification);
259: }
260: return msgs;
261: }
262:
263: /**
264: * <!-- begin-user-doc -->
265: * <!-- end-user-doc -->
266: * @generated
267: */
268: public void setCustomProvider(Provider newCustomProvider) {
269: if (newCustomProvider != customProvider) {
270: NotificationChain msgs = null;
271: if (customProvider != null)
272: msgs = ((InternalEObject) customProvider)
273: .eInverseRemove(
274: this ,
275: EOPPOSITE_FEATURE_BASE
276: - componentflowPackage.CUSTOM__CUSTOM_PROVIDER,
277: null, msgs);
278: if (newCustomProvider != null)
279: msgs = ((InternalEObject) newCustomProvider)
280: .eInverseAdd(
281: this ,
282: EOPPOSITE_FEATURE_BASE
283: - componentflowPackage.CUSTOM__CUSTOM_PROVIDER,
284: null, msgs);
285: msgs = basicSetCustomProvider(newCustomProvider, msgs);
286: if (msgs != null)
287: msgs.dispatch();
288: } else if (eNotificationRequired())
289: eNotify(new ENotificationImpl(this , Notification.SET,
290: componentflowPackage.CUSTOM__CUSTOM_PROVIDER,
291: newCustomProvider, newCustomProvider));
292: }
293:
294: /**
295: * <!-- begin-user-doc -->
296: * <!-- end-user-doc -->
297: * @generated
298: */
299: public EList getConsumerProperties() {
300: if (consumerProperties == null) {
301: consumerProperties = new EObjectContainmentEList(
302: PropertyObject.class, this ,
303: componentflowPackage.CUSTOM__CONSUMER_PROPERTIES);
304: }
305: return consumerProperties;
306: }
307:
308: /**
309: * <!-- begin-user-doc -->
310: * <!-- end-user-doc -->
311: * @generated
312: */
313: public EList getProviderProperties() {
314: if (providerProperties == null) {
315: providerProperties = new EObjectContainmentEList(
316: PropertyObject.class, this ,
317: componentflowPackage.CUSTOM__PROVIDER_PROPERTIES);
318: }
319: return providerProperties;
320: }
321:
322: /**
323: * <!-- begin-user-doc -->
324: * <!-- end-user-doc -->
325: * @generated
326: */
327: public NotificationChain eInverseRemove(InternalEObject otherEnd,
328: int featureID, NotificationChain msgs) {
329: switch (featureID) {
330: case componentflowPackage.CUSTOM__CUSTOM_PROVIDER:
331: return basicSetCustomProvider(null, msgs);
332: case componentflowPackage.CUSTOM__CONSUMER_PROPERTIES:
333: return ((InternalEList) getConsumerProperties())
334: .basicRemove(otherEnd, msgs);
335: case componentflowPackage.CUSTOM__PROVIDER_PROPERTIES:
336: return ((InternalEList) getProviderProperties())
337: .basicRemove(otherEnd, msgs);
338: case componentflowPackage.CUSTOM__CUSTOM_CONSUMER:
339: return basicSetCustomConsumer(null, msgs);
340: }
341: return super .eInverseRemove(otherEnd, featureID, msgs);
342: }
343:
344: /**
345: * <!-- begin-user-doc -->
346: * <!-- end-user-doc -->
347: * @generated
348: */
349: public Object eGet(int featureID, boolean resolve, boolean coreType) {
350: switch (featureID) {
351: case componentflowPackage.CUSTOM__TYPE:
352: return getType();
353: case componentflowPackage.CUSTOM__CUSTOM_PROVIDER:
354: return getCustomProvider();
355: case componentflowPackage.CUSTOM__CONSUMER_PROPERTIES:
356: return getConsumerProperties();
357: case componentflowPackage.CUSTOM__PROVIDER_PROPERTIES:
358: return getProviderProperties();
359: case componentflowPackage.CUSTOM__CUSTOM_CONSUMER:
360: return getCustomConsumer();
361: }
362: return super .eGet(featureID, resolve, coreType);
363: }
364:
365: /**
366: * <!-- begin-user-doc -->
367: * <!-- end-user-doc -->
368: * @generated
369: */
370: public void eSet(int featureID, Object newValue) {
371: switch (featureID) {
372: case componentflowPackage.CUSTOM__TYPE:
373: setType((String) newValue);
374: return;
375: case componentflowPackage.CUSTOM__CUSTOM_PROVIDER:
376: setCustomProvider((Provider) newValue);
377: return;
378: case componentflowPackage.CUSTOM__CONSUMER_PROPERTIES:
379: getConsumerProperties().clear();
380: getConsumerProperties().addAll((Collection) newValue);
381: return;
382: case componentflowPackage.CUSTOM__PROVIDER_PROPERTIES:
383: getProviderProperties().clear();
384: getProviderProperties().addAll((Collection) newValue);
385: return;
386: case componentflowPackage.CUSTOM__CUSTOM_CONSUMER:
387: setCustomConsumer((CustomConsumer) newValue);
388: return;
389: }
390: super .eSet(featureID, newValue);
391: }
392:
393: /**
394: * <!-- begin-user-doc -->
395: * <!-- end-user-doc -->
396: * @generated
397: */
398: public void eUnset(int featureID) {
399: switch (featureID) {
400: case componentflowPackage.CUSTOM__TYPE:
401: setType(TYPE_EDEFAULT);
402: return;
403: case componentflowPackage.CUSTOM__CUSTOM_PROVIDER:
404: setCustomProvider((Provider) null);
405: return;
406: case componentflowPackage.CUSTOM__CONSUMER_PROPERTIES:
407: getConsumerProperties().clear();
408: return;
409: case componentflowPackage.CUSTOM__PROVIDER_PROPERTIES:
410: getProviderProperties().clear();
411: return;
412: case componentflowPackage.CUSTOM__CUSTOM_CONSUMER:
413: setCustomConsumer((CustomConsumer) null);
414: return;
415: }
416: super .eUnset(featureID);
417: }
418:
419: /**
420: * <!-- begin-user-doc -->
421: * <!-- end-user-doc -->
422: * @generated
423: */
424: public boolean eIsSet(int featureID) {
425: switch (featureID) {
426: case componentflowPackage.CUSTOM__TYPE:
427: return TYPE_EDEFAULT == null ? type != null
428: : !TYPE_EDEFAULT.equals(type);
429: case componentflowPackage.CUSTOM__CUSTOM_PROVIDER:
430: return customProvider != null;
431: case componentflowPackage.CUSTOM__CONSUMER_PROPERTIES:
432: return consumerProperties != null
433: && !consumerProperties.isEmpty();
434: case componentflowPackage.CUSTOM__PROVIDER_PROPERTIES:
435: return providerProperties != null
436: && !providerProperties.isEmpty();
437: case componentflowPackage.CUSTOM__CUSTOM_CONSUMER:
438: return customConsumer != null;
439: }
440: return super .eIsSet(featureID);
441: }
442:
443: /**
444: * <!-- begin-user-doc -->
445: * <!-- end-user-doc -->
446: * @generated
447: */
448: public String toString() {
449: if (eIsProxy())
450: return super .toString();
451:
452: StringBuffer result = new StringBuffer(super .toString());
453: result.append(" (Type: ");
454: result.append(type);
455: result.append(')');
456: return result.toString();
457: }
458:
459: /**
460: * <!-- begin-user-doc -->
461: * <!-- end-user-doc -->
462: * @generated NOT
463: */
464: public Consumer getConsumer() {
465: //
466: return this .getCustomConsumer();
467: }
468:
469: /**
470: *
471: * @generated NOT
472: */
473: public void setCustomComponent(ICustComponent value) {
474: cusComp = value;
475: }
476:
477: /**
478: * @generated NOT
479: */
480: public void addConsumerProperty(PropertyObject propertyObject) {
481: getConsumerProperties().add(propertyObject);
482: }
483:
484: /**
485: * @generated NOT
486: */
487: public void clearConsumerProperties() {
488: getConsumerProperties().clear();
489: }
490:
491: /**
492: * @generated NOT
493: */
494: public void addProviderProperty(PropertyObject propertyObject) {
495: getProviderProperties().add(propertyObject);
496: }
497:
498: /**
499: * @generated NOT
500: */
501: public void clearProviderProperties() {
502: getProviderProperties().clear();
503: }
504:
505: /**
506: *
507: * @generated NOT
508: */
509: public ICustComponent getCustomComponent() {
510: return cusComp;
511: }
512:
513: /**
514: * @generated NOT
515: */
516: public PropertyObject getValueProvider(String name) {
517: return getValue(getProviderProperties(), name);
518:
519: }
520:
521: /**
522: * @generated NOT
523: */
524: public PropertyObject getValueConsumer(String name) {
525: return getValue(getConsumerProperties(), name);
526:
527: }
528:
529: /**
530: * @generated NOT
531: */
532: private PropertyObject getValue(EList list, String name) {
533: if (list.size() == 0)
534: return null;
535: for (int i = 0; i < list.size(); i++) {
536: if (name.equalsIgnoreCase(((PropertyObject) list.get(i))
537: .getName()))
538: return (PropertyObject) list.get(i);
539: }
540:
541: return null;
542:
543: }
544:
545: @Override
546: public Provider getProvider() {
547: return this .getCustomProvider();
548: }
549:
550: } //CustomImpl
|