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.util.AuthInfo; 16 import org.uddi4j.util.BusinessKey; 17 import org.w3c.dom.Element ; 18 import org.w3c.dom.NodeList ; 19 20 44 public class DeleteBusiness extends UDDIElement { 45 public static final String UDDI_TAG = "delete_business"; 46 47 protected Element base = null; 48 49 AuthInfo authInfo = null; 50 Vector businessKey = new Vector (); 52 53 59 public DeleteBusiness() { 60 } 61 62 68 public DeleteBusiness(String authInfo, 69 Vector businessKeyStrings) { 70 this.authInfo = new AuthInfo( authInfo ); 71 Vector objects; 72 objects = new Vector (); 73 for (int i = 0; i < businessKeyStrings.size(); i++) { 74 objects.addElement( new BusinessKey((String )businessKeyStrings.elementAt(i)) ); 75 } 76 77 this.businessKey = objects; 78 } 79 80 90 public DeleteBusiness(Element base) throws UDDIException { 91 super(base); 93 NodeList nl = null; 94 nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG); 95 if (nl.getLength() > 0) { 96 authInfo = new AuthInfo((Element)nl.item(0)); 97 } 98 nl = getChildElementsByTagName(base, BusinessKey.UDDI_TAG); 99 for (int i=0; i < nl.getLength(); i++) { 100 businessKey.addElement(new BusinessKey((Element)nl.item(i))); 101 } 102 } 103 104 public void setAuthInfo(AuthInfo s) { 105 authInfo = s; 106 } 107 public void setAuthInfo(String s) { 108 authInfo = new AuthInfo(); 109 authInfo.setText(s); 110 } 111 112 117 public void setBusinessKeyVector(Vector s) { 118 businessKey = s; 119 } 120 121 126 public void setBusinessKeyStrings(Vector s) { 127 businessKey = new Vector (); 128 for (int i = 0; i < s.size(); i++) { 129 businessKey.addElement( new BusinessKey((String )s.elementAt(i)) ); 130 } 131 } 132 133 public AuthInfo getAuthInfo() { 134 return authInfo; 135 } 136 137 public String getAuthInfoString() { 138 if(authInfo!=null) 139 return authInfo.getText(); 140 else 141 return null; 142 } 143 144 149 public Vector getBusinessKeyVector() { 150 return businessKey; 151 } 152 153 158 public Vector getBusinessKeyStrings() { 159 Vector strings = new Vector (); 160 for (int i = 0; i < businessKey.size(); i++) { 161 strings.addElement( ((BusinessKey)businessKey.elementAt(i)).getText()); 162 } 163 return strings; 164 } 165 166 175 public void saveToXML(Element parent) { 176 base = parent.getOwnerDocument().createElement(UDDI_TAG); 177 base.setAttribute("generic", UDDIElement.GENERIC); 179 base.setAttribute("xmlns", UDDIElement.XMLNS); 180 if (authInfo!=null) { 181 authInfo.saveToXML(base); 182 } 183 if (businessKey!=null) { 184 for (int i=0; i < businessKey.size(); i++) { 185 ((BusinessKey)(businessKey.elementAt(i))).saveToXML(base); 186 } 187 } 188 parent.appendChild(base); 189 } 190 } 191 | Popular Tags |