01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * 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: package org.netbeans.modules.xslt.tmap.model.impl;
20:
21: import java.util.List;
22: import org.netbeans.modules.xml.wsdl.model.ReferenceableWSDLComponent;
23: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.PartnerLinkType;
24: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Role;
25: import org.netbeans.modules.xml.xam.Reference;
26: import org.netbeans.modules.xslt.tmap.model.api.Operation;
27: import org.netbeans.modules.xslt.tmap.model.api.Service;
28: import org.netbeans.modules.xslt.tmap.model.api.TMapAttributes;
29: import org.netbeans.modules.xslt.tmap.model.api.TMapVisitor;
30: import org.netbeans.modules.xslt.tmap.model.api.WSDLReference;
31: import org.w3c.dom.Element;
32:
33: /**
34: *
35: * @author Vitaly Bychkov
36: * @version 1.0
37: */
38: public class ServiceImpl extends TMapComponentContainerImpl implements
39: Service {
40:
41: public ServiceImpl(TMapModelImpl model) {
42: this (model, createNewElement(TMapComponents.SERVICE, model));
43: }
44:
45: public ServiceImpl(TMapModelImpl model, Element element) {
46: super (model, element);
47: }
48:
49: public void accept(TMapVisitor visitor) {
50: visitor.visit(this );
51: }
52:
53: public List<Operation> getOperations() {
54: return getChildren(Operation.class);
55: }
56:
57: public void addOperation(Operation operation) {
58: addAfter(TYPE.getTagName(), operation, TYPE.getChildTypes());
59: }
60:
61: public int getSizeOfOperations() {
62: List<Operation> operations = getChildren(Operation.class);
63: return operations == null ? 0 : operations.size();
64: }
65:
66: public void removeOperation(Operation operation) {
67: removeChild(TYPE.getTagName(), operation);
68: }
69:
70: public WSDLReference<PartnerLinkType> getPartnerLinkType() {
71: return getWSDLReference(TMapAttributes.PARTNER_LINK_TYPE,
72: PartnerLinkType.class);
73: }
74:
75: public void setPartnerLinkType(WSDLReference<PartnerLinkType> pltRef) {
76: setWSDLReference(TMapAttributes.PARTNER_LINK_TYPE, pltRef);
77: }
78:
79: public WSDLReference<Role> getRole() {
80: return getWSDLReference(TMapAttributes.ROLE_NAME, Role.class);
81: }
82:
83: public void setRole(WSDLReference<Role> roleRef) {
84: setWSDLReference(TMapAttributes.ROLE_NAME, roleRef);
85: }
86:
87: public Reference[] getReferences() {
88: return new Reference[] { getPartnerLinkType(), getRole() };
89: }
90:
91: public Class<Service> getComponentType() {
92: return Service.class;
93: }
94: }
|