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 50 public class SetPublisherAssertions extends UDDIElement { 51 52 public static final String UDDI_TAG = "set_publisherAssertions"; 53 protected Element base = null; 54 55 AuthInfo authInfo = null; 56 Vector pubAssertion = new Vector (); 57 58 64 public SetPublisherAssertions() { 65 } 66 67 77 public SetPublisherAssertions(Element base) throws UDDIException { 78 super(base); 80 NodeList nl = null; 81 nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG); 82 if (nl.getLength() > 0) { 83 authInfo = new AuthInfo((Element)nl.item(0)); 84 } 85 nl = getChildElementsByTagName(base, PublisherAssertion.UDDI_TAG); 86 87 for (int i=0; i < nl.getLength(); i++) { 88 pubAssertion.addElement(new PublisherAssertion((Element)nl.item(i))); 89 } 90 } 91 92 98 public SetPublisherAssertions(String authInfo, Vector pubAssertVector) { 99 this.authInfo = new AuthInfo(); 100 this.authInfo.setText(authInfo); 101 this.pubAssertion = pubAssertVector; 102 } 103 104 public void setPublisherAssertionVector(Vector pubAssertVector ) { 105 this.pubAssertion = pubAssertVector; 106 } 107 108 public Vector getPublisherAssertionVector() { 109 return this.pubAssertion; 110 } 111 112 public AuthInfo getAuthInfo() { 113 return this.authInfo; 114 } 115 116 public void setAuthInfo(AuthInfo s) { 117 this.authInfo = s; 118 } 119 120 public String getAuthInfoString() { 121 if(authInfo!=null) 122 return this.authInfo.getText(); 123 else 124 return null; 125 } 126 127 public void setAuthInfo(String s) { 128 authInfo = new AuthInfo(); 129 authInfo.setText(s); 130 } 131 132 141 public void saveToXML(Element parent) { 142 base = parent.getOwnerDocument().createElement(UDDI_TAG); 143 base.setAttribute("generic", UDDIElement.GENERIC); 145 base.setAttribute("xmlns", UDDIElement.XMLNS); 146 if (authInfo!=null) { 147 authInfo.saveToXML(base); 148 } 149 if (pubAssertion!=null) { 150 for (int i=0; i < pubAssertion.size(); i++) { 151 ((PublisherAssertion)(pubAssertion.elementAt(i))).saveToXML(base); 152 } 153 } 154 parent.appendChild(base); 155 } 156 } 157 | Popular Tags |