KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > uddi4j > response > AssertionStatusReport


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.response;
10
11 import java.util.Vector JavaDoc;
12
13 import org.uddi4j.UDDIElement;
14 import org.uddi4j.UDDIException;
15 import org.w3c.dom.Element JavaDoc;
16 import org.w3c.dom.NodeList JavaDoc;
17
18 /**
19  * Represents the assertionStatusReport element within the UDDI version 2.0 schema.
20  * This class contains the following types of methods:
21  *
22  * <ul>
23  * <li>A constructor that passes the required fields.
24  * <li>A Constructor that will instantiate the object from an appropriate XML
25  * DOM element.
26  * <li>Get/set methods for each attribute that this element can contain.
27  * <li>A get/setVector method is provided for sets of attributes.
28  * <li>A SaveToXML method that serializes this class within a passed in
29  * element.
30  * </ul>
31  *
32  * Typically, this class is used to construct parameters for, or interpret
33  * responses from, methods in the UDDIProxy class.
34  *
35  * <p><b>Element description:</b>
36  * <p>This class returns all complete and incomplete assertions. It also provides
37  * some administrative functions, such as, determining if there are outstanding
38  * or incomplete assertions about relationships between the publisher account
39  * and associated businesses.
40  *
41  * @author Mahesh C S (csmahesh@india.hp.com)
42  */

43 public class AssertionStatusReport extends UDDIElement {
44    public static final String JavaDoc UDDI_TAG = "assertionStatusReport";
45
46    protected Element base = null;
47
48    String JavaDoc operator = null;
49
50    // Vector of AssertionStatusItem objects
51
Vector JavaDoc assertionStatusItem = new Vector JavaDoc();
52
53
54    /**
55     * Default constructor.
56     * Avoid using the default constructor for validation. It does not validate
57     * required fields. Instead, use the required fields constructor to perform
58     * validation.
59     */

60
61    public AssertionStatusReport() {
62    }
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
76    public AssertionStatusReport(Element base) throws UDDIException {
77        // Check if it is a fault. Throws an exception if it is.
78
super(base);
79        operator = base.getAttribute("operator");
80        NodeList JavaDoc nl = null;
81        nl = getChildElementsByTagName(base, AssertionStatusItem.UDDI_TAG);
82        for (int i=0; i < nl.getLength(); i++) {
83            assertionStatusItem.addElement(new AssertionStatusItem((Element)nl.item(i)));
84        }
85    }
86
87    public String JavaDoc getOperator() {
88        return operator;
89    }
90
91    public void setOperator(String JavaDoc s) {
92        operator = s;
93    }
94
95    /**
96     * Get assertionStatusItem vector
97     *
98     * @return Vector of <I>AssertionStatusItem</I> objects.
99     */

100    public Vector JavaDoc getAssertionStatusItemVector() {
101        return assertionStatusItem;
102    }
103
104    /**
105     * Set assertionStatusItem vector
106     *
107     * @param v Vector of <I>AssertionStatusItem</I> objects.
108     */

109    public void setAssertionStatusItemVector(Vector JavaDoc v) {
110        assertionStatusItem = v;
111    }
112
113
114    /**
115     * Save an object to the DOM tree. Used to serialize an object
116     * to a DOM tree, usually to send a UDDI message.
117     *
118     * <BR>Used by UDDIProxy.
119     *
120     * @param parent Object will serialize as a child element under the
121     * passed in parent element.
122     */

123
124    public void saveToXML(Element parent) {
125        base = parent.getOwnerDocument().createElement(UDDI_TAG);
126        // Save attributes
127
base.setAttribute("generic", UDDIElement.GENERIC);
128        base.setAttribute("xmlns", UDDIElement.XMLNS);
129        if (operator!=null) {
130           base.setAttribute("operator", operator);
131        }
132        if (assertionStatusItem!=null) {
133           for (int i=0; i < assertionStatusItem.size(); i++) {
134              ((AssertionStatusItem)(assertionStatusItem.elementAt(i))).saveToXML(base);
135           }
136        }
137        parent.appendChild(base);
138    }
139 }
140
Popular Tags