1 8 9 package org.uddi4j.response; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.util.FromKey; 14 import org.uddi4j.util.ToKey; 15 import org.w3c.dom.Element ; 16 import org.w3c.dom.NodeList ; 17 18 42 public class KeysOwned extends UDDIElement { 43 public static final String UDDI_TAG = "keysOwned"; 44 45 protected Element base = null; 46 47 FromKey fromKey = null; 48 ToKey toKey = null; 49 50 56 57 public KeysOwned() { 58 } 59 60 61 71 72 public KeysOwned(Element base) throws UDDIException { 73 super(base); 75 NodeList nl = null; 76 nl = getChildElementsByTagName(base, FromKey.UDDI_TAG); 77 if (nl.getLength() > 0) { 78 fromKey = new FromKey((Element)nl.item(0)); 79 } 80 nl = getChildElementsByTagName(base, ToKey.UDDI_TAG); 81 if (nl.getLength() > 0) { 82 toKey = new ToKey((Element)nl.item(0)); 83 } 84 } 85 86 public void setFromKeyString(String s) { 87 fromKey = new FromKey(); 88 fromKey.setText(s); 89 } 90 91 public String getFromKeyString() { 92 if(fromKey!=null) 93 return fromKey.getText(); 94 else 95 return null; 96 } 97 98 public void setFromKey(FromKey key) { 99 fromKey = key; 100 } 101 102 public FromKey getFromKey() { 103 return fromKey; 104 } 105 106 public void setToKey(ToKey key) { 107 toKey = key; 108 } 109 110 public ToKey getToKey() { 111 return toKey; 112 } 113 114 public void setToKeyString(String s) { 115 toKey = new ToKey(); 116 toKey.setText(s); 117 } 118 119 public String getToKeyString() { 120 if(toKey!=null) 121 return toKey.getText(); 122 else 123 return null; 124 } 125 126 135 136 public void saveToXML(Element parent) { 137 base = parent.getOwnerDocument().createElement(UDDI_TAG); 138 139 if (fromKey!=null) { 140 fromKey.saveToXML(base); 141 } 142 if (toKey!=null) { 143 toKey.saveToXML(base); 144 } 145 parent.appendChild(base); 146 } 147 } 148 | Popular Tags |