1 19 20 package org.netbeans.modules.xml.wsdl.model.extensions.soap.impl; 21 22 import java.util.Collection ; 23 import org.netbeans.modules.xml.wsdl.model.Binding; 24 import org.netbeans.modules.xml.wsdl.model.BindingOperation; 25 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 26 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 27 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPBinding; 28 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPOperation; 29 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPBinding.Style; 30 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPComponent; 31 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPQName; 32 import org.netbeans.modules.xml.xam.Component; 33 import org.w3c.dom.Element ; 34 35 39 public class SOAPOperationImpl extends SOAPComponentImpl implements SOAPOperation { 40 41 42 public SOAPOperationImpl(WSDLModel model, Element e) { 43 super(model, e); 44 } 45 46 public SOAPOperationImpl(WSDLModel model){ 47 this(model, createPrefixedElement(SOAPQName.OPERATION.getQName(), model)); 48 } 49 50 public void accept(SOAPComponent.Visitor visitor) { 51 visitor.visit(this); 52 } 53 54 public void setSoapAction(String soapActionURI) { 55 setAttribute(SOAP_ACTION_PROPERTY, SOAPAttribute.SOAP_ACTION, soapActionURI); 56 } 57 58 public String getSoapAction() { 59 return getAttribute(SOAPAttribute.SOAP_ACTION); 60 } 61 62 public void setStyle(Style v) { 63 setAttribute(STYLE_PROPERTY, SOAPAttribute.STYLE, v); 64 } 65 66 public Style getStyle() { 67 String s = getAttribute(SOAPAttribute.STYLE); 68 if (s == null) { 69 WSDLComponent ancestor = getParent() == null? null : getParent().getParent(); 70 if (ancestor instanceof Binding) { 71 Binding b = (Binding) ancestor; 72 Collection <SOAPBinding> sbs = b.getExtensibilityElements(SOAPBinding.class); 73 if (sbs.size() > 0) { 74 SOAPBinding sb = sbs.iterator().next(); 75 Style sbStyle = sb.getStyle(); 76 if (sbStyle != null) { 77 return sbStyle; 78 } 79 } 80 } 81 return Style.DOCUMENT; 82 } 83 84 return Style.valueOf(s.toUpperCase()); 85 86 } 87 88 @Override 89 public boolean canBeAddedTo(Component target) { 90 if (target instanceof BindingOperation) { 91 return true; 92 } 93 return false; 94 } 95 } 96 | Popular Tags |