1 23 24 29 30 package com.sun.enterprise.tools.common.dd.webapp; 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 ConstraintField extends com.sun.enterprise.tools.common.dd.SunBaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String NAME = "Name"; static public final String SCOPE = "Scope"; static public final String CACHEONMATCH = "CacheOnMatch"; static public final String CACHEONMATCHFAILURE = "CacheOnMatchFailure"; static public final String CONSTRAINT_FIELD_VALUE = "ConstraintFieldValue"; static public final String CONSTRAINTFIELDVALUEMATCHEXPR = "ConstraintFieldValueMatchExpr"; static public final String CONSTRAINTFIELDVALUECACHEONMATCH = "ConstraintFieldValueCacheOnMatch"; static public final String CONSTRAINTFIELDVALUECACHEONMATCHFAILURE = "ConstraintFieldValueCacheOnMatchFailure"; 53 public ConstraintField() { 54 this(Common.USE_DEFAULT_VALUES); 55 } 56 57 public ConstraintField(int options) 58 { 59 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 60 this.createProperty("constraint-field-value", CONSTRAINT_FIELD_VALUE, 63 Common.TYPE_0_N | Common.TYPE_STRING | Common.TYPE_KEY, 64 String .class); 65 this.createAttribute(CONSTRAINT_FIELD_VALUE, "match-expr", "MatchExpr", 66 AttrProp.CDATA, 67 null, "equals"); 68 this.createAttribute(CONSTRAINT_FIELD_VALUE, "cache-on-match", "CacheOnMatch", 69 AttrProp.CDATA, 70 null, "true"); 71 this.createAttribute(CONSTRAINT_FIELD_VALUE, "cache-on-match-failure", "CacheOnMatchFailure", 72 AttrProp.CDATA, 73 null, "false"); 74 this.initialize(options); 75 } 76 77 void initialize(int options) 79 { 80 81 } 82 83 public void setName(java.lang.String value) { 85 setAttributeValue(NAME, value); 86 } 87 88 public java.lang.String getName() { 90 return getAttributeValue(NAME); 91 } 92 93 public void setScope(java.lang.String value) { 95 setAttributeValue(SCOPE, value); 96 } 97 98 public java.lang.String getScope() { 100 return getAttributeValue(SCOPE); 101 } 102 103 public void setCacheOnMatch(java.lang.String value) { 105 setAttributeValue(CACHEONMATCH, value); 106 } 107 108 public java.lang.String getCacheOnMatch() { 110 return getAttributeValue(CACHEONMATCH); 111 } 112 113 public void setCacheOnMatchFailure(java.lang.String value) { 115 setAttributeValue(CACHEONMATCHFAILURE, value); 116 } 117 118 public java.lang.String getCacheOnMatchFailure() { 120 return getAttributeValue(CACHEONMATCHFAILURE); 121 } 122 123 public void setConstraintFieldValue(int index, String value) { 125 this.setValue(CONSTRAINT_FIELD_VALUE, index, value); 126 } 127 128 public String getConstraintFieldValue(int index) { 130 return (String )this.getValue(CONSTRAINT_FIELD_VALUE, index); 131 } 132 133 public void setConstraintFieldValue(String [] value) { 135 this.setValue(CONSTRAINT_FIELD_VALUE, value); 136 } 137 138 public String [] getConstraintFieldValue() { 140 return (String [])this.getValues(CONSTRAINT_FIELD_VALUE); 141 } 142 143 public int sizeConstraintFieldValue() { 145 return this.size(CONSTRAINT_FIELD_VALUE); 146 } 147 148 public int addConstraintFieldValue(String value) { 150 return this.addValue(CONSTRAINT_FIELD_VALUE, value); 151 } 152 153 public int removeConstraintFieldValue(String value) { 158 return this.removeValue(CONSTRAINT_FIELD_VALUE, value); 159 } 160 161 public void setConstraintFieldValueMatchExpr(int index, java.lang.String value) { 163 if (size(CONSTRAINT_FIELD_VALUE) == 0) { 165 addValue(CONSTRAINT_FIELD_VALUE, ""); 166 } 167 setAttributeValue(CONSTRAINT_FIELD_VALUE, index, "MatchExpr", value); 168 } 169 170 public java.lang.String getConstraintFieldValueMatchExpr(int index) { 172 if (size(CONSTRAINT_FIELD_VALUE) == 0) { 174 return null; 175 } else { 176 return getAttributeValue(CONSTRAINT_FIELD_VALUE, index, "MatchExpr"); 177 } 178 } 179 180 public void setConstraintFieldValueCacheOnMatch(int index, java.lang.String value) { 182 if (size(CONSTRAINT_FIELD_VALUE) == 0) { 184 addValue(CONSTRAINT_FIELD_VALUE, ""); 185 } 186 setAttributeValue(CONSTRAINT_FIELD_VALUE, index, "CacheOnMatch", value); 187 } 188 189 public java.lang.String getConstraintFieldValueCacheOnMatch(int index) { 191 if (size(CONSTRAINT_FIELD_VALUE) == 0) { 193 return null; 194 } else { 195 return getAttributeValue(CONSTRAINT_FIELD_VALUE, index, "CacheOnMatch"); 196 } 197 } 198 199 public void setConstraintFieldValueCacheOnMatchFailure(int index, java.lang.String value) { 201 if (size(CONSTRAINT_FIELD_VALUE) == 0) { 203 addValue(CONSTRAINT_FIELD_VALUE, ""); 204 } 205 setAttributeValue(CONSTRAINT_FIELD_VALUE, index, "CacheOnMatchFailure", value); 206 } 207 208 public java.lang.String getConstraintFieldValueCacheOnMatchFailure(int index) { 210 if (size(CONSTRAINT_FIELD_VALUE) == 0) { 212 return null; 213 } else { 214 return getAttributeValue(CONSTRAINT_FIELD_VALUE, index, "CacheOnMatchFailure"); 215 } 216 } 217 218 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 220 comparators.add(c); 221 } 222 223 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 225 comparators.remove(c); 226 } 227 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 228 boolean restrictionFailure = false; 229 if (getName() == null) { 231 throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); } 233 if (getScope() == null) { 235 throw new org.netbeans.modules.schema2beans.ValidateException("getScope() == null", "scope", this); } 237 if (getCacheOnMatch() == null) { 239 throw new org.netbeans.modules.schema2beans.ValidateException("getCacheOnMatch() == null", "cacheOnMatch", this); } 241 if (getCacheOnMatchFailure() == null) { 243 throw new org.netbeans.modules.schema2beans.ValidateException("getCacheOnMatchFailure() == null", "cacheOnMatchFailure", this); } 245 for (int _index = 0; _index < sizeConstraintFieldValue(); 247 ++_index) { 248 String element = getConstraintFieldValue(_index); 249 if (element != null) { 250 } 251 } 252 } 256 257 public void dump(StringBuffer str, String indent){ 259 String s; 260 Object o; 261 org.netbeans.modules.schema2beans.BaseBean n; 262 str.append(indent); 263 str.append("ConstraintFieldValue["+this.sizeConstraintFieldValue()+"]"); for(int i=0; i<this.sizeConstraintFieldValue(); i++) 265 { 266 str.append(indent+"\t"); 267 str.append("#"+i+":"); 268 str.append(indent+"\t"); str.append("<"); s = this.getConstraintFieldValue(i); 271 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(CONSTRAINT_FIELD_VALUE, i, str, indent); 274 } 275 276 } 277 public String dumpBeanNode(){ 278 StringBuffer str = new StringBuffer (); 279 str.append("ConstraintField\n"); this.dump(str, "\n "); return str.toString(); 282 }} 283 284 286 287 754 | Popular Tags |