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 CategoryBag extends UDDIElement { 42 public static final String UDDI_TAG = "categoryBag"; 43 44 protected Element base = null; 45 46 Vector keyedReference = new Vector (); 48 49 53 public CategoryBag() { 54 } 55 56 66 public CategoryBag(Element base) throws UDDIException { 67 super(base); 69 NodeList nl = null; 70 nl = getChildElementsByTagName(base, KeyedReference.UDDI_TAG); 71 for (int i=0; i < nl.getLength(); i++) { 72 keyedReference.addElement(new KeyedReference((Element)nl.item(i))); 73 } 74 } 75 76 81 public void setKeyedReferenceVector(Vector s) { 82 keyedReference = s; 83 } 84 85 90 public Vector getKeyedReferenceVector() { 91 return keyedReference; 92 } 93 94 99 public void add(KeyedReference kr) { 100 keyedReference.add(kr); 101 } 102 103 110 public boolean remove(KeyedReference kr) { 111 return keyedReference.remove(kr); 112 } 113 114 120 public KeyedReference get(int index) { 121 return (KeyedReference)keyedReference.get(index); 122 } 123 124 129 public int size() { 130 return keyedReference.size(); 131 } 132 133 142 public void saveToXML(Element parent) { 143 base = parent.getOwnerDocument().createElement(UDDI_TAG); 144 if (keyedReference!=null) { 146 for (int i=0; i < keyedReference.size(); i++) { 147 ((KeyedReference)(keyedReference.elementAt(i))).saveToXML(base); 148 } 149 } 150 parent.appendChild(base); 151 } 152 } 153 | Popular Tags |