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 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.void
configure(Configurer configurer)
Configure this trigger (expected to autowire in any dependencies)boolean
equals(java.lang.Object o)
java.util.Date
getEndDate()
The date after which the trigger will never activate.java.util.Date
getStartDate()
The date before which the trigger will never activate.int
hashCode()
void
setEndDate(java.util.Date endDate)
The date after which the trigger will never activate.void
setStartDate(java.util.Date startDate)
The date before which the trigger will never activate.java.lang.String
toString()
-
-
-
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:
activatesOn
in 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:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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.
-
-