1 19 20 package org.netbeans.modules.xml.wsdl.model.extensions.soap.impl; 21 22 import java.util.Collection ; 23 import java.util.Collections ; 24 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 25 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPMessageBase; 26 import org.netbeans.modules.xml.wsdl.model.extensions.soap.SOAPMessageBase.Use; 27 import org.netbeans.modules.xml.wsdl.model.impl.Util; 28 import org.w3c.dom.Element ; 29 30 34 public abstract class SOAPMessageBaseImpl extends SOAPComponentImpl implements SOAPMessageBase { 35 36 37 public SOAPMessageBaseImpl(WSDLModel model, Element e) { 38 super(model, e); 39 } 40 41 public Use getUse() { 42 String s = getAttribute(SOAPAttribute.USE); 43 return s == null ? null : getUseValueOf(s); 44 } 45 46 public void setUse(Use use) { 47 setAttribute(USE_PROPERTY, SOAPAttribute.USE, use); 48 } 49 50 private Use getUseValueOf(String s) { 51 return s == null ? null : Use.valueOf(s.toUpperCase()); 52 } 53 54 protected Object getAttributeValueOf(SOAPAttribute attr, String s) { 55 if (attr == SOAPAttribute.USE) { 56 return getUseValueOf(s); 57 } else { 58 return super.getAttributeValueOf(attr, s); 59 } 60 } 61 62 public String getNamespace() { 63 return getAttribute(SOAPAttribute.NAMESPACE); 64 } 65 66 public void setNamespace(String namespaceURI) { 67 setAttribute(NAMESPACE_PROPERTY, SOAPAttribute.NAMESPACE, namespaceURI); 68 } 69 70 public void removeEncodingStyle(String encodingStyle) { 71 Collection <String > styles = getEncodingStyles(); 72 if (styles != null && styles.remove(encodingStyle)) { 73 setAttribute(ENCODING_STYLE_PROPERTY, SOAPAttribute.ENCODING_STYLE, Util.toString(styles)); 74 } 75 } 76 77 public void addEncodingStyle(String encodingStyle) { 78 Collection <String > styles = getEncodingStyles(); 79 if (styles != null) { 80 styles.add(encodingStyle); 81 } else { 82 styles = Collections.singleton(encodingStyle); 83 } 84 setAttribute(ENCODING_STYLE_PROPERTY, SOAPAttribute.ENCODING_STYLE, Util.toString(styles)); 85 } 86 87 public java.util.Collection <String > getEncodingStyles() { 88 String s = getAttribute(SOAPAttribute.ENCODING_STYLE); 89 return s == null ? null : Util.parse(s); 90 } 91 } 92 | Popular Tags |