Package org.dlese.dpc.webapps.struts
Class FieldValidators
java.lang.Object
org.dlese.dpc.webapps.struts.FieldValidators
Static methods used in the Struts validation framework that implement custom validation actions. The
static methods are configured in validator-rules.xml and applied to a specific form in your app using
validation.xml, which are typically located in the WEB-INF directory of your web application.
- Version:
- $Id: FieldValidators.java,v 1.6 2009/03/20 23:34:01 jweather Exp $
- Author:
- John Weatherley
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturn a string for the current time and date, sutiable for display in log files and output to standout:static StringReturn a string for the current time and date, sutiable for display in log files and output to standout:static voidsetDebug(boolean db) Sets the debug attribute objectstatic booleanvalidateDirectoryNotInRepository(Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, org.apache.struts.action.ActionMessages messages, org.apache.commons.validator.Validator validator, HttpServletRequest request, ServletContext servletContext) Validates that the field value is a directory that is not already configured in the repository (RepositoryManager).static booleanvalidateIsDirectory(Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, org.apache.struts.action.ActionMessages messages, org.apache.commons.validator.Validator validator, HttpServletRequest request, ServletContext servletContext) Validates that the field value is an existing directory on the server that the application is running on.static booleanvalidateNamespaceIdentifier(Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, org.apache.struts.action.ActionMessages messages, org.apache.commons.validator.Validator validator, HttpServletRequest request, ServletContext servletContext) Validates that the String is a valid namespace identifier for OAI.
-
Constructor Details
-
FieldValidators
public FieldValidators()
-
-
Method Details
-
validateIsDirectory
public static boolean validateIsDirectory(Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, org.apache.struts.action.ActionMessages messages, org.apache.commons.validator.Validator validator, HttpServletRequest request, ServletContext servletContext) Validates that the field value is an existing directory on the server that the application is running on.- Parameters:
bean- The Struts beanva- the ValidatorActionfield- The Fieldmessages- The ActionMessagesvalidator- The Validatorrequest- The HttpServletRequestservletContext- The ServletContext- Returns:
- True if the directory exists
-
validateNamespaceIdentifier
public static boolean validateNamespaceIdentifier(Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, org.apache.struts.action.ActionMessages messages, org.apache.commons.validator.Validator validator, HttpServletRequest request, ServletContext servletContext) Validates that the String is a valid namespace identifier for OAI.- Parameters:
bean- The Struts beanva- the ValidatorActionfield- The Fieldmessages- The ActionMessagesvalidator- The Validatorrequest- The HttpServletRequestservletContext- The ServletContext- Returns:
- True if valid
-
validateDirectoryNotInRepository
public static boolean validateDirectoryNotInRepository(Object bean, org.apache.commons.validator.ValidatorAction va, org.apache.commons.validator.Field field, org.apache.struts.action.ActionMessages messages, org.apache.commons.validator.Validator validator, HttpServletRequest request, ServletContext servletContext) Validates that the field value is a directory that is not already configured in the repository (RepositoryManager). Checks the request parameter 'edit' for the previous directory setInfo, if editing.- Parameters:
bean- The Struts beanva- the ValidatorActionfield- The Fieldmessages- The ActionMessagesvalidator- The Validatorrequest- The HttpServletRequestservletContext- The ServletContext- Returns:
- True if the directory exists
-
getSimpleDateStamp
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-
getDateStamp
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-
setDebug
public static void setDebug(boolean db) Sets the debug attribute object- Parameters:
db- The new debug value
-