1 23 24 29 30 package com.sun.enterprise.tools.common.dd.webapp.data; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class CookieParam extends com.sun.enterprise.tools.common.dd.ParamData 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String PARAM_NAME = "ParamName"; static public final String PARAM_TYPE = "ParamType"; static public final String PARAM_VALUES = "ParamValues"; static public final String DEFAULT_VALUE = "DefaultValue"; static public final String HELPID = "HelpID"; 50 public CookieParam() { 51 this(Common.USE_DEFAULT_VALUES); 52 } 53 54 public CookieParam(int options) 55 { 56 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 57 this.createProperty("param-name", PARAM_NAME, 60 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 61 String .class); 62 this.createProperty("param-type", PARAM_TYPE, 64 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 65 String .class); 66 this.createProperty("param-values", PARAM_VALUES, 68 Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY, 69 String .class); 70 this.createProperty("default-value", DEFAULT_VALUE, 72 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 73 String .class); 74 this.createProperty("helpID", HELPID, 76 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 77 String .class); 78 this.initialize(options); 79 } 80 81 void initialize(int options) 83 { 84 85 } 86 87 public void setParamName(String value) { 89 this.setValue(PARAM_NAME, value); 90 } 91 92 public String getParamName() { 94 return (String )this.getValue(PARAM_NAME); 95 } 96 97 public void setParamType(String value) { 99 this.setValue(PARAM_TYPE, value); 100 } 101 102 public String getParamType() { 104 return (String )this.getValue(PARAM_TYPE); 105 } 106 107 public void setParamValues(int index, String value) { 109 this.setValue(PARAM_VALUES, index, value); 110 } 111 112 public String getParamValues(int index) { 114 return (String )this.getValue(PARAM_VALUES, index); 115 } 116 117 public void setParamValues(String [] value) { 119 this.setValue(PARAM_VALUES, value); 120 } 121 122 public String [] getParamValues() { 124 return (String [])this.getValues(PARAM_VALUES); 125 } 126 127 public int sizeParamValues() { 129 return this.size(PARAM_VALUES); 130 } 131 132 public int addParamValues(String value) { 134 return this.addValue(PARAM_VALUES, value); 135 } 136 137 public int removeParamValues(String value) { 142 return this.removeValue(PARAM_VALUES, value); 143 } 144 145 public void setDefaultValue(String value) { 147 this.setValue(DEFAULT_VALUE, value); 148 } 149 150 public String getDefaultValue() { 152 return (String )this.getValue(DEFAULT_VALUE); 153 } 154 155 public void setHelpID(String value) { 157 this.setValue(HELPID, value); 158 } 159 160 public String getHelpID() { 162 return (String )this.getValue(HELPID); 163 } 164 165 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 167 comparators.add(c); 168 } 169 170 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 172 comparators.remove(c); 173 } 174 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 175 boolean restrictionFailure = false; 176 if (getParamName() == null) { 178 throw new org.netbeans.modules.schema2beans.ValidateException("getParamName() == null", "paramName", this); } 180 if (getParamType() != null) { 182 } 183 for (int _index = 0; _index < sizeParamValues(); ++_index) { 185 String element = getParamValues(_index); 186 if (element != null) { 187 } 188 } 189 if (getDefaultValue() != null) { 191 } 192 if (getHelpID() != null) { 194 } 195 } 196 197 public void dump(StringBuffer str, String indent){ 199 String s; 200 Object o; 201 org.netbeans.modules.schema2beans.BaseBean n; 202 str.append(indent); 203 str.append("ParamName"); str.append(indent+"\t"); str.append("<"); s = this.getParamName(); 207 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PARAM_NAME, 0, str, indent); 210 211 str.append(indent); 212 str.append("ParamType"); str.append(indent+"\t"); str.append("<"); s = this.getParamType(); 216 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PARAM_TYPE, 0, str, indent); 219 220 str.append(indent); 221 str.append("ParamValues["+this.sizeParamValues()+"]"); for(int i=0; i<this.sizeParamValues(); i++) 223 { 224 str.append(indent+"\t"); 225 str.append("#"+i+":"); 226 str.append(indent+"\t"); str.append("<"); s = this.getParamValues(i); 229 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PARAM_VALUES, i, str, indent); 232 } 233 234 str.append(indent); 235 str.append("DefaultValue"); str.append(indent+"\t"); str.append("<"); s = this.getDefaultValue(); 239 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(DEFAULT_VALUE, 0, str, indent); 242 243 str.append(indent); 244 str.append("HelpID"); str.append(indent+"\t"); str.append("<"); s = this.getHelpID(); 248 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(HELPID, 0, str, indent); 251 252 } 253 public String dumpBeanNode(){ 254 StringBuffer str = new StringBuffer (); 255 str.append("CookieParam\n"); this.dump(str, "\n "); return str.toString(); 258 }} 259 260 262 263 284 | Popular Tags |