KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.uddi4j.UDDIElement;
12 import org.uddi4j.UDDIException;
13 import org.w3c.dom.Element JavaDoc;
14
15 /**
16  * Represents the completionStatus element within the UDDI version 2.0 schema.
17  * This class contains the following types of methods:
18  *
19  * <ul>
20  * <li>A constructor that passes the required fields.
21  * <li>A Constructor that will instantiate the object from an appropriate XML
22  * DOM element.
23  * <li>Get/set methods for each attribute that this element can contain.
24  * <li>A get/setVector method is provided for sets of attributes.
25  * <li>A SaveToXML method that serializes this class within a passed in
26  * element.
27  * </ul>
28  *
29  * Typically, this class is used to construct parameters for, or interpret
30  * responses from, methods in the UDDIProxy class.
31  *
32  * <p><b>Element description:</b>
33  * <p>This class is used to express the status of publisher assertions.
34  * For example <I>status:complete</I> means the publisher assertions are complete.
35  *
36  * @author Mahesh C S (csmahesh@india.hp.com)
37  */

38 public class CompletionStatus extends UDDIElement {
39    public static final String JavaDoc UDDI_TAG = "completionStatus";
40
41    public static final String JavaDoc COMPLETE = "status:complete";
42    public static final String JavaDoc TOKEY_INCOMPLETE= "status:toKey_incomplete";
43    public static final String JavaDoc FROMKEY_INCOMPLETE = "status:fromKey_incomplete";
44
45    protected Element base = null;
46
47    String JavaDoc text = null;
48
49
50    /**
51     * Default constructor.
52     * Avoid using the default constructor for validation. It does not validate
53     * required fields. Instead, use the required fields constructor to perform
54     * validation.
55     */

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

71
72    public CompletionStatus(Element base) throws UDDIException {
73        super(base);
74        text = getText(base);
75    }
76
77    /**
78     * Construct the object with required fields.
79     *
80     * @param status String
81     */

82    public CompletionStatus(String JavaDoc status) {
83        setText(status);
84    }
85
86    public String JavaDoc getText() {
87        return text;
88    }
89
90    public void setText(String JavaDoc status) {
91        text = status;
92    }
93
94    /**
95     * Save an object to the DOM tree. Used to serialize an object
96     * to a DOM tree, usually to send a UDDI message.
97     *
98     * <BR>Used by UDDIProxy.
99     *
100     * @param parent Object will serialize as a child element under the
101     * passed in parent element.
102     */

103
104    public void saveToXML(Element parent) {
105        base = parent.getOwnerDocument().createElement(UDDI_TAG);
106
107        if (text!=null) {
108           base.appendChild(parent.getOwnerDocument().createTextNode(text));
109        }
110        parent.appendChild(base);
111    }
112 }
113
Popular Tags