001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: /**
021: *
022: */package org.netbeans.modules.bpel.model.impl;
023:
024: import java.util.concurrent.atomic.AtomicReference;
025:
026: import org.netbeans.modules.bpel.model.api.ContentElement;
027: import org.netbeans.modules.bpel.model.api.PartReference;
028: import org.netbeans.modules.bpel.model.api.PartnerLink;
029: import org.netbeans.modules.bpel.model.api.PartnerLinkReference;
030: import org.netbeans.modules.bpel.model.api.PropertyReference;
031: import org.netbeans.modules.bpel.model.api.VariableDeclaration;
032: import org.netbeans.modules.bpel.model.api.VariableReference;
033: import org.netbeans.modules.bpel.model.api.events.VetoException;
034: import org.netbeans.modules.bpel.model.api.references.BpelReference;
035: import org.netbeans.modules.bpel.model.api.references.WSDLReference;
036: import org.netbeans.modules.bpel.model.xam.BpelAttributes;
037: import org.netbeans.modules.xml.wsdl.model.Part;
038: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.CorrelationProperty;
039: import org.netbeans.modules.xml.xam.Reference;
040: import org.netbeans.modules.xml.xam.dom.Attribute;
041: import org.w3c.dom.Element;
042:
043: /**
044: * @author ads
045: *
046: */
047: public abstract class ToFromIntersectImpl extends
048: ExtensibleElementsImpl implements PartnerLinkReference,
049: VariableReference, PartReference, PropertyReference,
050: ContentElement {
051:
052: ToFromIntersectImpl(BpelModelImpl model, Element e) {
053: super (model, e);
054: }
055:
056: ToFromIntersectImpl(BpelBuilderImpl builder, String tagName) {
057: super (builder, tagName);
058: }
059:
060: /* (non-Javadoc)
061: * @see org.netbeans.modules.soa.model.bpel20.api.From#removePartnerLink()
062: */
063: public void removePartnerLink() {
064: removeReference(BpelAttributes.PARTNER_LINK);
065: }
066:
067: /* (non-Javadoc)
068: * @see org.netbeans.modules.soa.model.bpel20.api.PartnerLinkReference#getPartnerLink()
069: */
070: public BpelReference<PartnerLink> getPartnerLink() {
071: return getBpelReference(BpelAttributes.PARTNER_LINK,
072: PartnerLink.class);
073: }
074:
075: /* (non-Javadoc)
076: * @see org.netbeans.modules.soa.model.bpel20.api.PartnerLinkReference#setPartnerLink(org.netbeans.modules.soa.model.bpel20.references.BpelReference)
077: */
078: public void setPartnerLink(BpelReference<PartnerLink> value) {
079: setBpelReference(BpelAttributes.PARTNER_LINK, value);
080: }
081:
082: /* (non-Javadoc)
083: * @see org.netbeans.modules.soa.model.bpel20.api.VariableSpec#getVariable()
084: */
085: public BpelReference<VariableDeclaration> getVariable() {
086: return getBpelReference(BpelAttributes.VARIABLE_REF,
087: VariableDeclaration.class);
088: }
089:
090: /* (non-Javadoc)
091: * @see org.netbeans.modules.soa.model.bpel20.api.VariableSpec#removeVariable()
092: */
093: public void removeVariable() {
094: removeReference(BpelAttributes.VARIABLE_REF);
095: }
096:
097: /* (non-Javadoc)
098: * @see org.netbeans.modules.soa.model.bpel20.api.VariableSpec#setVariable(org.netbeans.modules.soa.model.bpel20.references.VariableReference)
099: */
100: public void setVariable(BpelReference<VariableDeclaration> value) {
101: setBpelReference(BpelAttributes.VARIABLE_REF, value);
102: }
103:
104: /* (non-Javadoc)
105: * @see org.netbeans.modules.soa.model.bpel20.api.PartReference#getPart()
106: */
107: public WSDLReference<Part> getPart() {
108: return getWSDLReference(BpelAttributes.PART, Part.class);
109: }
110:
111: /* (non-Javadoc)
112: * @see org.netbeans.modules.soa.model.bpel20.api.PartReference#setPart(org.netbeans.modules.soa.model.bpel20.api.support.WSDLReference)
113: */
114: public void setPart(WSDLReference<Part> part) {
115: setWSDLReference(BpelAttributes.PART, part);
116: }
117:
118: /* (non-Javadoc)
119: * @see org.netbeans.modules.soa.model.bpel20.api.PropertyReference#getProperty()
120: */
121: public WSDLReference<CorrelationProperty> getProperty() {
122: return getWSDLReference(BpelAttributes.PROPERTY,
123: CorrelationProperty.class);
124: }
125:
126: /* (non-Javadoc)
127: * @see org.netbeans.modules.soa.model.bpel20.api.PropertyReference#setProperty(org.netbeans.modules.soa.model.bpel20.references.WSDLReference)
128: */
129: public void setProperty(WSDLReference<CorrelationProperty> property) {
130: setWSDLReference(BpelAttributes.PROPERTY, property);
131: }
132:
133: /* (non-Javadoc)
134: * @see org.netbeans.modules.soa.model.bpel20.api.PropertyReference#removeProperty()
135: */
136: public void removeProperty() {
137: removeReference(BpelAttributes.PROPERTY);
138: }
139:
140: /* (non-Javadoc)
141: * @see org.netbeans.modules.soa.model.bpel20.api.ContentElement#getContent()
142: */
143: public String getContent() {
144: return getCorrectedText();
145: }
146:
147: /* (non-Javadoc)
148: * @see org.netbeans.modules.soa.model.bpel20.api.ContentElement#setContent(java.lang.String)
149: */
150: public void setContent(String content) throws VetoException {
151: setText(content);
152: }
153:
154: /* (non-Javadoc)
155: * @see org.netbeans.modules.soa.model.bpel20.api.From#removePart()
156: */
157: public void removePart() {
158: removeReference(BpelAttributes.PART);
159: }
160:
161: /* (non-Javadoc)
162: * @see org.netbeans.modules.soa.model.bpel20.api.ExpressionLanguageSpec#getExpressionLanguage()
163: */
164: public String getExpressionLanguage() {
165: return getAttribute(BpelAttributes.EXPRESSION_LANGUAGE);
166: }
167:
168: /* (non-Javadoc)
169: * @see org.netbeans.modules.soa.model.bpel20.api.ExpressionLanguageSpec#setExpressionLanguage(java.lang.String)
170: */
171: public void setExpressionLanguage(String value)
172: throws VetoException {
173: setBpelAttribute(BpelAttributes.EXPRESSION_LANGUAGE, value);
174: }
175:
176: /* (non-Javadoc)
177: * @see org.netbeans.modules.soa.model.bpel20.api.ExpressionLanguageSpec#removeExpressionLanguage()
178: */
179: public void removeExpressionLanguage() {
180: removeAttribute(BpelAttributes.EXPRESSION_LANGUAGE);
181: }
182:
183: /* (non-Javadoc)
184: * @see org.netbeans.modules.soa.model.bpel20.api.references.ReferenceCollection#getReferences()
185: */
186: public Reference[] getReferences() {
187: return new Reference[] { getPart(), getPartnerLink(),
188: getProperty(), getVariable() };
189: }
190:
191: /* (non-Javadoc)
192: * @see org.netbeans.modules.soa.model.bpel20.impl.BpelEntityImpl#getDomainAttributes()
193: */
194: protected Attribute[] getDomainAttributes() {
195: if (myAttributes.get() == null) {
196: Attribute[] attr = super .getDomainAttributes();
197: Attribute[] ret = new Attribute[attr.length + 6];
198: System.arraycopy(attr, 0, ret, 6, attr.length);
199: ret[0] = BpelAttributes.PARTNER_LINK;
200: ret[1] = BpelAttributes.VARIABLE_REF;
201: ret[2] = BpelAttributes.PART;
202: ret[3] = BpelAttributes.PROPERTY;
203: ret[4] = BpelAttributes.EXPRESSION_LANGUAGE;
204: ret[5] = BpelAttributes.CONTENT;
205: myAttributes.compareAndSet(null, ret);
206: }
207: return myAttributes.get();
208: }
209:
210: private static AtomicReference<Attribute[]> myAttributes = new AtomicReference<Attribute[]>();
211: }
|