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.datatype.tmodel.TModel; 16 import org.w3c.dom.Element ; 17 import org.w3c.dom.NodeList ; 18 19 42 public class TModelDetail extends UDDIElement 43 { 44 public static final String UDDI_TAG = "tModelDetail"; 45 46 protected Element base = null; 47 48 String operator = null; 49 String truncated = null; 50 Vector tModel = new Vector (); 52 53 59 60 public TModelDetail() 61 { 62 } 63 64 70 public TModelDetail(String operator, Vector tModel) 71 { 72 this.operator = operator; 73 this.tModel = tModel; 74 } 75 76 86 87 public TModelDetail(Element base) throws UDDIException 88 { 89 super(base); 91 operator = base.getAttribute("operator"); 92 truncated = base.getAttribute("truncated"); 93 NodeList nl = null; 94 nl = getChildElementsByTagName(base, TModel.UDDI_TAG); 95 for (int i = 0; i < nl.getLength(); i++) 96 { 97 tModel.addElement(new TModel((Element)nl.item(i))); 98 } 99 } 100 101 public void setOperator(String s) 102 { 103 operator = s; 104 } 105 106 public void setTruncated(String s) 107 { 108 truncated = s; 109 } 110 public void setTruncated(boolean s) 111 { 112 if (s) 113 { 114 truncated = "true"; 115 } 116 else 117 { 118 truncated = "false"; 119 } 120 } 121 122 127 public void setTModelVector(Vector s) 128 { 129 tModel = s; 130 } 131 132 public String getOperator() 133 { 134 return operator; 135 } 136 137 public String getTruncated() 138 { 139 return truncated; 140 } 141 142 public boolean getTruncatedBoolean() 143 { 144 return "true".equals(truncated); 145 } 146 147 152 public Vector getTModelVector() 153 { 154 return tModel; 155 } 156 157 166 167 public void saveToXML(Element parent) 168 { 169 base = parent.getOwnerDocument().createElement(UDDI_TAG); 170 base.setAttribute("generic", UDDIElement.GENERIC); 172 base.setAttribute("xmlns", UDDIElement.XMLNS); 173 if (operator != null) 174 { 175 base.setAttribute("operator", operator); 176 } 177 if (truncated != null) 178 { 179 base.setAttribute("truncated", truncated); 180 } 181 if (tModel != null) 182 { 183 for (int i = 0; i < tModel.size(); i++) 184 { 185 ((TModel) (tModel.elementAt(i))).saveToXML(base); 186 } 187 } 188 parent.appendChild(base); 189 } 190 } 191 | Popular Tags |