atg.projects.store.collections.validator
Class StartEndDateValidator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.projects.store.collections.validator.StartEndDateValidator
All Implemented Interfaces:
atg.naming.AbsoluteNameable, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameContextParentable, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.Configured, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, atg.service.collections.validator.CollectionObjectValidator, java.util.EventListener

public class StartEndDateValidator
extends atg.nucleus.GenericService
implements atg.service.collections.validator.CollectionObjectValidator

This validator validates all products by start and end date.

If today's date falls on or between the start and end dates then the product is valid.

If the start date is null then the product is valid as long as the endDate has not passed.

If the end date is null then the product is valid if the startDate has passed.

If both the start and end dates are null then the product is valid

Version:
$Revision: #2 $
Author:
ATG

Field Summary
static java.lang.String CLASS_VERSION
          Class version string.
static java.lang.String DEBUG_DATE_FORMAT_PATTERN
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
StartEndDateValidator()
           
 
Method Summary
 atg.service.util.CurrentDate getCurrentDate()
           
 java.lang.String getEndDatePropertyName()
           
 java.lang.String getStartDatePropertyName()
           
 void setCurrentDate(atg.service.util.CurrentDate pCurrentDate)
           
 void setEndDatePropertyName(java.lang.String pEndDatePropertyName)
           
 void setStartDatePropertyName(java.lang.String pStartDatePropertyName)
           
 boolean validateObject(java.lang.Object pObject)
          These method validates the passed in object (repository items) based on it's startDate and endDate properties.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG_DATE_FORMAT_PATTERN

public static final java.lang.String DEBUG_DATE_FORMAT_PATTERN
See Also:
Constant Field Values

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
Class version string.

See Also:
Constant Field Values
Constructor Detail

StartEndDateValidator

public StartEndDateValidator()
Method Detail

setCurrentDate

public void setCurrentDate(atg.service.util.CurrentDate pCurrentDate)
Parameters:
pCurrentDate - the current date.

getCurrentDate

public atg.service.util.CurrentDate getCurrentDate()
Returns:
the mCurrentDate property

getStartDatePropertyName

public java.lang.String getStartDatePropertyName()
Returns:
the mStartDatePropertyName property

setStartDatePropertyName

public void setStartDatePropertyName(java.lang.String pStartDatePropertyName)
Parameters:
pStartDatePropertyName - the start date property name to set

getEndDatePropertyName

public java.lang.String getEndDatePropertyName()
Returns:
the mEndDatePropertyName property

setEndDatePropertyName

public void setEndDatePropertyName(java.lang.String pEndDatePropertyName)
Parameters:
pEndDatePropertyName - the end date property name to set

validateObject

public boolean validateObject(java.lang.Object pObject)
These method validates the passed in object (repository items) based on it's startDate and endDate properties. If today's date falls on or between the start and end dates then the product is valid. If the start date is null then the product is valid as long as the endDate has not passed. If the end date is null then the product is valid if the startDate has passed. If both the start and end dates are null then the product is valid

Specified by:
validateObject in interface atg.service.collections.validator.CollectionObjectValidator
Parameters:
pObject - an object to validate
Returns:
true if the object passes validation or if no validation was performed.