KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > uddi4j > request > DeletePublisherAssertions


1 /*
2  * The source code contained herein is licensed under the IBM Public License
3  * Version 1.0, which has been approved by the Open Source Initiative.
4  * Copyright (C) 2001, Hewlett-Packard Company
5  * All Rights Reserved.
6  *
7  */

8
9 package org.uddi4j.request;
10
11 import java.util.Vector JavaDoc;
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 JavaDoc;
18 import org.w3c.dom.NodeList JavaDoc;
19
20 /**
21  * Represents the delete_publisherAssertions element within the UDDI version 2.0 schema.
22  * This class contains the following types of methods:
23  *
24  * <ul>
25  * <li>A constructor that passes the required fields.
26  * <li>A Constructor that will instantiate the object from an appropriate XML
27  * DOM element.
28  * <li>Get/set methods for each attribute that this element can contain.
29  * <li>A get/setVector method is provided for sets of attributes.
30  * <li>A SaveToXML method that serializes this class within a passed in
31  * element.
32  * </ul>
33  *
34  * Typically, this class is used to construct parameters for, or interpret
35  * responses from, methods in the UDDIProxy class.
36  *
37  * <p><b>Element description:</b>
38  * <p>Used to delete specific publisher assertions from the assertion collection controlled by a particular
39  * publisher account. Deleting the assertion collection will affect the visibility of assertions from the
40  * business relationships. Deleting an assertion will cause any relationships based on that assertion to be
41  * invalidated.
42  *
43  * @author Mahesh C S (csmahesh@india.hp.com)
44  * @author Ozzy (ozzy@hursley.ibm.com)
45  */

46 public class DeletePublisherAssertions extends UDDIElement {
47     public static final String JavaDoc UDDI_TAG = "delete_publisherAssertions";
48
49     protected Element base = null;
50
51     AuthInfo authInfo = null;
52
53     Vector JavaDoc publisherAssertionVector = new Vector JavaDoc();
54
55
56    /**
57     * Default constructor.
58     * Avoid using the default constructor for validation. It does not validate
59     * required fields. Instead, use the required fields constructor to perform
60     * validation.
61     */

62    public DeletePublisherAssertions() {
63    }
64
65    /**
66     * Construct the object from a DOM tree. Used by
67     * UDDIProxy to construct an object from a received UDDI
68     * message.
69     *
70     * @param base Element with the name appropriate for this class.
71     *
72     * @exception UDDIException Thrown if DOM tree contains a SOAP fault
73     * or a disposition report indicating a UDDI error.
74     */

75    public DeletePublisherAssertions(Element base) throws UDDIException {
76       // Check if it is a fault. Throws an exception if it is.
77
super(base);
78        NodeList JavaDoc nl = null;
79        nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG);
80        if (nl.getLength() > 0) {
81           authInfo = new AuthInfo((Element)nl.item(0));
82        }
83        nl = getChildElementsByTagName(base, PublisherAssertion.UDDI_TAG);
84        for (int i=0; i < nl.getLength(); i++) {
85           publisherAssertionVector.addElement(new PublisherAssertion((Element)nl.item(i)));
86       }
87    }
88
89    /**
90     * Construct the object with required fields.
91     *
92     * @param authInfo String
93     * @param pubAssertVector Vector
94     */

95    public DeletePublisherAssertions(String JavaDoc authInfo,
96                                     Vector JavaDoc pubAssertVector) throws UDDIException {
97        this.authInfo = new AuthInfo( authInfo );
98        Vector JavaDoc objects;
99        objects = new Vector JavaDoc();
100        for (int i = 0; i < pubAssertVector.size(); i++) {
101            objects.addElement( new PublisherAssertion((Element)pubAssertVector.elementAt(i)));
102        }
103
104        this.publisherAssertionVector = objects;
105
106    }
107
108    /**
109     * Set PublisherAssertion vector
110     *
111     * @param pubAssertVector Vector of <I>PublisherAssertion</I> objects.
112     */

113    public void setPublisherAssertionVector(Vector JavaDoc pubAssertVector ) {
114        publisherAssertionVector = pubAssertVector;
115    }
116
117    /**
118     * Get PublisherAssertion vector
119     *
120     * @return Vector of <I>PublisherAssertion</I> objects.
121     */

122    public Vector JavaDoc getPublisherAssertionVector() {
123        return publisherAssertionVector;
124    }
125
126    public AuthInfo getAuthInfo() {
127        return authInfo;
128    }
129
130    public void setAuthInfo(AuthInfo s) {
131        authInfo = s;
132    }
133
134    public String JavaDoc getAuthInfoString() {
135        if(authInfo!=null)
136          return authInfo.getText();
137        else
138          return null;
139    }
140
141    public void setAuthInfo(String JavaDoc s) {
142        authInfo = new AuthInfo();
143        authInfo.setText(s);
144    }
145
146    /**
147     * Save an object to the DOM tree. Used to serialize an object
148     * to a DOM tree, usually to send a UDDI message.
149     *
150     * <BR>Used by UDDIProxy.
151     *
152     * @param parent Object will serialize as a child element under the
153     * passed in parent element.
154     */

155    public void saveToXML(Element parent) {
156        base = parent.getOwnerDocument().createElement(UDDI_TAG);
157        // Save attributes.
158
base.setAttribute("generic", UDDIElement.GENERIC);
159        base.setAttribute("xmlns", UDDIElement.XMLNS);
160        if (authInfo!=null) {
161           authInfo.saveToXML(base);
162        }
163        if (publisherAssertionVector!=null) {
164          for (int i=0; i < publisherAssertionVector.size(); i++) {
165             ((PublisherAssertion)(publisherAssertionVector.elementAt(i))).saveToXML(base);
166          }
167        }
168        parent.appendChild(base);
169    }
170 }
171
Popular Tags