KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > uddi4j > datatype > OverviewURL


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, International Business Machines Corporation
5  * All Rights Reserved.
6  *
7  */

8
9 package org.uddi4j.datatype;
10
11 import org.uddi4j.UDDIElement;
12 import org.uddi4j.UDDIException;
13 import org.w3c.dom.Element JavaDoc;
14
15 /**
16  * Represents the overviewURL element within the UDDI version 2.0 schema.
17  * This class contains the following types of methods:
18  *
19  * <ul>
20  * <li>Constructor passing the required fields.
21  * <li>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>For sets of attributes, a get/setVector method is provided.
25  * <li>SaveToXML method. Serializes this class within a passed in element.
26  * </ul>
27  *
28  * Typically, this class is used to construct parameters for, or interpret
29  * responses from, methods in the UDDIProxy class.
30  *
31  * @author David Melgar (dmelgar@us.ibm.com)
32  */

33 public class OverviewURL extends UDDIElement
34 {
35     public static final String JavaDoc UDDI_TAG = "overviewURL";
36
37     protected Element base = null;
38
39     String JavaDoc text = null;
40
41     /**
42       * Default constructor.
43       * Avoid using the default constructor for validation. It does not validate
44       * required fields. Instead, use the required fields constructor to perform
45       * validation.
46       */

47     public OverviewURL()
48     {
49     }
50
51     /**
52      * Construct the object using required fields.
53      *
54      * @param value String value
55      */

56     public OverviewURL(String JavaDoc value)
57     {
58         setText(value);
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      * @exception UDDIException Thrown if DOM tree contains a SOAP fault
68      * or a disposition report indicating a UDDI error.
69      */

70     public OverviewURL(Element base) throws UDDIException
71     {
72         // Check if it is a fault. Throws an exception if it is.
73
super(base);
74         text = getText(base);
75     }
76
77     public void setText(String JavaDoc s)
78     {
79         text = s;
80     }
81
82     public String JavaDoc getText()
83     {
84         return text;
85     }
86
87     /**
88      * Save object to DOM tree. Used to serialize object
89      * to a DOM tree, usually to send a UDDI message.
90      *
91      * <BR>Used by UDDIProxy.
92      *
93      * @param parent Object will serialize as a child element under the
94      * passed in parent element.
95      */

96     public void saveToXML(Element parent)
97     {
98         base = parent.getOwnerDocument().createElement(UDDI_TAG);
99         // Save attributes.
100
if (text != null)
101         {
102             base.appendChild(parent.getOwnerDocument().createTextNode(text));
103         }
104         parent.appendChild(base);
105     }
106
107     public boolean equals(Object JavaDoc object)
108     {
109         boolean result = false;
110         if (object != null && object instanceof OverviewURL)
111         {
112             OverviewURL otherOverviewURL = (OverviewURL) object;
113             if ((this.text == null && otherOverviewURL.text == null)
114             || (this.text != null && this.text.equals(otherOverviewURL.text)))
115             {
116                 //text matches - objects are equal.
117
result = true;
118             }
119             //else text does not match - result is false.
120
}
121         return result;
122     }
123 }
124
Popular Tags