1 8 9 package org.uddi4j.response; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.util.BusinessKey; 14 import org.w3c.dom.Element ; 15 import org.w3c.dom.NodeList ; 16 17 44 public class RelatedBusinessesList extends UDDIElement 45 { 46 47 public static final String UDDI_TAG = "relatedBusinessesList"; 48 49 protected Element base = null; 50 51 String operator = null; 52 String truncated = null; 53 BusinessKey businessKey = null; 54 RelatedBusinessInfos relBusInfos = null; 55 56 62 63 public RelatedBusinessesList() 64 { 65 } 66 67 77 78 public RelatedBusinessesList(Element base) throws UDDIException 79 { 80 super(base); 82 operator = base.getAttribute("operator"); 83 truncated = base.getAttribute("truncated"); 84 NodeList nl = null; 85 nl = getChildElementsByTagName(base, RelatedBusinessInfos.UDDI_TAG); 86 if (nl.getLength() > 0) 87 { 88 relBusInfos = new RelatedBusinessInfos((Element)nl.item(0)); 89 } 90 nl = getChildElementsByTagName(base, BusinessKey.UDDI_TAG); 91 if (nl.getLength() > 0) 92 { 93 businessKey = new BusinessKey((Element)nl.item(0)); 94 } 95 } 96 97 104 public RelatedBusinessesList(String operator, String businessKey, RelatedBusinessInfos bi) 105 { 106 this.operator = operator; 107 this.businessKey = new BusinessKey(businessKey); 108 this.relBusInfos = bi; 109 } 110 111 public String getOperator() 112 { 113 return this.operator; 114 } 115 116 public void setOperator(String s) 117 { 118 this.operator = s; 119 } 120 121 public boolean getTruncatedBoolean() 122 { 123 return "true".equals(truncated); 124 } 125 126 public void setTruncated(boolean s) 127 { 128 if (s) 129 { 130 truncated = "true"; 131 } 132 else 133 { 134 truncated = "false"; 135 } 136 } 137 138 public String getTruncated() 139 { 140 return truncated; 141 } 142 143 public void setTruncated(String s) 144 { 145 truncated = s; 146 } 147 148 public String getBusinessKey() 149 { 150 return businessKey.getText(); 151 } 152 153 public void setBusinessKey(String businessKey) 154 { 155 this.businessKey = new BusinessKey(businessKey); 156 } 157 158 public RelatedBusinessInfos getRelatedBusinessInfos() 159 { 160 return this.relBusInfos; 161 } 162 163 public void setRelatedBusinessInfos(RelatedBusinessInfos r) 164 { 165 this.relBusInfos = r; 166 } 167 168 177 178 public void saveToXML(Element parent) 179 { 180 base = parent.getOwnerDocument().createElement(UDDI_TAG); 181 base.setAttribute("generic", UDDIElement.GENERIC); 183 base.setAttribute("xmlns", UDDIElement.XMLNS); 184 if (operator != null) 185 { 186 base.setAttribute("operator", operator); 187 } 188 if (truncated != null) 189 { 190 base.setAttribute("truncated", truncated); 191 } 192 if (businessKey != null) 193 { 194 businessKey.saveToXML(base); 195 } 196 if (relBusInfos != null) 197 { 198 relBusInfos.saveToXML(base); 199 } 200 parent.appendChild(base); 201 202 } 203 } 204 | Popular Tags |