KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > model > extensions > bpel > impl > PropertyAliasImpl


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.wsdl.model.extensions.bpel.impl;
21
22 import org.netbeans.modules.xml.schema.model.GlobalElement;
23 import org.netbeans.modules.xml.schema.model.GlobalType;
24 import org.netbeans.modules.xml.wsdl.model.Definitions;
25 import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement;
26 import org.netbeans.modules.xml.wsdl.model.Message;
27 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
28 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.BPELExtensibilityComponent;
29 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.BPELQName;
30 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.CorrelationProperty;
31 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.PropertyAlias;
32 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Query;
33 import org.netbeans.modules.xml.wsdl.model.spi.GenericExtensibilityElement;
34 import org.netbeans.modules.xml.xam.Component;
35 import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
36 import org.w3c.dom.Element JavaDoc;
37
38 /**
39  *
40  * @author Nam Nguyen
41  *
42  * changed by
43  * @author ads
44  */

45 public class PropertyAliasImpl extends GenericExtensibilityElement implements
46         PropertyAlias, ExtensibilityElement.ParentSelector
47 {
48
49     public PropertyAliasImpl( WSDLModel model, Element e ) {
50         super(model, e);
51     }
52
53     public PropertyAliasImpl( WSDLModel model ) {
54         this(model, createPrefixedElement(BPELQName.PROPERTY_ALIAS.getQName(),
55                 model));
56     }
57
58     protected String JavaDoc getNamespaceURI() {
59         return BPELQName.VARPROP_NS;
60     }
61
62     public NamedComponentReference<CorrelationProperty> getPropertyName() {
63         return resolveGlobalReference(CorrelationProperty.class,
64                 BPELAttribute.PROPERTY_NAME);
65     }
66
67     public void setPropertyName(
68             NamedComponentReference<CorrelationProperty> property )
69     {
70         setAttribute(PROPERTY_NAME_PROPERTY, BPELAttribute.PROPERTY_NAME,
71                 property);
72     }
73
74     public NamedComponentReference<Message> getMessageType() {
75         return resolveGlobalReference(Message.class, BPELAttribute.MESSAGE_TYPE);
76     }
77
78     public void setMessageType( NamedComponentReference<Message> type ) {
79         setAttribute(MESSAGE_TYPE_PROPERTY, BPELAttribute.MESSAGE_TYPE, type);
80     }
81
82     public String JavaDoc getPart() {
83         return getAttribute(BPELAttribute.PART);
84     }
85
86     public void setPart( String JavaDoc part ) {
87         setAttribute(PART_PROPERTY, BPELAttribute.PART, part);
88     }
89
90     public Query getQuery() {
91         return getChild( Query.class );
92     }
93
94     public void setQuery( Query query ) {
95         Query q = getQuery();
96         if ( q!= null ){
97             removeChild(QUERY_PROPERTY, q);
98         }
99         appendChild(QUERY_PROPERTY, query );
100     }
101
102     public void accept( BPELExtensibilityComponent.Visitor v ) {
103         v.visit(this);
104     }
105
106     public void removeQuery() {
107         if ( getQuery()!= null ){
108             removeChild( QUERY_PROPERTY, getQuery() );
109         }
110     }
111     
112     public void removeQuery( Query query ) {
113         if ( query!= null ){
114             removeChild( QUERY_PROPERTY, query );
115         }
116     }
117     
118     public NamedComponentReference<GlobalType> getType() {
119         return resolveSchemaReference(GlobalType.class, BPELAttribute.TYPE);
120     }
121
122     public void setType(NamedComponentReference<GlobalType> type) {
123         setAttribute(TYPE_PROPERTY, BPELAttribute.TYPE, type);
124     }
125
126     public NamedComponentReference<GlobalElement> getElement() {
127         return resolveSchemaReference(GlobalElement.class, BPELAttribute.ELEMENT);
128     }
129
130     public void setElement( NamedComponentReference<GlobalElement> value ) {
131         setAttribute(ELEMENT_PROPERTY, BPELAttribute.ELEMENT, value);
132     }
133
134     @Override JavaDoc
135     public boolean canBeAddedTo(Component target) {
136         if (target instanceof Definitions) {
137             return true;
138         }
139         return false;
140     }
141
142 }
Popular Tags