1 8 9 package org.uddi4j.util; 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 41 public class TModelBag extends UDDIElement { 42 public static final String UDDI_TAG = "tModelBag"; 43 44 protected Element base = null; 45 46 Vector tModelKey = new Vector (); 48 49 55 public TModelBag() { 56 } 57 58 63 public TModelBag(Vector tModelKeyStrings) { 64 Vector objects; 65 objects = new Vector (); 66 for (int i = 0; i < tModelKeyStrings.size(); i++) { 67 objects.addElement( new TModelKey((String )tModelKeyStrings.elementAt(i)) ); 68 } 69 70 this.tModelKey = objects; 71 } 72 73 83 public TModelBag(Element base) throws UDDIException { 84 super(base); 86 NodeList nl = null; 87 nl = getChildElementsByTagName(base, TModelKey.UDDI_TAG); 88 for (int i=0; i < nl.getLength(); i++) { 89 tModelKey.addElement(new TModelKey((Element)nl.item(i))); 90 } 91 } 92 93 98 public void setTModelKeyVector(Vector s) { 99 tModelKey = s; 100 } 101 102 107 public void setTModelKeyStrings(Vector s) { 108 tModelKey = new Vector (); 109 for (int i = 0; i < s.size(); i++) { 110 tModelKey.addElement( new TModelKey((String )s.elementAt(i)) ); 111 } 112 } 113 114 119 public Vector getTModelKeyVector() { 120 return tModelKey; 121 } 122 123 128 public Vector getTModelKeyStrings() { 129 Vector strings = new Vector (); 130 for (int i = 0; i < tModelKey.size(); i++) { 131 strings.addElement( ((TModelKey)tModelKey.elementAt(i)).getText()); 132 } 133 return strings; 134 } 135 136 140 public void add (TModelKey t) { 141 tModelKey.add (t); 142 } 143 144 150 public boolean remove (TModelKey t) { 151 return tModelKey.remove (t); 152 } 153 154 159 public TModelKey get (int index) { 160 return (TModelKey) tModelKey.get (index); 161 } 162 163 167 public int size () { 168 return tModelKey.size (); 169 } 170 171 172 181 public void saveToXML(Element parent) { 182 base = parent.getOwnerDocument().createElement(UDDI_TAG); 183 if (tModelKey!=null) { 185 for (int i=0; i < tModelKey.size(); i++) { 186 ((TModelKey)(tModelKey.elementAt(i))).saveToXML(base); 187 } 188 } 189 parent.appendChild(base); 190 } 191 } 192 | Popular Tags |