1 8 9 package org.uddi4j.request; 10 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIElement; 14 import org.uddi4j.UDDIException; 15 import org.uddi4j.datatype.tmodel.TModel; 16 import org.uddi4j.util.AuthInfo; 17 import org.uddi4j.util.UploadRegister; 18 import org.w3c.dom.Element ; 19 import org.w3c.dom.NodeList ; 20 21 44 public class SaveTModel extends UDDIElement { 45 public static final String UDDI_TAG = "save_tModel"; 46 47 protected Element base = null; 48 49 AuthInfo authInfo = null; 50 Vector tModel = new Vector (); 52 Vector uploadRegister = new Vector (); 54 55 61 public SaveTModel() { 62 } 63 64 69 public SaveTModel(String authInfo) { 70 this.authInfo = new AuthInfo( authInfo ); 71 } 72 73 83 public SaveTModel(Element base) throws UDDIException { 84 super(base); 86 NodeList nl = null; 87 nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG); 88 if (nl.getLength() > 0) { 89 authInfo = new AuthInfo((Element)nl.item(0)); 90 } 91 nl = getChildElementsByTagName(base, TModel.UDDI_TAG); 92 for (int i=0; i < nl.getLength(); i++) { 93 tModel.addElement(new TModel((Element)nl.item(i))); 94 } 95 nl = getChildElementsByTagName(base, UploadRegister.UDDI_TAG); 96 for (int i=0; i < nl.getLength(); i++) { 97 uploadRegister.addElement(new UploadRegister((Element)nl.item(i))); 98 } 99 } 100 101 public void setAuthInfo(AuthInfo s) { 102 authInfo = s; 103 } 104 public void setAuthInfo(String s) { 105 authInfo = new AuthInfo(); 106 authInfo.setText(s); 107 } 108 109 114 public void setTModelVector(Vector s) { 115 tModel = s; 116 } 117 118 123 public void setUploadRegisterVector(Vector s) { 124 uploadRegister = s; 125 } 126 127 132 public void setUploadRegisterStrings(Vector s) { 133 uploadRegister = new Vector (); 134 for (int i = 0; i < s.size(); i++) { 135 uploadRegister.addElement( new UploadRegister((String )s.elementAt(i)) ); 136 } 137 } 138 139 public AuthInfo getAuthInfo() { 140 return authInfo; 141 } 142 143 public String getAuthInfoString() { 144 return authInfo.getText(); 145 } 146 147 152 public Vector getTModelVector() { 153 return tModel; 154 } 155 156 161 public Vector getUploadRegisterVector() { 162 return uploadRegister; 163 } 164 165 170 public Vector getUploadRegisterStrings() { 171 Vector strings = new Vector (); 172 for (int i = 0; i < uploadRegister.size(); i++) { 173 strings.addElement( ((UploadRegister)uploadRegister.elementAt(i)).getText()); 174 } 175 return strings; 176 } 177 178 187 public void saveToXML(Element parent) { 188 base = parent.getOwnerDocument().createElement(UDDI_TAG); 189 base.setAttribute("generic", UDDIElement.GENERIC); 191 base.setAttribute("xmlns", UDDIElement.XMLNS); 192 if (authInfo!=null) { 193 authInfo.saveToXML(base); 194 } 195 if (tModel!=null) { 196 for (int i=0; i < tModel.size(); i++) { 197 ((TModel)(tModel.elementAt(i))).saveToXML(base); 198 } 199 } 200 if (uploadRegister!=null) { 201 for (int i=0; i < uploadRegister.size(); i++) { 202 ((UploadRegister)(uploadRegister.elementAt(i))).saveToXML(base); 203 } 204 } 205 parent.appendChild(base); 206 } 207 } 208 | Popular Tags |