Class Date
- java.lang.Object
-
- org.apache.directory.fortress.core.util.time.Date
-
- All Implemented Interfaces:
Validator
public class Date extends Object implements Validator
This class performs date validation forConstraint
. This validator will ensure the current date falls betweenConstraint.getBeginDate()
andConstraint.getEndDate()
The format requires YYYYMMDD, i.e. 20110101 for January 1, 2011. The constantGlobalIds.NONE
may be used to disable checks for a particular entity.Constraint Targets include
User
maps to 'ftCstr' attribute on 'ftUserAttrs' object classUserRole
maps to 'ftRC' attribute on 'ftUserAttrs' object classRole
maps to 'ftCstr' attribute on 'ftRls' object classAdminRole
maps to 'ftCstr' attribute on 'ftRls' object classUserAdminRole
maps to 'ftARC' attribute on 'ftRls' object class
- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description Date()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
validate(Session session, Constraint constraint, Time time, VUtil.ConstraintType type)
This method is called during entity activation,VUtil.validateConstraints(org.apache.directory.fortress.core.model.Session, org.apache.directory.fortress.core.util.VUtil.ConstraintType, boolean)
and ensures the current date is betweenConstraint.getBeginDate()
andConstraint.getEndDate()
.
-
-
-
Method Detail
-
validate
public int validate(Session session, Constraint constraint, Time time, VUtil.ConstraintType type)
This method is called during entity activation,VUtil.validateConstraints(org.apache.directory.fortress.core.model.Session, org.apache.directory.fortress.core.util.VUtil.ConstraintType, boolean)
and ensures the current date is betweenConstraint.getBeginDate()
andConstraint.getEndDate()
. This validation routine allows for either beginDate or endDate to be null or set to "none" which will disable the corresponding check. For example if beginDate is null or equal to 'none', the validator will not skip the date eval for begin date. If either begin or end dates are set the validator will compare to the current date to ensure within range. If set, the expected date format is YYYYMMDD. For example, '20110101' equals Jan 1, 2011.- Specified by:
validate
in interfaceValidator
- Parameters:
session
- required forValidator
interface but not used here.constraint
- contains the begin and end dates. Maps listed above.time
- contains the current time stamp.type
- required by interface, not used here.- Returns:
- '0' if validation succeeds else
GlobalErrIds.ACTV_FAILED_DATE
if failed.
-
-