Class DateRangeTrigger
- java.lang.Object
-
- com.funnelback.publicui.search.model.curator.trigger.DateRangeTrigger
-
- All Implemented Interfaces:
Trigger,HasNoBeans
public final class DateRangeTrigger extends java.lang.Object implements Trigger, HasNoBeans
A trigger which activates only when the current date and time falls after the given start date but before the given end date.
If the start/end date is set to null then it will not be considered as a constraint, allowing a trigger to end on a given date or start on a given date without the need to specify the other boundary. If both boundaries are left as null then the trigger will always activate.
The date which is compared is based on the server's current time, and the start and end dates are assumed to be in the same timezone as the server.
The after/before checks are exclusive (i.e. the specified boundary is not included in the active period), however the resolution has millisecond precision, so in practice it would be hard to observe the difference between this and the opposite (inclusive) behavior.
-
-
Constructor Summary
Constructors Constructor Description DateRangeTrigger()DateRangeTrigger(java.util.Date startDate, java.util.Date endDate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanactivatesOn(SearchTransaction searchTransaction)Check whether the server's current time falls between the startDate and endDate, and return true if it does and false otherwise.voidconfigure(Configurer configurer)Configure this trigger (expected to autowire in any dependencies)booleanequals(java.lang.Object o)java.util.DategetEndDate()The date after which the trigger will never activate.java.util.DategetStartDate()The date before which the trigger will never activate.inthashCode()voidsetEndDate(java.util.Date endDate)The date after which the trigger will never activate.voidsetStartDate(java.util.Date startDate)The date before which the trigger will never activate.java.lang.StringtoString()
-
-
-
Field Detail
-
startDate
private java.util.Date startDate
The date before which the trigger will never activate. If left as null then no start date constraint is applied.
-
endDate
private java.util.Date endDate
The date after which the trigger will never activate. If left as null then no end date constraint is applied.
-
-
Method Detail
-
activatesOn
public boolean activatesOn(SearchTransaction searchTransaction)
Check whether the server's current time falls between the startDate and endDate, and return true if it does and false otherwise. If a start/end constraint is null then any date is considered permitted on that boundary.- Specified by:
activatesOnin interfaceTrigger- Parameters:
searchTransaction- Current search transaction- Returns:
- true if this trigger should activate on the given searchTransaction, and false otherwise.
-
configure
public void configure(Configurer configurer)
Configure this trigger (expected to autowire in any dependencies)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getStartDate
public java.util.Date getStartDate()
The date before which the trigger will never activate. If left as null then no start date constraint is applied.
-
setStartDate
public void setStartDate(java.util.Date startDate)
The date before which the trigger will never activate. If left as null then no start date constraint is applied.
-
getEndDate
public java.util.Date getEndDate()
The date after which the trigger will never activate. If left as null then no end date constraint is applied.
-
setEndDate
public void setEndDate(java.util.Date endDate)
The date after which the trigger will never activate. If left as null then no end date constraint is applied.
-
-