1 8 9 package org.uddi4j.datatype.assertion; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.util.FromKey; 14 import org.uddi4j.util.KeyedReference; 15 import org.uddi4j.util.ToKey; 16 import org.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 49 public class PublisherAssertion extends UDDIElement { 50 public static final String UDDI_TAG = "publisherAssertion"; 51 52 protected Element base = null; 53 54 FromKey fromKey = null; 55 ToKey toKey = null; 56 KeyedReference keyedReference = null; 57 58 59 65 public PublisherAssertion() { 66 } 67 68 75 public PublisherAssertion(String fromKey, String toKey , 76 KeyedReference keyRef) { 77 this.fromKey = new FromKey(fromKey); 78 this.toKey = new ToKey(toKey); 79 this.keyedReference = keyRef; 80 } 81 82 91 public PublisherAssertion(Element base) throws UDDIException { 92 super(base); 94 NodeList nl = null; 95 nl = getChildElementsByTagName(base, FromKey.UDDI_TAG); 96 if (nl.getLength() > 0) { 97 fromKey = new FromKey((Element)nl.item(0)); 98 } 99 nl = getChildElementsByTagName(base, ToKey.UDDI_TAG); 100 if (nl.getLength() > 0) { 101 toKey = new ToKey((Element)nl.item(0)); 102 } 103 nl = getChildElementsByTagName(base, KeyedReference.UDDI_TAG); 104 if (nl.getLength() > 0) { 105 keyedReference = new KeyedReference((Element)nl.item(0)); 106 } 107 } 108 109 public String getFromKeyString() { 110 return fromKey.getText(); 111 } 112 113 public void setFromKeyString(String s) { 114 fromKey = new FromKey(); 115 fromKey.setText(s); 116 } 117 118 public String getToKeyString() { 119 return toKey.getText(); 120 } 121 122 public void setToKeyString(String s) { 123 toKey = new ToKey(); 124 toKey.setText(s); 125 } 126 127 public FromKey getFromKey() { 128 return fromKey; 129 } 130 131 public void setFromKey(FromKey key) { 132 fromKey = key; 133 } 134 135 public ToKey getToKey() { 136 return toKey; 137 } 138 139 public void setToKey(ToKey key) { 140 toKey = key; 141 } 142 143 public KeyedReference getKeyedReference() { 144 return keyedReference; 145 } 146 147 public void setKeyedReference(KeyedReference r ) { 148 keyedReference = r; 149 } 150 151 160 public void saveToXML(Element parent) { 161 base = parent.getOwnerDocument().createElement(UDDI_TAG); 162 163 if (fromKey!=null) { 164 fromKey.saveToXML(base); 165 } 166 if (toKey!=null) { 167 toKey.saveToXML(base); 168 } 169 if (keyedReference!=null) { 170 keyedReference.saveToXML(base); 171 } 172 173 parent.appendChild(base); 174 } 175 } 176 | Popular Tags |