org.apache.myfaces.commons.validator
Class AbstractDateRestrictionValidator

java.lang.Object
  extended by org.apache.myfaces.commons.validator.ValidatorBase
      extended by org.apache.myfaces.commons.validator.AbstractDateRestrictionValidator
All Implemented Interfaces:
EventListener, javax.faces.component.StateHolder, javax.faces.validator.Validator

@JSFValidator(name="mcv:validateDateRestriction",
              clazz="org.apache.myfaces.commons.validator.DateRestrictionValidator",
              bodyContent="empty",
              tagClass="org.apache.myfaces.commons.validator.ValidateDateRestrictionTag",
              tagHandler="org.apache.myfaces.commons.validator.ValidateDateRestrictionTagHandler",
              serialuidtag="6805174635196400967L")
public abstract class AbstractDateRestrictionValidator
extends ValidatorBase

Validate that the date entered is within a given restriction.


Field Summary
static String DAY_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the valid days value check fails.
static String MONTH_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the valid month value check fails.
static String VALIDATOR_ID
           
static String WEEKDAY_MESSAGE_ID
          The message identifier of the FacesMessage to be created if the valid weekdays value check fails.
 
Fields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID
 
Constructor Summary
AbstractDateRestrictionValidator()
          Construct a Validator with no preconfigured limits.
 
Method Summary
protected  Calendar getCalendar()
           
protected static Date getDateValue(Object value)
          Parses the already converted value to a java.util.Date.
abstract  DateListProvider getInvalidDays()
          To specifiy a concrete List of Dates, use the invalidDays attribute and wire it to a DateListProvider implementation.
abstract  String[] getInvalidDaysOfWeek()
          Specify the weekdays which are invalid for your use case.
abstract  String[] getInvalidMonths()
          Specify the month which are invalid for your use case.
abstract  void setInvalidDays(DateListProvider invalidDays)
           
abstract  void setInvalidDaysOfWeek(String[] invalidDaysOfWeek)
           
abstract  void setInvalidMonths(String[] invalidMonths)
           
 void validate(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)
           
 
Methods inherited from class org.apache.myfaces.commons.validator.ValidatorBase
getDetailMessage, getFacesContext, getFacesMessage, getMessage, getStringValue, getSummaryMessage, getValueExpression, isTransient, restoreAttachedState, restoreState, saveAttachedState, saveState, setDetailMessage, setMessage, setSummaryMessage, setTransient, setValueExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATOR_ID

public static final String VALIDATOR_ID
See Also:
Constant Field Values

DAY_MESSAGE_ID

public static final String DAY_MESSAGE_ID

The message identifier of the FacesMessage to be created if the valid days value check fails. The message format string for this message may optionally include {0}, {1} and {3} placeholders, which will be replaced by user input, component label and configured days value.

See Also:
Constant Field Values

MONTH_MESSAGE_ID

public static final String MONTH_MESSAGE_ID

The message identifier of the FacesMessage to be created if the valid month value check fails. The message format string for this message may optionally include {0}, {1} and {3} placeholders, which will be replaced by user input, component label and configured month value.

See Also:
Constant Field Values

WEEKDAY_MESSAGE_ID

public static final String WEEKDAY_MESSAGE_ID

The message identifier of the FacesMessage to be created if the valid weekdays value check fails. The message format string for this message may optionally include {0}, {1} and {3} placeholders, which will be replaced by user input, component label and configured weekdays value.

See Also:
Constant Field Values
Constructor Detail

AbstractDateRestrictionValidator

public AbstractDateRestrictionValidator()
Construct a Validator with no preconfigured limits.

Method Detail

getInvalidMonths

@JSFProperty(deferredValueType="java.lang.Object")
public abstract String[] getInvalidMonths()
Specify the month which are invalid for your use case. The attribute takes a whitespace delimited list of months. Possible values are jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.


setInvalidMonths

public abstract void setInvalidMonths(String[] invalidMonths)

getInvalidDaysOfWeek

@JSFProperty(deferredValueType="java.lang.Object")
public abstract String[] getInvalidDaysOfWeek()
Specify the weekdays which are invalid for your use case. The attribute takes whitespace delimited list of weekdays. Possible values are sun, mon, tue, wed, thu, fri, sat.


setInvalidDaysOfWeek

public abstract void setInvalidDaysOfWeek(String[] invalidDaysOfWeek)

getInvalidDays

@JSFProperty
public abstract DateListProvider getInvalidDays()
To specifiy a concrete List of Dates, use the invalidDays attribute and wire it to a DateListProvider implementation. This returns a list of dates, which are invalid.


setInvalidDays

public abstract void setInvalidDays(DateListProvider invalidDays)

validate

public void validate(javax.faces.context.FacesContext context,
                     javax.faces.component.UIComponent component,
                     Object value)
              throws javax.faces.validator.ValidatorException
Throws:
IllegalArgumentException - if value is not of type Date
javax.faces.validator.ValidatorException

getCalendar

protected Calendar getCalendar()

getDateValue

protected static Date getDateValue(Object value)
                            throws IllegalArgumentException
Parses the already converted value to a java.util.Date.

Parameters:
value - converted value
Returns:
fulltyped java.util.Date
Throws:
IllegalArgumentException


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.