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.business.BusinessEntity; 16 import org.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 42 public class BusinessDetail extends UDDIElement { 43 public static final String UDDI_TAG = "businessDetail"; 44 45 protected Element base = null; 46 47 String operator = null; 48 String truncated = null; 49 Vector businessEntity = new Vector (); 51 52 58 59 public BusinessDetail() { 60 } 61 62 67 public BusinessDetail(String operator) { 68 this.operator = operator; 69 } 70 71 81 82 public BusinessDetail(Element base) throws UDDIException { 83 super(base); 85 operator = base.getAttribute("operator"); 86 truncated = base.getAttribute("truncated"); 87 NodeList nl = null; 88 nl = getChildElementsByTagName(base, BusinessEntity.UDDI_TAG); 89 for (int i=0; i < nl.getLength(); i++) { 90 businessEntity.addElement(new BusinessEntity((Element)nl.item(i))); 91 } 92 } 93 94 public void setOperator(String s) { 95 operator = s; 96 } 97 98 public void setTruncated(String s) { 99 truncated = s; 100 } 101 public void setTruncated(boolean s) { 102 if (s) { 103 truncated = "true"; 104 } else { 105 truncated = "false"; 106 } 107 } 108 109 114 public void setBusinessEntityVector(Vector s) { 115 businessEntity = s; 116 } 117 118 public String getOperator() { 119 return operator; 120 } 121 122 123 public String getTruncated() { 124 return truncated; 125 } 126 127 public boolean getTruncatedBoolean() { 128 return "true".equals(truncated); 129 } 130 131 136 public Vector getBusinessEntityVector() { 137 return businessEntity; 138 } 139 140 149 150 public void saveToXML(Element parent) { 151 base = parent.getOwnerDocument().createElement(UDDI_TAG); 152 base.setAttribute("generic", UDDIElement.GENERIC); 154 base.setAttribute("xmlns", UDDIElement.XMLNS); 155 if (operator!=null) { 156 base.setAttribute("operator", operator); 157 } 158 if (truncated!=null) { 159 base.setAttribute("truncated", truncated); 160 } 161 if (businessEntity!=null) { 162 for (int i=0; i < businessEntity.size(); i++) { 163 ((BusinessEntity)(businessEntity.elementAt(i))).saveToXML(base); 164 } 165 } 166 parent.appendChild(base); 167 } 168 } 169 | Popular Tags |