DLESE Tools
v1.6.0

org.dlese.dpc.webapps.struts
Class FieldValidators

java.lang.Object
  extended by org.dlese.dpc.webapps.struts.FieldValidators

public class FieldValidators
extends Object

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
FieldValidators()
           
 
Method Summary
static String getDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
static String getSimpleDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
static void setDebug(boolean db)
          Sets the debug attribute object
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).
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.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldValidators

public FieldValidators()
Method Detail

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 bean
va - the ValidatorAction
field - The Field
messages - The ActionMessages
validator - The Validator
request - The HttpServletRequest
servletContext - 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 bean
va - the ValidatorAction
field - The Field
messages - The ActionMessages
validator - The Validator
request - The HttpServletRequest
servletContext - 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 bean
va - the ValidatorAction
field - The Field
messages - The ActionMessages
validator - The Validator
request - The HttpServletRequest
servletContext - The ServletContext
Returns:
True if the directory exists

getSimpleDateStamp

public static String 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

public static String 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

DLESE Tools
v1.6.0