KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.uddi4j.UDDIElement;
12 import org.uddi4j.UDDIException;
13 import org.uddi4j.response.CompletionStatus;
14 import org.uddi4j.util.AuthInfo;
15 import org.w3c.dom.Element JavaDoc;
16 import org.w3c.dom.NodeList JavaDoc;
17
18 /**
19  * Represents the get_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
38  * outstanding, or incomplete assertions about relationships between
39  * the publisher account and associated businesses.
40  *
41  * @author Mahesh C S (csmahesh@india.hp.com)
42  * @author Ozzy (ozzy@hursley.ibm.com)
43  */

44 public class GetAssertionStatusReport extends UDDIElement {
45    public static final String JavaDoc UDDI_TAG = "get_assertionStatusReport";
46
47    protected Element base = null;
48
49    AuthInfo authInfo = null;
50
51    CompletionStatus completionStatus = null;
52
53    /**
54     * Default constructor.
55     * Avoid using the default constructor for validation. It does not validate
56     * required fields. Instead, use the required fields constructor to perform
57     * validation.
58     */

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

72    public GetAssertionStatusReport(Element base) throws UDDIException {
73        // Check if it is a fault. Throws an exception if it is.
74
super(base);
75        NodeList JavaDoc nl = null;
76        nl = getChildElementsByTagName(base, AuthInfo.UDDI_TAG);
77        if (nl.getLength() > 0) {
78           authInfo = new AuthInfo((Element)nl.item(0));
79        }
80        if (nl.getLength() > 0) {
81           completionStatus = new CompletionStatus((Element)nl.item(0));
82        }
83    }
84
85    /**
86     * Construct the object with required fields.
87     *
88     * @param authInfo String
89     */

90    public GetAssertionStatusReport(String JavaDoc authInfo) {
91        this.authInfo = new AuthInfo(authInfo);
92    }
93
94    /**
95     * Construct the object with required fields.
96     *
97     * @param authInfo String
98     * @param completion String
99     */

100    public GetAssertionStatusReport(String JavaDoc authInfo,
101                                    String JavaDoc completion) {
102        this.authInfo = new AuthInfo(authInfo);
103        this.completionStatus = new CompletionStatus();
104        this.completionStatus.setText(completion);
105    }
106
107    /**
108     * Construct the object with required fields.
109     *
110     * @param authInfo String
111     * @param completion CompletionStatus
112     */

113    public GetAssertionStatusReport(String JavaDoc authInfo,
114                                    CompletionStatus completion) {
115        this.authInfo = new AuthInfo(authInfo);
116        this.completionStatus = completion;
117    }
118
119    public CompletionStatus getCompletionStatus() {
120        return completionStatus;
121    }
122
123    public void setCompletionStatus(CompletionStatus status) {
124        completionStatus = status;
125    }
126
127    public String JavaDoc getCompletionStatusString() {
128        if(completionStatus!=null)
129          return completionStatus.getText();
130        else
131          return null;
132    }
133
134    public void setCompletionStatusString(String JavaDoc s) {
135        completionStatus = new CompletionStatus();
136        completionStatus.setText(s);
137    }
138
139    public AuthInfo getAuthInfo() {
140        return authInfo;
141    }
142
143    public void setAuthInfo(AuthInfo s) {
144        authInfo = s;
145    }
146
147    public String JavaDoc getAuthInfoString() {
148        if(authInfo != null)
149          return authInfo.getText();
150        else
151          return null;
152    }
153
154    public void setAuthInfo(String JavaDoc s) {
155        authInfo = new AuthInfo();
156        authInfo.setText(s);
157    }
158
159    /**
160     * Save an object to the DOM tree. Used to serialize an object
161     * to a DOM tree, usually to send a UDDI message.
162     *
163     * <BR>Used by UDDIProxy.
164     *
165     * @param parent Object will serialize as a child element under the
166     * passed in parent element.
167     */

168    public void saveToXML(Element parent) {
169        base = parent.getOwnerDocument().createElement(UDDI_TAG);
170        // Save attributes.
171
base.setAttribute("generic", UDDIElement.GENERIC);
172        base.setAttribute("xmlns", UDDIElement.XMLNS);
173        if (authInfo!=null) {
174           authInfo.saveToXML(base);
175        }
176        if (completionStatus!=null) {
177           completionStatus.saveToXML(base);
178        }
179
180        parent.appendChild(base);
181    }
182 }
183
Popular Tags