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.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 42 public class TModelInstanceInfo extends UDDIElement { 43 public static final String UDDI_TAG = "tModelInstanceInfo"; 44 45 protected Element base = null; 46 47 String tModelKey = null; 48 InstanceDetails instanceDetails = null; 49 Vector description = new Vector (); 51 52 58 public TModelInstanceInfo() { 59 } 60 61 66 public TModelInstanceInfo(String tModelKey) { 67 this.tModelKey = tModelKey; 68 } 69 70 80 public TModelInstanceInfo(Element base) throws UDDIException { 81 super(base); 83 tModelKey = base.getAttribute("tModelKey"); 84 NodeList nl = null; 85 nl = getChildElementsByTagName(base, InstanceDetails.UDDI_TAG); 86 if (nl.getLength() > 0) { 87 instanceDetails = new InstanceDetails((Element)nl.item(0)); 88 } 89 nl = getChildElementsByTagName(base, Description.UDDI_TAG); 90 for (int i=0; i < nl.getLength(); i++) { 91 description.addElement(new Description((Element)nl.item(i))); 92 } 93 } 94 95 public void setTModelKey(String s) { 96 tModelKey = s; 97 } 98 99 public void setInstanceDetails(InstanceDetails s) { 100 instanceDetails = s; 101 } 102 103 108 public void setDescriptionVector(Vector s) { 109 description = s; 110 } 111 112 117 public void setDefaultDescriptionString(String s) { 118 if (description.size() > 0) { 119 description.setElementAt(new Description(s), 0); 120 } else { 121 description.addElement(new Description(s)); 122 } 123 } 124 125 public String getTModelKey() { 126 return tModelKey; 127 } 128 129 130 public InstanceDetails getInstanceDetails() { 131 return instanceDetails; 132 } 133 134 135 140 public Vector getDescriptionVector() { 141 return description; 142 } 143 144 149 public String getDefaultDescriptionString() { 150 if ((description).size() > 0) { 151 Description t = (Description)description.elementAt(0); 152 return t.getText(); 153 } else { 154 return null; 155 } 156 } 157 158 167 public void saveToXML(Element parent) { 168 base = parent.getOwnerDocument().createElement(UDDI_TAG); 169 if (tModelKey!=null) { 171 base.setAttribute("tModelKey", tModelKey); 172 } 173 if (description!=null) { 174 for (int i=0; i < description.size(); i++) { 175 ((Description)(description.elementAt(i))).saveToXML(base); 176 } 177 } 178 if (instanceDetails!=null) { 179 instanceDetails.saveToXML(base); 180 } 181 parent.appendChild(base); 182 } 183 } 184 | Popular Tags |