1 8 9 package org.uddi4j.request; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.datatype.Name; 14 import org.uddi4j.util.CategoryBag; 15 import org.uddi4j.util.FindQualifiers; 16 import org.uddi4j.util.IdentifierBag; 17 import org.w3c.dom.Element ; 18 import org.w3c.dom.NodeList ; 19 20 44 public class FindTModel extends UDDIElement { 45 public static final String UDDI_TAG = "find_tModel"; 46 47 protected Element base = null; 48 49 String maxRows = null; 50 FindQualifiers findQualifiers = null; 51 Name name = null; 52 IdentifierBag identifierBag = null; 53 CategoryBag categoryBag = null; 54 55 61 public FindTModel() { 62 } 63 64 74 public FindTModel(Element base) throws UDDIException { 75 super(base); 77 maxRows = base.getAttribute("maxRows"); 78 NodeList nl = null; 79 nl = getChildElementsByTagName(base, FindQualifiers.UDDI_TAG); 80 if (nl.getLength() > 0) { 81 findQualifiers = new FindQualifiers((Element)nl.item(0)); 82 } 83 nl = getChildElementsByTagName(base, Name.UDDI_TAG); 84 if (nl.getLength() > 0) { 85 name = new Name((Element)nl.item(0)); 86 } 87 nl = getChildElementsByTagName(base, IdentifierBag.UDDI_TAG); 88 if (nl.getLength() > 0) { 89 identifierBag = new IdentifierBag((Element)nl.item(0)); 90 } 91 nl = getChildElementsByTagName(base, CategoryBag.UDDI_TAG); 92 if (nl.getLength() > 0) { 93 categoryBag = new CategoryBag((Element)nl.item(0)); 94 } 95 } 96 97 public void setMaxRows(String s) { 98 maxRows = s; 99 } 100 public void setMaxRows(int s) { 101 maxRows = Integer.toString(s); 102 } 103 104 public void setFindQualifiers(FindQualifiers s) { 105 findQualifiers = s; 106 } 107 108 public void setName(Name s) { 109 name = s; 110 } 111 public void setName(String s) { 112 if (s !=null && !s.equals ("")) { 113 name = new Name(); 114 name.setText(s); 115 } 116 } 117 118 public void setIdentifierBag(IdentifierBag s) { 119 identifierBag = s; 120 } 121 122 public void setCategoryBag(CategoryBag s) { 123 categoryBag = s; 124 } 125 126 public String getMaxRows() { 127 return maxRows; 128 } 129 130 public int getMaxRowsInt() { 131 return Integer.parseInt(maxRows); 132 } 133 134 public FindQualifiers getFindQualifiers() { 135 return findQualifiers; 136 } 137 138 139 public Name getName() { 140 return name; 141 } 142 143 public String getNameString() { 144 if(name!=null) 145 return name.getText(); 146 else 147 return null; 148 } 149 150 public IdentifierBag getIdentifierBag() { 151 return identifierBag; 152 } 153 154 155 public CategoryBag getCategoryBag() { 156 return categoryBag; 157 } 158 159 160 169 public void saveToXML(Element parent) { 170 base = parent.getOwnerDocument().createElement(UDDI_TAG); 171 base.setAttribute("generic", UDDIElement.GENERIC); 173 base.setAttribute("xmlns", UDDIElement.XMLNS); 174 if (maxRows!=null) { 175 base.setAttribute("maxRows", maxRows); 176 } 177 if (findQualifiers!=null) { 178 findQualifiers.saveToXML(base); 179 } 180 if (name!=null) { 181 name.saveToXML(base); 182 } 183 if (identifierBag!=null) { 184 identifierBag.saveToXML(base); 185 } 186 if (categoryBag!=null) { 187 categoryBag.saveToXML(base); 188 } 189 parent.appendChild(base); 190 } 191 } 192 | Popular Tags |