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.assertion.PublisherAssertion; 16 import org.uddi4j.util.AuthInfo; 17 import org.w3c.dom.Element ; 18 import org.w3c.dom.NodeList ; 19 20 46 public class AddPublisherAssertions extends UDDIElement { 47 48 public static final String UDDI_TAG = "add_publisherAssertions"; 49 protected Element base = null; 50 51 AuthInfo authInfo = null; 52 Vector pubAssertion = new Vector (); 53 54 60 public AddPublisherAssertions() { 61 } 62 63 73 public AddPublisherAssertions(Element base) throws UDDIException { 74 super(base); 75 NodeList nl = null; 76 77 nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG); 78 if (nl.getLength() > 0) { 79 authInfo = new AuthInfo((Element)nl.item(0)); 80 } 81 nl = getChildElementsByTagName(base, PublisherAssertion.UDDI_TAG); 82 for (int i=0; i < nl.getLength(); i++) { 83 pubAssertion.addElement(new 84 PublisherAssertion((Element)nl.item(i))); 85 } 86 } 87 88 94 public AddPublisherAssertions(String authInfo, 95 Vector pubAssertVector) { 96 this.authInfo = new AuthInfo(); 97 this.authInfo.setText(authInfo); 98 this.pubAssertion = pubAssertVector; 99 } 100 101 public void setPublisherAssertionVector(Vector pubAssertVector ) { 102 this.pubAssertion = pubAssertVector; 103 } 104 105 public Vector getPublisherAssertionVector() { 106 return this.pubAssertion; 107 } 108 109 public AuthInfo getAuthInfo() { 110 return this.authInfo; 111 } 112 113 public void setAuthInfo(AuthInfo s) { 114 this.authInfo = s; 115 } 116 117 118 public String getAuthInfoString() { 119 return this.authInfo.getText(); 120 } 121 122 123 public void setAuthInfo(String s) { 124 authInfo = new AuthInfo(); 125 authInfo.setText(s); 126 } 127 128 129 138 public void saveToXML(Element parent) { 139 base = parent.getOwnerDocument().createElement(UDDI_TAG); 140 base.setAttribute("generic", UDDIElement.GENERIC); 142 base.setAttribute("xmlns", UDDIElement.XMLNS); 143 if (authInfo!=null) { 144 authInfo.saveToXML(base); 145 } 146 if (pubAssertion!=null) { 147 for (int i=0; i < pubAssertion.size(); i++) { 148 ((PublisherAssertion)(pubAssertion.elementAt(i))).saveToXML(base); 149 } 150 } 151 parent.appendChild(base); 152 153 } 154 } 155 156 | Popular Tags |