KickJava   Java API By Example, From Geeks To Geeks.

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


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.uddi4j.util.FromKey;
14 import org.uddi4j.util.KeyedReference;
15 import org.uddi4j.util.ToKey;
16 import org.w3c.dom.Element JavaDoc;
17 import org.w3c.dom.NodeList JavaDoc;
18
19 /**
20  * Represents the assertionStatusItem element within the UDDI version 2.0 schema.
21  * This class contains the following types of methods:
22  *
23  * <ul>
24  * <li>A constructor that passes the required fields.
25  * <li>A Constructor that will instantiate the object from an appropriate XML
26  * DOM element.
27  * <li>Get/set methods for each attribute that this element can contain.
28  * <li>A get/setVector method is provided for sets of attributes.
29  * <li>A SaveToXML method that serializes this class within a passed in
30  * element.
31  * </ul>
32  *
33  * Typically, this class is used to construct parameters for, or interpret
34  * responses from, methods in the UDDIProxy class.
35  *
36  * <p><b>Element description:</b>
37  *
38  * <p>Zero or more assertionStatusItem structures form an AssertionStatus Report.
39  * This report is obtained in response to a get_assertionStatusReport inquiry
40  * message. This report contains the elements fromKey, toKey and keyedReference.
41  * These combined elements identify the assertion that is the subject of the report.
42  * The keysOwned element designates those businessKeys the publisher manages.
43  *
44  * @author Mahesh C S (csmahesh@india.hp.com)
45  */

46 public class AssertionStatusItem extends UDDIElement {
47    public static final String JavaDoc UDDI_TAG = "assertionStatusItem";
48
49    protected Element base = null;
50
51    FromKey fromKey = null;
52    ToKey toKey = null;
53    KeyedReference keyedReference = null;
54    KeysOwned keysOwned = null;
55    CompletionStatus completionStatus = null;
56
57
58    /**
59     * Default constructor.
60     * Avoid using the default constructor for validation. It does not validate
61     * required fields. Instead, use the required fields constructor to perform
62     * validation.
63     */

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

79
80    public AssertionStatusItem(Element base) throws UDDIException {
81        // Check if it is a fault. Throws an exception if it is.
82
super(base);
83        completionStatus = new CompletionStatus();
84        completionStatus.setText(base.getAttribute("completionStatus"));
85        NodeList JavaDoc nl = null;
86        nl = getChildElementsByTagName(base, FromKey.UDDI_TAG);
87        if (nl.getLength() > 0) {
88           fromKey = new FromKey((Element)nl.item(0));
89        }
90        nl = getChildElementsByTagName(base, ToKey.UDDI_TAG);
91        if (nl.getLength() > 0) {
92           toKey = new ToKey((Element)nl.item(0));
93        }
94        nl = getChildElementsByTagName(base, KeyedReference.UDDI_TAG);
95        if (nl.getLength() > 0) {
96           keyedReference = new KeyedReference((Element)nl.item(0));
97        }
98        nl = getChildElementsByTagName(base, KeysOwned.UDDI_TAG);
99        if (nl.getLength() > 0) {
100           keysOwned = new KeysOwned((Element)nl.item(0));
101        }
102    }
103
104    /**
105     * Construct the object with required fields.
106     *
107     * @param fromKey String
108     * @param toKey String
109     * @param ref KeyedReference
110     * @param keys KeysOwned
111     */

112    public AssertionStatusItem(String JavaDoc fromKey, String JavaDoc toKey,
113                               KeyedReference ref, KeysOwned keys) {
114         this.fromKey = new FromKey(fromKey);
115         this.toKey = new ToKey(toKey);
116         this.keyedReference = ref;
117         this.keysOwned = keys;
118    }
119
120    public String JavaDoc getFromKeyString() {
121        return fromKey.getText();
122    }
123
124    public void setFromKeyString(String JavaDoc s) {
125        fromKey = new FromKey();
126        fromKey.setText(s);
127    }
128
129    public String JavaDoc getToKeyString() {
130        return toKey.getText();
131    }
132
133    public void setToKeyString(String JavaDoc s) {
134        toKey = new ToKey();
135        toKey.setText(s);
136    }
137
138    public FromKey getFromKey() {
139        return fromKey;
140    }
141
142    public void setFromKey(FromKey key) {
143        fromKey = key;
144    }
145
146    public ToKey getToKey() {
147        return toKey;
148    }
149
150    public void setToKey(ToKey key) {
151        toKey = key;
152    }
153
154    public KeyedReference getKeyedReference() {
155        return keyedReference;
156    }
157
158    public void setKeyedReference(KeyedReference r) {
159        keyedReference = r;
160    }
161
162    public KeysOwned getKeysOwned() {
163        return keysOwned;
164    }
165
166    public void setKeysOwned(KeysOwned k) {
167        keysOwned = k;
168    }
169
170    public CompletionStatus getCompletionStatus() {
171        return completionStatus;
172    }
173
174    public void setCompletionStatus(CompletionStatus status) {
175        completionStatus = status;
176    }
177
178
179    /**
180     * Save an object to the DOM tree. Used to serialize an object
181     * to a DOM tree, usually to send a UDDI message.
182     *
183     * <BR>Used by UDDIProxy.
184     *
185     * @param parent Object will serialize as a child element under the
186     * passed in parent element.
187     */

188
189    public void saveToXML(Element parent) {
190        base = parent.getOwnerDocument().createElement(UDDI_TAG);
191        // Save attributes
192
if (completionStatus!=null) {
193           base.setAttribute("completionStatus", completionStatus.getText());
194        }
195        if (fromKey!=null) {
196           fromKey.saveToXML(base);
197        }
198        if (toKey!=null) {
199           toKey.saveToXML(base);
200        }
201        if (keyedReference!=null) {
202           keyedReference.saveToXML(base);
203        }
204        if (keysOwned!=null) {
205           keysOwned.saveToXML(base);
206        }
207
208        parent.appendChild(base);
209    }
210 }
211
Popular Tags