1 8 9 package org.uddi4j.response; 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.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 43 public class PublisherAssertions extends UDDIElement { 44 public static final String UDDI_TAG = "publisherAssertions"; 45 46 protected Element base = null; 47 48 String operator = null; 49 String authorizedName = null; 50 Vector publisherAssertion = new Vector (); 52 53 54 60 61 public PublisherAssertions() { 62 } 63 64 65 75 76 public PublisherAssertions(Element base) throws UDDIException { 77 super(base); 79 operator = base.getAttribute("operator"); 80 authorizedName = base.getAttribute("authorizedName"); 81 NodeList nl = null; 82 nl = getChildElementsByTagName(base, PublisherAssertion.UDDI_TAG); 83 for (int i=0; i < nl.getLength(); i++) { 84 publisherAssertion.addElement(new PublisherAssertion((Element)nl.item(i))); 85 } 86 } 87 88 95 public PublisherAssertions(String operator, String name, 96 Vector publishAssertion) throws UDDIException { 97 this.operator = operator; 98 this.authorizedName = name; 99 this.publisherAssertion = publishAssertion; 100 } 101 102 public String getAuthorizedName() { 103 return authorizedName; 104 } 105 106 public void setAuthorizedName(String name) { 107 authorizedName = name; 108 } 109 110 public String getOperator() { 111 return operator; 112 } 113 114 public void setOperator(String s) { 115 operator = s; 116 } 117 118 123 public void setPublisherAssertionVector(Vector s) { 124 publisherAssertion = s; 125 } 126 127 132 public Vector getPublisherAssertionVector() { 133 return publisherAssertion; 134 } 135 136 140 public void add (PublisherAssertion p) { 141 publisherAssertion.add (p); 142 } 143 144 150 public boolean remove (PublisherAssertion p) { 151 return publisherAssertion.remove (p); 152 } 153 154 159 public PublisherAssertion get (int index) { 160 return (PublisherAssertion) publisherAssertion.get (index); 161 } 162 163 167 public int size () { 168 return publisherAssertion.size (); 169 } 170 171 172 181 182 public void saveToXML(Element parent) { 183 base = parent.getOwnerDocument().createElement(UDDI_TAG); 184 base.setAttribute("generic", UDDIElement.GENERIC); 186 base.setAttribute("xmlns", UDDIElement.XMLNS); 187 if (operator!=null) { 188 base.setAttribute("operator", operator); 189 } 190 if (authorizedName!=null) { 191 base.setAttribute("authorizedName", authorizedName); 192 } 193 if (publisherAssertion!=null) { 194 for (int i=0; i < publisherAssertion.size(); i++) { 195 ((PublisherAssertion)(publisherAssertion.elementAt(i))).saveToXML(base); 196 } 197 } 198 parent.appendChild(base); 199 } 200 } 201 | Popular Tags |