1 8 9 package org.uddi4j.response; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.w3c.dom.Element ; 14 import org.w3c.dom.NodeList ; 15 16 39 public class ServiceList extends UDDIElement { 40 public static final String UDDI_TAG = "serviceList"; 41 42 protected Element base = null; 43 44 String operator = null; 45 String truncated = null; 46 ServiceInfos serviceInfos = null; 47 48 54 55 public ServiceList() { 56 } 57 58 64 public ServiceList(String operator, 65 ServiceInfos serviceInfos) { 66 this.operator = operator; 67 this.serviceInfos = serviceInfos; 68 } 69 70 80 81 public ServiceList(Element base) throws UDDIException { 82 super(base); 84 operator = base.getAttribute("operator"); 85 truncated = base.getAttribute("truncated"); 86 NodeList nl = null; 87 nl = getChildElementsByTagName(base, ServiceInfos.UDDI_TAG); 88 if (nl.getLength() > 0) { 89 serviceInfos = new ServiceInfos((Element)nl.item(0)); 90 } 91 } 92 93 public void setOperator(String s) { 94 operator = s; 95 } 96 97 public void setTruncated(String s) { 98 truncated = s; 99 } 100 public void setTruncated(boolean s) { 101 if (s) { 102 truncated = "true"; 103 } else { 104 truncated = "false"; 105 } 106 } 107 108 public void setServiceInfos(ServiceInfos s) { 109 serviceInfos = s; 110 } 111 112 public String getOperator() { 113 return operator; 114 } 115 116 117 public String getTruncated() { 118 return truncated; 119 } 120 121 public boolean getTruncatedBoolean() { 122 return "true".equals(truncated); 123 } 124 125 public ServiceInfos getServiceInfos() { 126 return serviceInfos; 127 } 128 129 130 139 140 public void saveToXML(Element parent) { 141 base = parent.getOwnerDocument().createElement(UDDI_TAG); 142 base.setAttribute("generic", UDDIElement.GENERIC); 144 base.setAttribute("xmlns", UDDIElement.XMLNS); 145 if (operator!=null) { 146 base.setAttribute("operator", operator); 147 } 148 if (truncated!=null) { 149 base.setAttribute("truncated", truncated); 150 } 151 if (serviceInfos!=null) { 152 serviceInfos.saveToXML(base); 153 } 154 parent.appendChild(base); 155 } 156 } 157 | Popular Tags |