1 64 65 package com.jcorporate.expresso.core.controller; 66 67 72 73 import com.jcorporate.expresso.core.misc.StringUtil; 74 75 76 84 public class ValidationItem { 85 private String fieldName = null; 86 private String friendlyFieldName = null; 87 private String dbFieldName = null; 88 private boolean isRequired = false; 89 private String checkClassName = null; 90 91 100 public ValidationItem(String newFieldName, String newFriendlyFieldName, 101 String newDbFieldName, boolean newIsRequired, 102 String newCheckClassName) { 103 super(); 104 fieldName = newFieldName; 105 friendlyFieldName = newFriendlyFieldName; 106 dbFieldName = newDbFieldName; 107 isRequired = newIsRequired; 108 checkClassName = newCheckClassName; 109 } 110 111 119 public ValidationItem(String newFieldName, String newFriendlyFieldName, 120 boolean newIsRequired, String newCheckClassName) { 121 super(); 122 fieldName = newFieldName; 123 friendlyFieldName = newFriendlyFieldName; 124 isRequired = newIsRequired; 125 checkClassName = newCheckClassName; 126 } 127 128 134 public ValidationItem(String newFieldName, boolean newIsRequired) { 135 super(); 136 fieldName = newFieldName; 137 isRequired = newIsRequired; 138 } 139 140 147 public ValidationItem(String newFieldName, boolean newIsRequired, 148 String newCheckClassName) { 149 super(); 150 StringUtil.assertNotBlank(newFieldName, "Field name may not be blank"); 151 StringUtil.assertNotBlank(newCheckClassName, 152 "Check class name may not be blank"); 153 fieldName = newFieldName; 154 isRequired = newIsRequired; 155 checkClassName = newCheckClassName; 156 } 157 158 166 public void checkThisItem() 167 throws ValidationException { 168 if (getFieldName() == null) { 169 throw new ValidationException("The ValidationItem must have a fieldName."); 170 } 171 } 172 173 174 180 public String getCheckClassName() { 181 return checkClassName; 182 } 183 184 190 public String getDbFieldName() { 191 return dbFieldName; 192 } 193 194 200 public String getFieldName() { 201 return fieldName; 202 } 203 204 210 public String getFriendlyFieldName() { 211 return friendlyFieldName; 212 } 213 214 220 public boolean isRequired() { 221 return isRequired; 222 } 223 224 } 225 226 | Popular Tags |