1 8 9 package org.uddi4j.util; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.w3c.dom.Element ; 14 15 37 public class DiscoveryURL extends UDDIElement { 38 public static final String UDDI_TAG = "discoveryURL"; 39 40 protected Element base = null; 41 42 String text = null; 43 String useType = null; 44 45 51 public DiscoveryURL() { 52 } 53 54 60 public DiscoveryURL(String value, 61 String useType) { 62 setText(value); 63 this.useType = useType; 64 } 65 66 76 public DiscoveryURL(Element base) throws UDDIException { 77 super(base); 79 text = getText(base); 80 useType = base.getAttribute("useType"); 81 } 82 83 public void setText(String s) { 84 text = s; 85 } 86 87 public void setUseType(String s) { 88 useType = s; 89 } 90 91 public String getText() { 92 return text; 93 } 94 95 public String getUseType() { 96 return useType; 97 } 98 99 public boolean equals(Object obj) 101 { 102 boolean result = false; 103 if (obj != null && obj instanceof DiscoveryURL) 104 { 105 DiscoveryURL otherDiscURL = (DiscoveryURL)obj; 106 if ((text == null && otherDiscURL.getText() == null) || 107 (text != null && text.equals(otherDiscURL.getText()))) 108 { 109 if ((useType == null && otherDiscURL.getUseType() == null) || 110 (useType != null && useType.equals(otherDiscURL.getUseType()))) 111 { 112 result = true; 113 } 114 } 115 } 116 return result; 117 } 118 119 128 public void saveToXML(Element parent) { 129 base = parent.getOwnerDocument().createElement(UDDI_TAG); 130 if (text!=null) { 132 base.appendChild(parent.getOwnerDocument().createTextNode(text)); 133 } 134 if (useType!=null) { 135 base.setAttribute("useType", useType); 136 } 137 parent.appendChild(base); 138 } 139 } 140 | Popular Tags |