1 8 9 package org.uddi4j.response; 10 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIElement; 14 import org.uddi4j.UDDIException; 15 import org.uddi4j.datatype.binding.BindingTemplate; 16 import org.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 43 public class BindingDetail extends UDDIElement { 44 public static final String UDDI_TAG = "bindingDetail"; 45 46 protected Element base = null; 47 48 String operator = null; 49 String truncated = null; 50 Vector bindingTemplate = new Vector (); 52 53 59 60 public BindingDetail() { 61 } 62 63 68 public BindingDetail(String operator) { 69 this.operator = operator; 70 } 71 72 82 83 public BindingDetail(Element base) throws UDDIException { 84 super(base); 86 operator = base.getAttribute("operator"); 87 truncated = base.getAttribute("truncated"); 88 NodeList nl = null; 89 nl = getChildElementsByTagName(base, BindingTemplate.UDDI_TAG); 90 for (int i=0; i < nl.getLength(); i++) { 91 bindingTemplate.addElement(new BindingTemplate((Element)nl.item(i))); 92 } 93 } 94 95 public void setOperator(String s) { 96 operator = s; 97 } 98 99 public void setTruncated(String s) { 100 truncated = s; 101 } 102 public void setTruncated(boolean s) { 103 if (s) { 104 truncated = "true"; 105 } else { 106 truncated = "false"; 107 } 108 } 109 110 115 public void setBindingTemplateVector(Vector s) { 116 bindingTemplate = s; 117 } 118 119 public String getOperator() { 120 return operator; 121 } 122 123 124 public String getTruncated() { 125 return truncated; 126 } 127 128 public boolean getTruncatedBoolean() { 129 return "true".equals(truncated); 130 } 131 132 137 public Vector getBindingTemplateVector() { 138 return bindingTemplate; 139 } 140 141 150 151 public void saveToXML(Element parent) { 152 base = parent.getOwnerDocument().createElement(UDDI_TAG); 153 base.setAttribute("generic", UDDIElement.GENERIC); 155 base.setAttribute("xmlns", UDDIElement.XMLNS); 156 if (operator!=null) { 157 base.setAttribute("operator", operator); 158 } 159 if (truncated!=null) { 160 base.setAttribute("truncated", truncated); 161 } 162 if (bindingTemplate!=null) { 163 for (int i=0; i < bindingTemplate.size(); i++) { 164 ((BindingTemplate)(bindingTemplate.elementAt(i))).saveToXML(base); 165 } 166 } 167 parent.appendChild(base); 168 } 169 } 170 | Popular Tags |