001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.websvc.wsitmodelext.policy.impl;
043:
044: import org.netbeans.modules.websvc.wsitmodelext.security.SecurityQName;
045: import org.netbeans.modules.websvc.wsitmodelext.policy.All;
046: import org.netbeans.modules.websvc.wsitmodelext.policy.ExactlyOne;
047: import org.netbeans.modules.websvc.wsitmodelext.policy.Policy;
048: import org.netbeans.modules.websvc.wsitmodelext.policy.PolicyQName;
049: import org.netbeans.modules.websvc.wsitmodelext.policy.PolicyReference;
050: import org.netbeans.modules.xml.wsdl.model.WSDLComponent;
051: import org.netbeans.modules.xml.wsdl.model.WSDLModel;
052: import org.netbeans.modules.xml.wsdl.model.visitor.WSDLVisitor;
053: import org.w3c.dom.Element;
054:
055: import java.util.Collections;
056:
057: /**
058: *
059: * @author Martin Grebac
060: */
061: public class PolicyImpl extends PolicyComponentImpl implements Policy {
062:
063: /**
064: * Creates a new instance of PolicyImpl
065: */
066: public PolicyImpl(WSDLModel model, Element e) {
067: super (model, e);
068: }
069:
070: public PolicyImpl(WSDLModel model) {
071: this (model, createPrefixedElement(
072: PolicyQName.POLICY.getQName(), model));
073: }
074:
075: @Override
076: public void accept(WSDLVisitor visitor) {
077: visitor.visit(this );
078: }
079:
080: public void setID(String id) {
081: setAnyAttribute(SecurityQName.SECPOLID.getQName(), id);
082: }
083:
084: public String getID() {
085: return getAnyAttribute(SecurityQName.SECPOLID.getQName());
086: }
087:
088: public void setAll(All all) {
089: java.util.List<Class<? extends WSDLComponent>> classes = Collections
090: .emptyList();
091: setChild(All.class, ALL_PROPERTY, all, classes);
092: }
093:
094: public All getAll() {
095: return getChild(All.class);
096: }
097:
098: public void removeAll(All all) {
099: removeChild(ALL_PROPERTY, all);
100: }
101:
102: public void setExactlyOne(ExactlyOne exactlyOne) {
103: java.util.List<Class<? extends WSDLComponent>> classes = Collections
104: .emptyList();
105: setChild(ExactlyOne.class, EXACTLYONE_PROPERTY, exactlyOne,
106: classes);
107: }
108:
109: public ExactlyOne getExactlyOne() {
110: return getChild(ExactlyOne.class);
111: }
112:
113: public void removeExactlyOne(ExactlyOne exactlyOne) {
114: removeChild(EXACTLYONE_PROPERTY, exactlyOne);
115: }
116:
117: public void setPolicy(Policy policy) {
118: java.util.List<Class<? extends WSDLComponent>> classes = Collections
119: .emptyList();
120: setChild(Policy.class, POLICY_PROPERTY, policy, classes);
121: }
122:
123: public Policy getPolicy() {
124: return getChild(Policy.class);
125: }
126:
127: public void removePolicy(Policy policy) {
128: removeChild(POLICY_PROPERTY, policy);
129: }
130:
131: public void setPolicyReference(PolicyReference policyReference) {
132: java.util.List<Class<? extends WSDLComponent>> classes = Collections
133: .emptyList();
134: setChild(PolicyReference.class, POLICYREFERENCE_PROPERTY,
135: policyReference, classes);
136: }
137:
138: public PolicyReference getPolicyReference() {
139: return getChild(PolicyReference.class);
140: }
141:
142: public void removePolicyReference(PolicyReference policyReference) {
143: removeChild(POLICYREFERENCE_PROPERTY, policyReference);
144: }
145: }
|