1 8 9 package org.uddi4j.datatype; 10 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIElement; 14 import org.uddi4j.UDDIException; 15 import org.w3c.dom.Element ; 16 import org.w3c.dom.NodeList ; 17 18 40 public class OverviewDoc extends UDDIElement { 41 public static final String UDDI_TAG = "overviewDoc"; 42 43 protected Element base = null; 44 45 OverviewURL overviewURL = null; 46 Vector description = new Vector (); 48 49 55 public OverviewDoc() { 56 } 57 58 68 public OverviewDoc(Element base) throws UDDIException { 69 super(base); 71 NodeList nl = null; 72 nl = getChildElementsByTagName(base, OverviewURL.UDDI_TAG); 73 if (nl.getLength() > 0) { 74 overviewURL = new OverviewURL((Element)nl.item(0)); 75 } 76 nl = getChildElementsByTagName(base, Description.UDDI_TAG); 77 for (int i=0; i < nl.getLength(); i++) { 78 description.addElement(new Description((Element)nl.item(i))); 79 } 80 } 81 82 public void setOverviewURL(OverviewURL s) { 83 overviewURL = s; 84 } 85 public void setOverviewURL(String s) { 86 overviewURL = new OverviewURL(); 87 overviewURL.setText(s); 88 } 89 90 95 public void setDescriptionVector(Vector s) { 96 description = s; 97 } 98 99 104 public void setDefaultDescriptionString(String s) { 105 if (description.size() > 0) { 106 description.setElementAt(new Description(s), 0); 107 } else { 108 description.addElement(new Description(s)); 109 } 110 } 111 112 public OverviewURL getOverviewURL() { 113 return overviewURL; 114 } 115 116 public String getOverviewURLString() { 117 if (overviewURL != null) { 118 return overviewURL.getText(); 119 } else { 120 return null; 121 } 122 } 123 124 129 public Vector getDescriptionVector() { 130 return description; 131 } 132 133 138 public String getDefaultDescriptionString() { 139 if ((description).size() > 0) { 140 Description t = (Description)description.elementAt(0); 141 return t.getText(); 142 } else { 143 return null; 144 } 145 } 146 147 156 public void saveToXML(Element parent) { 157 base = parent.getOwnerDocument().createElement(UDDI_TAG); 158 if (description!=null) { 160 for (int i=0; i < description.size(); i++) { 161 ((Description)(description.elementAt(i))).saveToXML(base); 162 } 163 } 164 if (overviewURL!=null) { 165 overviewURL.saveToXML(base); 166 } 167 parent.appendChild(base); 168 } 169 170 171 public boolean equals(Object object) 172 { 173 boolean result = false; 174 if (object != null && object instanceof OverviewDoc) 175 { 176 OverviewDoc otherOverviewDoc = (OverviewDoc)object; 177 if ((this.description == null && otherOverviewDoc.description == null) 178 || (this.description != null && this.description.equals(otherOverviewDoc.description))) 179 { 180 if ((this.overviewURL == null && otherOverviewDoc.overviewURL == null) 182 || (this.overviewURL != null && this.overviewURL.equals(otherOverviewDoc.overviewURL))) 183 { 184 result = true; 186 } 187 } 189 } 191 return result; 192 } 193 } 194 | Popular Tags |