1 8 9 package org.uddi4j.datatype.binding; 10 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIElement; 14 import org.uddi4j.UDDIException; 15 import org.uddi4j.datatype.Description; 16 import org.uddi4j.datatype.OverviewDoc; 17 import org.w3c.dom.Element ; 18 import org.w3c.dom.NodeList ; 19 20 42 public class InstanceDetails extends UDDIElement { 43 public static final String UDDI_TAG = "instanceDetails"; 44 45 protected Element base = null; 46 47 OverviewDoc overviewDoc = null; 48 InstanceParms instanceParms = null; 49 Vector description = new Vector (); 51 52 58 public InstanceDetails() { 59 } 60 61 71 public InstanceDetails(Element base) throws UDDIException { 72 super(base); 74 NodeList nl = null; 75 nl = getChildElementsByTagName(base, OverviewDoc.UDDI_TAG); 76 if (nl.getLength() > 0) { 77 overviewDoc = new OverviewDoc((Element)nl.item(0)); 78 } 79 nl = getChildElementsByTagName(base, InstanceParms.UDDI_TAG); 80 if (nl.getLength() > 0) { 81 instanceParms = new InstanceParms((Element)nl.item(0)); 82 } 83 nl = getChildElementsByTagName(base, Description.UDDI_TAG); 84 for (int i=0; i < nl.getLength(); i++) { 85 description.addElement(new Description((Element)nl.item(i))); 86 } 87 } 88 89 public void setOverviewDoc(OverviewDoc s) { 90 overviewDoc = s; 91 } 92 93 public void setInstanceParms(InstanceParms s) { 94 instanceParms = s; 95 } 96 97 102 public void setDescriptionVector(Vector s) { 103 description = s; 104 } 105 106 111 public void setDefaultDescriptionString(String s) { 112 if (description.size() > 0) { 113 description.setElementAt(new Description(s), 0); 114 } else { 115 description.addElement(new Description(s)); 116 } 117 } 118 119 public OverviewDoc getOverviewDoc() { 120 return overviewDoc; 121 } 122 123 124 public InstanceParms getInstanceParms() { 125 return instanceParms; 126 } 127 128 129 134 public Vector getDescriptionVector() { 135 return description; 136 } 137 138 143 public String getDefaultDescriptionString() { 144 if ((description).size() > 0) { 145 Description t = (Description)description.elementAt(0); 146 return t.getText(); 147 } else { 148 return null; 149 } 150 } 151 152 161 public void saveToXML(Element parent) { 162 base = parent.getOwnerDocument().createElement(UDDI_TAG); 163 if (description!=null) { 165 for (int i=0; i < description.size(); i++) { 166 ((Description)(description.elementAt(i))).saveToXML(base); 167 } 168 } 169 if (overviewDoc!=null) { 170 overviewDoc.saveToXML(base); 171 } 172 if (instanceParms!=null) { 173 instanceParms.saveToXML(base); 174 } 175 parent.appendChild(base); 176 } 177 } 178 | Popular Tags |