1 8 9 package org.uddi4j.request; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.util.BusinessKey; 14 import org.uddi4j.util.FindQualifiers; 15 import org.uddi4j.util.KeyedReference; 16 import org.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 48 public class FindRelatedBusinesses extends UDDIElement { 49 50 public static final String UDDI_TAG = "find_relatedBusinesses"; 51 52 protected Element base = null; 53 54 String maxRows = null; 55 FindQualifiers findQualifiers = null; 56 KeyedReference keyRef = null; 57 String businessKey = null; 58 59 65 public FindRelatedBusinesses() { 66 } 67 68 78 public FindRelatedBusinesses(Element base) throws UDDIException { 79 super(base); 81 maxRows = base.getAttribute("maxRows"); 82 83 NodeList nl = null; 84 nl = getChildElementsByTagName(base, BusinessKey.UDDI_TAG); 85 if (nl.getLength() > 0) { 86 businessKey = new BusinessKey((Element)nl.item(0)).getText(); 87 } 88 89 nl = getChildElementsByTagName(base, FindQualifiers.UDDI_TAG); 90 if (nl.getLength() > 0) { 91 findQualifiers = new FindQualifiers((Element)nl.item(0)); 92 } 93 94 nl = getChildElementsByTagName(base, KeyedReference.UDDI_TAG); 95 if (nl.getLength() > 0) { 96 keyRef = new KeyedReference((Element)nl.item(0)); 97 } 98 99 } 100 101 106 public FindRelatedBusinesses(String businessKey) { 107 this.businessKey = businessKey; 108 } 109 110 public void setBusinessKey(String newBusinessKey) { 111 this.businessKey = newBusinessKey; 112 } 113 114 public String getBusinessKey() { 115 return this.businessKey; 116 } 117 118 public void setFindQualifiers(FindQualifiers fqs) { 119 this.findQualifiers = fqs; 120 } 121 122 public FindQualifiers getFindQualifiers() { 123 return this.findQualifiers; 124 } 125 126 public void setKeyedReference (KeyedReference newKeyedReference) { 127 this.keyRef = newKeyedReference; 128 } 129 130 public KeyedReference getKeyedReference() { 131 return this.keyRef; 132 } 133 134 public String getMaxRows() { 135 return this.maxRows; 136 } 137 138 public void setMaxRows(String rows) { 139 this.maxRows = rows; 140 } 141 142 public int getMaxRowsInt() { 143 return Integer.parseInt(this.maxRows); 144 } 145 146 public void setMaxRows(int s) { 147 maxRows = Integer.toString(s); 148 } 149 150 159 public void saveToXML(Element parent) { 160 base = parent.getOwnerDocument().createElement(UDDI_TAG); 161 base.setAttribute("generic", UDDIElement.GENERIC); 163 base.setAttribute("xmlns", UDDIElement.XMLNS); 164 165 if (maxRows!=null) { 166 base.setAttribute("maxRows", maxRows); 167 } 168 if (findQualifiers!=null) { 169 findQualifiers.saveToXML(base); 170 } 171 if (businessKey!=null) { 172 (new BusinessKey(businessKey)).saveToXML(base); 173 } 174 if(keyRef != null ) { 175 keyRef.saveToXML(base); 176 } 177 178 parent.appendChild(base); 179 } 180 } 181 | Popular Tags |