1 19 20 package org.netbeans.modules.xml.wsdl.model.extensions.bpel.impl; 21 22 import java.util.Collection ; 23 import org.netbeans.modules.xml.wsdl.model.ExtensibilityElement; 24 import org.netbeans.modules.xml.wsdl.model.PortType; 25 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 26 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.BPELExtensibilityComponent; 27 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.BPELQName; 28 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Documentation; 29 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.PartnerLinkType; 30 import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Role; 31 import org.netbeans.modules.xml.wsdl.model.spi.NamedExtensibilityElementBase; 32 import org.netbeans.modules.xml.xam.Component; 33 import org.netbeans.modules.xml.xam.dom.NamedComponentReference; 34 import org.w3c.dom.Element ; 35 36 43 public class RoleImpl extends NamedExtensibilityElementBase implements Role { 44 45 46 public RoleImpl(WSDLModel model, Element e) { 47 super(model, e); 48 } 49 50 public RoleImpl(WSDLModel model){ 51 this(model, createPrefixedElement(BPELQName.ROLE.getQName(), model)); 52 } 53 54 protected String getNamespaceURI() { 55 return BPELQName.PLNK_NS; 56 } 57 58 public NamedComponentReference<PortType> getPortType() { 59 return resolveGlobalReference(PortType.class, BPELAttribute.PORT_TYPE); 60 } 61 62 public void setPortType(NamedComponentReference<PortType> portType) { 63 setAttribute(PORT_TYPE_PROPERTY, BPELAttribute.PORT_TYPE, portType); 64 } 65 66 public void accept(BPELExtensibilityComponent.Visitor v) { 67 v.visit(this); 68 } 69 70 @Override 71 public void addExtensibilityElement(ExtensibilityElement ee) { 72 if (ee instanceof Documentation) { 73 addRoleDocumentation((Documentation) ee); 74 } else { 75 super.addExtensibilityElement(ee); 76 } 77 } 78 79 public void addRoleDocumentation(Documentation doc) { 80 if (doc == null) return; 81 appendChild(ROLE_DOCUMENTATION_PROPERTY, doc); 82 } 83 84 public void removeRoleDocumentation(Documentation doc) { 85 removeChild(ROLE_DOCUMENTATION_PROPERTY, doc); 86 87 } 88 89 public Collection <Documentation> getRoleDocumentations() { 90 return getChildren(Documentation.class); 91 } 92 93 @Override 94 public boolean canBeAddedTo(Component target) { 95 if (target instanceof PartnerLinkType) { 96 return true; 97 } 98 return false; 99 } 100 } 101 | Popular Tags |