1 8 9 package org.uddi4j.request; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.util.FindQualifiers; 14 import org.uddi4j.util.TModelBag; 15 import org.w3c.dom.Element ; 16 import org.w3c.dom.NodeList ; 17 18 42 public class FindBinding extends UDDIElement { 43 public static final String UDDI_TAG = "find_binding"; 44 45 protected Element base = null; 46 47 String maxRows = null; 48 String serviceKey = null; 49 FindQualifiers findQualifiers = null; 50 TModelBag tModelBag = null; 51 52 58 public FindBinding() { 59 } 60 61 67 public FindBinding(String serviceKey, 68 TModelBag tModelBag) { 69 this.serviceKey = serviceKey; 70 this.tModelBag = tModelBag; 71 } 72 73 83 public FindBinding(Element base) throws UDDIException { 84 super(base); 86 maxRows = base.getAttribute("maxRows"); 87 serviceKey = base.getAttribute("serviceKey"); 88 NodeList nl = null; 89 nl = getChildElementsByTagName(base, FindQualifiers.UDDI_TAG); 90 if (nl.getLength() > 0) { 91 findQualifiers = new FindQualifiers((Element)nl.item(0)); 92 } 93 nl = getChildElementsByTagName(base, TModelBag.UDDI_TAG); 94 if (nl.getLength() > 0) { 95 tModelBag = new TModelBag((Element)nl.item(0)); 96 } 97 } 98 99 public void setMaxRows(String s) { 100 maxRows = s; 101 } 102 public void setMaxRows(int s) { 103 maxRows = Integer.toString(s); 104 } 105 106 public void setServiceKey(String s) { 107 serviceKey = s; 108 } 109 110 public void setFindQualifiers(FindQualifiers s) { 111 findQualifiers = s; 112 } 113 114 public void setTModelBag(TModelBag s) { 115 tModelBag = s; 116 } 117 118 public String getMaxRows() { 119 return maxRows; 120 } 121 122 public int getMaxRowsInt() { 123 return Integer.parseInt(maxRows); 124 } 125 126 public String getServiceKey() { 127 return serviceKey; 128 } 129 130 131 public FindQualifiers getFindQualifiers() { 132 return findQualifiers; 133 } 134 135 136 public TModelBag getTModelBag() { 137 return tModelBag; 138 } 139 140 141 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 (maxRows!=null) { 156 base.setAttribute("maxRows", maxRows); 157 } 158 if (serviceKey!=null) { 159 base.setAttribute("serviceKey", serviceKey); 160 } 161 if (findQualifiers!=null) { 162 findQualifiers.saveToXML(base); 163 } 164 if (tModelBag!=null) { 165 tModelBag.saveToXML(base); 166 } 167 parent.appendChild(base); 168 } 169 } 170 | Popular Tags |