001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id: BindingComponentImpl.java 251 2006-08-18 01:00:08Z mpreston $
006: */package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl;
007:
008: import java.beans.PropertyChangeListener;
009: import java.beans.PropertyChangeSupport;
010: import java.io.IOException;
011: import java.io.ObjectInputStream;
012:
013: import org.eclipse.emf.common.notify.Notification;
014: import org.eclipse.emf.common.notify.NotificationChain;
015: import org.eclipse.emf.ecore.EClass;
016: import org.eclipse.emf.ecore.InternalEObject;
017: import org.eclipse.emf.ecore.impl.ENotificationImpl;
018:
019: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.BindingComponent;
020: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Consumer;
021: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.ConsumerCCSL;
022: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.DefaultMepType;
023: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Provider;
024: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.RoleType;
025: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Upoc;
026: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.UpocPostaccept;
027: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.componentflowFactory;
028: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.componentflowPackage;
029:
030: /**
031: * <!-- begin-user-doc -->
032: * An implementation of the model object '<em><b>Binding Component</b></em>'.
033: * <!-- end-user-doc -->
034: * <p>
035: * The following features are implemented:
036: * <ul>
037: * <li>{@link com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl.BindingComponentImpl#getConsumerCCSL <em>Consumer CCSL</em>}</li>
038: * <li>{@link com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.impl.BindingComponentImpl#getRole <em>Role</em>}</li>
039: * </ul>
040: * </p>
041: *
042: * @generated
043: */
044: public abstract class BindingComponentImpl extends
045: ComponentFlowEditorElementImpl implements BindingComponent {
046: /**
047: * <!-- begin-user-doc -->
048: * <!-- end-user-doc -->
049: * @generated
050: */
051: public static final String copyright = "Copyright, Bostech Corp.";
052:
053: /**
054: * The cached value of the '{@link #getConsumerCCSL() <em>Consumer CCSL</em>}' containment reference.
055: * <!-- begin-user-doc -->
056: * <!-- end-user-doc -->
057: * @see #getConsumerCCSL()
058: * @generated
059: * @ordered
060: */
061: protected ConsumerCCSL consumerCCSL = null;
062:
063: /**
064: * The default value of the '{@link #getRole() <em>Role</em>}' attribute.
065: * <!-- begin-user-doc -->
066: * <!-- end-user-doc -->
067: * @see #getRole()
068: * @generated
069: * @ordered
070: */
071: protected static final RoleType ROLE_EDEFAULT = RoleType.CONSUMER_LITERAL;
072:
073: /**
074: * The cached value of the '{@link #getRole() <em>Role</em>}' attribute.
075: * <!-- begin-user-doc -->
076: * <!-- end-user-doc -->
077: * @see #getRole()
078: * @generated
079: * @ordered
080: */
081: protected RoleType role = ROLE_EDEFAULT;
082:
083: /**
084: * @generated NOT
085: */
086: private transient PropertyChangeSupport pcsDelegate =
087:
088: new PropertyChangeSupport(this );
089:
090: /**
091: * @generated NOT
092: */
093: public synchronized void addPropertyChangeListener(
094: PropertyChangeListener l) {
095: if (l == null) {
096: throw new IllegalArgumentException();
097: }
098:
099: pcsDelegate.addPropertyChangeListener(l);
100: }
101:
102: /**
103: * @generated NOT
104: */
105: protected void firePropertyChange(String property, Object oldValue,
106: Object newValue) {
107: if (pcsDelegate.hasListeners(property)) {
108: pcsDelegate
109: .firePropertyChange(property, oldValue, newValue);
110: }
111: }
112:
113: /**
114: * <!-- begin-user-doc -->
115: * <!-- end-user-doc -->
116: * @generated NOT
117: */
118: protected BindingComponentImpl() {
119: super ();
120:
121: ConsumerCCSL consumerCCSL = componentflowFactory.eINSTANCE
122: .createConsumerCCSL();
123: Upoc upoc = componentflowFactory.eINSTANCE.createUpoc();
124:
125: consumerCCSL.setUpoc(upoc);
126:
127: this .setConsumerCCSL(consumerCCSL);
128: }
129:
130: /**
131: * <!-- begin-user-doc -->
132: * <!-- end-user-doc -->
133: * @generated
134: */
135: protected EClass eStaticClass() {
136: return componentflowPackage.Literals.BINDING_COMPONENT;
137: }
138:
139: /**
140: * <!-- begin-user-doc -->
141: * <!-- end-user-doc -->
142: * @generated
143: */
144: public ConsumerCCSL getConsumerCCSL() {
145: return consumerCCSL;
146: }
147:
148: /**
149: * <!-- begin-user-doc -->
150: * <!-- end-user-doc -->
151: * @generated
152: */
153: public NotificationChain basicSetConsumerCCSL(
154: ConsumerCCSL newConsumerCCSL, NotificationChain msgs) {
155: ConsumerCCSL oldConsumerCCSL = consumerCCSL;
156: consumerCCSL = newConsumerCCSL;
157: if (eNotificationRequired()) {
158: ENotificationImpl notification = new ENotificationImpl(
159: this ,
160: Notification.SET,
161: componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL,
162: oldConsumerCCSL, newConsumerCCSL);
163: if (msgs == null)
164: msgs = notification;
165: else
166: msgs.add(notification);
167: }
168: return msgs;
169: }
170:
171: /**
172: * <!-- begin-user-doc -->
173: * <!-- end-user-doc -->
174: * @generated
175: */
176: public void setConsumerCCSL(ConsumerCCSL newConsumerCCSL) {
177: if (newConsumerCCSL != consumerCCSL) {
178: NotificationChain msgs = null;
179: if (consumerCCSL != null)
180: msgs = ((InternalEObject) consumerCCSL)
181: .eInverseRemove(
182: this ,
183: EOPPOSITE_FEATURE_BASE
184: - componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL,
185: null, msgs);
186: if (newConsumerCCSL != null)
187: msgs = ((InternalEObject) newConsumerCCSL)
188: .eInverseAdd(
189: this ,
190: EOPPOSITE_FEATURE_BASE
191: - componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL,
192: null, msgs);
193: msgs = basicSetConsumerCCSL(newConsumerCCSL, msgs);
194: if (msgs != null)
195: msgs.dispatch();
196: } else if (eNotificationRequired())
197: eNotify(new ENotificationImpl(
198: this ,
199: Notification.SET,
200: componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL,
201: newConsumerCCSL, newConsumerCCSL));
202: }
203:
204: /**
205: * <!-- begin-user-doc -->
206: * <!-- end-user-doc -->
207: * @generated NOT
208: */
209: abstract public Provider getProvider();
210:
211: /**
212: * <!-- begin-user-doc -->
213: * <!-- end-user-doc -->
214: * @generated NOT
215: */
216: abstract public Consumer getConsumer();
217:
218: /**
219: * <!-- begin-user-doc -->
220: * <!-- end-user-doc -->
221: * @generated
222: */
223: public RoleType getRole() {
224: return role;
225: }
226:
227: /**
228: * <!-- begin-user-doc -->
229: * <!-- end-user-doc -->
230: * @generated
231: */
232: public void setRole(RoleType newRole) {
233: RoleType oldRole = role;
234: role = newRole == null ? ROLE_EDEFAULT : newRole;
235: if (eNotificationRequired())
236: eNotify(new ENotificationImpl(this , Notification.SET,
237: componentflowPackage.BINDING_COMPONENT__ROLE,
238: oldRole, role));
239: }
240:
241: /**
242: * <!-- begin-user-doc -->
243: * <!-- end-user-doc -->
244: * @generated
245: */
246: public NotificationChain eInverseRemove(InternalEObject otherEnd,
247: int featureID, NotificationChain msgs) {
248: switch (featureID) {
249: case componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL:
250: return basicSetConsumerCCSL(null, msgs);
251: }
252: return super .eInverseRemove(otherEnd, featureID, msgs);
253: }
254:
255: /**
256: * <!-- begin-user-doc -->
257: * <!-- end-user-doc -->
258: * @generated
259: */
260: public Object eGet(int featureID, boolean resolve, boolean coreType) {
261: switch (featureID) {
262: case componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL:
263: return getConsumerCCSL();
264: case componentflowPackage.BINDING_COMPONENT__ROLE:
265: return getRole();
266: }
267: return super .eGet(featureID, resolve, coreType);
268: }
269:
270: /**
271: * <!-- begin-user-doc -->
272: * <!-- end-user-doc -->
273: * @generated
274: */
275: public void eSet(int featureID, Object newValue) {
276: switch (featureID) {
277: case componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL:
278: setConsumerCCSL((ConsumerCCSL) newValue);
279: return;
280: case componentflowPackage.BINDING_COMPONENT__ROLE:
281: setRole((RoleType) newValue);
282: return;
283: }
284: super .eSet(featureID, newValue);
285: }
286:
287: /**
288: * <!-- begin-user-doc -->
289: * <!-- end-user-doc -->
290: * @generated
291: */
292: public void eUnset(int featureID) {
293: switch (featureID) {
294: case componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL:
295: setConsumerCCSL((ConsumerCCSL) null);
296: return;
297: case componentflowPackage.BINDING_COMPONENT__ROLE:
298: setRole(ROLE_EDEFAULT);
299: return;
300: }
301: super .eUnset(featureID);
302: }
303:
304: /**
305: * <!-- begin-user-doc -->
306: * <!-- end-user-doc -->
307: * @generated
308: */
309: public boolean eIsSet(int featureID) {
310: switch (featureID) {
311: case componentflowPackage.BINDING_COMPONENT__CONSUMER_CCSL:
312: return consumerCCSL != null;
313: case componentflowPackage.BINDING_COMPONENT__ROLE:
314: return role != ROLE_EDEFAULT;
315: }
316: return super .eIsSet(featureID);
317: }
318:
319: /**
320: * <!-- begin-user-doc -->
321: * <!-- end-user-doc -->
322: * @generated
323: */
324: public String toString() {
325: if (eIsProxy())
326: return super .toString();
327:
328: StringBuffer result = new StringBuffer(super .toString());
329: result.append(" (role: ");
330: result.append(role);
331: result.append(')');
332: return result.toString();
333: }
334:
335: private void readObject(ObjectInputStream in) throws IOException,
336: ClassNotFoundException {
337: in.defaultReadObject();
338: pcsDelegate = new PropertyChangeSupport(this );
339: }
340:
341: public synchronized void removePropertyChangeListener(
342: PropertyChangeListener l) {
343: if (l != null) {
344: pcsDelegate.removePropertyChangeListener(l);
345: }
346: }
347:
348: /**
349: *
350: * @generated NOT
351: */
352: public boolean isConsumer() {
353: if (this .getRole().getValue() == RoleType.CONSUMER
354: || this .getRole().getValue() == RoleType.BOTH
355: || this .getRole().getValue() == RoleType.RELIABLE_DELIVERY) {
356: return true;
357: } else
358: return false;
359: }
360:
361: /**
362: *
363: * @generated NOT
364: */
365: public boolean isProvider() {
366: if (this .getRole().getValue() == RoleType.PROVIDER
367: || this .getRole().getValue() == RoleType.BOTH
368: || this .getRole().getValue() == RoleType.RELIABLE_DELIVERY) {
369: return true;
370: } else
371: return false;
372: }
373:
374: /**
375: *
376: * @generated NOT
377: */
378: public DefaultMepType getDefaultMep() {
379:
380: return this .getConsumer().getDefaultMep();
381: }
382:
383: } //BindingComponentImpl
|