1 8 9 package org.uddi4j.response; 10 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIElement; 14 import org.uddi4j.UDDIException; 15 import org.uddi4j.util.KeyedReference; 16 import org.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 48 public class SharedRelationships extends UDDIElement { 49 50 public static final String UDDI_TAG = "sharedRelationships"; 51 52 public static final String DIRECTION_TOKEY = "toKey"; 53 public static final String DIRECTION_FROMKEY = "fromKey"; 54 55 protected Element base = null; 56 Vector keyedReference = new Vector (); 57 String direction = null; 58 59 65 66 public SharedRelationships() { 67 } 68 69 70 80 81 public SharedRelationships(Element base) throws UDDIException { 82 super(base); 84 direction = base.getAttribute("direction"); 85 NodeList nl = null; 86 nl = getChildElementsByTagName(base, KeyedReference.UDDI_TAG); 87 for (int i=0; i < nl.getLength(); i++) { 88 keyedReference.addElement(new KeyedReference((Element)nl.item(i))); 89 } 90 } 91 92 public Vector getKeyedReferenceVector() { 93 return this.keyedReference; 94 } 95 96 public void setKeyedReferenceVector(Vector keyedReference) { 97 this.keyedReference = keyedReference; 98 } 99 100 public String getDirection() { 101 return direction; 102 } 103 104 public void setDirection(String d) { 105 direction = d ; 106 } 107 108 117 118 public void saveToXML(Element parent) { 119 base = parent.getOwnerDocument().createElement(UDDI_TAG); 120 if(direction !=null ) { 121 base.setAttribute("direction", direction); 122 } 123 124 if (keyedReference!=null) { 126 for (int i=0; i < keyedReference.size(); i++) { 127 ((KeyedReference)(keyedReference.elementAt(i))).saveToXML(base); 128 } 129 } 130 parent.appendChild(base); 131 132 } 133 } 134 | Popular Tags |