1 8 9 package org.uddi4j.response; 10 11 import org.uddi4j.UDDIElement; 12 import org.uddi4j.UDDIException; 13 import org.uddi4j.datatype.Name; 14 import org.w3c.dom.Element ; 15 import org.w3c.dom.NodeList ; 16 17 40 public class TModelInfo extends UDDIElement { 41 public static final String UDDI_TAG = "tModelInfo"; 42 43 protected Element base = null; 44 45 String tModelKey = null; 46 Name name = null; 47 48 54 55 public TModelInfo() { 56 } 57 58 64 public TModelInfo(String tModelKey, 65 String name) { 66 this.tModelKey = tModelKey; 67 this.name = new Name(name); 68 } 69 70 80 81 public TModelInfo(Element base) throws UDDIException { 82 super(base); 84 tModelKey = base.getAttribute("tModelKey"); 85 NodeList nl = null; 86 nl = getChildElementsByTagName(base, Name.UDDI_TAG); 87 if (nl.getLength() > 0) { 88 name = new Name((Element)nl.item(0)); 89 } 90 } 91 92 public void setTModelKey(String s) { 93 tModelKey = s; 94 } 95 96 public void setName(Name s) { 97 name = s; 98 } 99 public void setName(String s) { 100 name = new Name(); 101 name.setText(s); 102 } 103 104 public String getTModelKey() { 105 return tModelKey; 106 } 107 108 109 public Name getName() { 110 return name; 111 } 112 113 public String getNameString() { 114 if(name!=null) 115 return name.getText(); 116 else 117 return null; 118 } 119 120 129 130 public void saveToXML(Element parent) { 131 base = parent.getOwnerDocument().createElement(UDDI_TAG); 132 if (tModelKey!=null) { 134 base.setAttribute("tModelKey", tModelKey); 135 } 136 if (name!=null) { 137 name.saveToXML(base); 138 } 139 parent.appendChild(base); 140 } 141 } 142 | Popular Tags |