KickJava   Java API By Example, From Geeks To Geeks.

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


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.response;
10
11 import org.uddi4j.UDDIElement;
12 import org.uddi4j.UDDIException;
13 import org.uddi4j.datatype.business.BusinessEntity;
14 import org.w3c.dom.Element JavaDoc;
15 import org.w3c.dom.NodeList JavaDoc;
16
17 /**
18  * Represents the businessEntityExt element within the UDDI version 2.0 schema.
19  * This class contains the following types of methods:
20  *
21  * <ul>
22  * <li>A constructor that passes the required fields.
23  * <li>A Constructor that will instantiate the object from an appropriate XML
24  * DOM element.
25  * <li>Get/set methods for each attribute that this element can contain.
26  * <li>A get/setVector method is provided for sets of attributes.
27  * <li>A SaveToXML method that serializes this class within a passed in
28  * element.
29  * </ul>
30  *
31  * Typically, this class is used to construct parameters for, or interpret
32  * responses from, methods in the UDDIProxy class.
33  *
34  * <p><b>Element description:</b>
35  * <p>This structure is the container for safely extending the businessEntity
36  * information in private implementations of UDDI compatible registries.
37  * Official operator nodes may not provide extended data but must return
38  * a properly populated businessEntity structure within this container, when
39  * responding to a get_businessDetailExt message.
40  *
41  * @author David Melgar (dmelgar@us.ibm.com)
42  */

43 public class BusinessEntityExt extends UDDIElement {
44    public static final String JavaDoc UDDI_TAG = "businessEntityExt";
45
46    protected Element base = null;
47
48    BusinessEntity businessEntity = null;
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 BusinessEntityExt() {
58    }
59
60    /**
61     * Construct the object with required fields.
62     *
63     * @param businessEntity businessEntity object
64     */

65    public BusinessEntityExt(BusinessEntity businessEntity) {
66       this.businessEntity = businessEntity;
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 BusinessEntityExt(Element base) throws UDDIException {
81       // Check if it is a fault. Throws an exception if it is.
82
super(base);
83       NodeList JavaDoc nl = null;
84       nl = getChildElementsByTagName(base, BusinessEntity.UDDI_TAG);
85       if (nl.getLength() > 0) {
86          businessEntity = new BusinessEntity((Element)nl.item(0));
87       }
88    }
89
90    public void setBusinessEntity(BusinessEntity s) {
91       businessEntity = s;
92    }
93
94    public BusinessEntity getBusinessEntity() {
95       return businessEntity;
96    }
97
98
99    /**
100     * Save an object to the DOM tree. Used to serialize an object
101     * to a DOM tree, usually to send a UDDI message.
102     *
103     * <BR>Used by UDDIProxy.
104     *
105     * @param parent Object will serialize as a child element under the
106     * passed in parent element.
107     */

108
109    public void saveToXML(Element parent) {
110       base = parent.getOwnerDocument().createElement(UDDI_TAG);
111       // Save attributes
112
if (businessEntity!=null) {
113          businessEntity.saveToXML(base);
114       }
115       parent.appendChild(base);
116    }
117 }
118
Popular Tags