Class DefaultTriggerService
- java.lang.Object
-
- de.hybris.platform.servicelayer.cronjob.impl.DefaultTriggerService
-
- All Implemented Interfaces:
TriggerService
public class DefaultTriggerService extends java.lang.Object implements TriggerService
Default implementation of the trigger service.- Since:
- 4.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultTriggerService.Mode
-
Field Summary
Fields Modifier and Type Field Description static int
IGNORE_VALUE
ignored value for time, interval, max acceptable waits
-
Constructor Summary
Constructors Constructor Description DefaultTriggerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(TriggerModel trigger)
Executes the assignedJobModel
using the assignedCronJobModel
if the next activation time ((@link TriggerModel#getActivationTime()} is less or equal than the current system time.boolean
activateForTest(TriggerModel trigger, long currentTime)
java.util.List<TriggerModel>
getActiveTriggers()
Returns aList
of all Triggers, whose next activation time (TriggerService.getNextTime(TriggerModel, Calendar)
lies before the current system time.java.util.List<TriggerModel>
getActiveTriggers(java.util.Calendar calendar)
Returns aList
of all Triggers, whose next activation time (TriggerService.getNextTime(TriggerModel, Calendar)
lies before the specified calendar date.protected java.util.Map<java.lang.String,java.lang.String>
getConfigAttributes()
java.util.Calendar
getNextTime(TriggerModel trigger, java.util.Calendar relativeTo)
Returns the next activation time for theTriggerModel
in relation to the specified calendar.int
getPulseSeconds()
Returns a time interval at which trigger activation is fired.void
setCronJobService(CronJobService cronJobService)
void
setI18NService(I18NService i18nService)
void
setModelService(ModelService modelService)
void
setPulseSeconds(int interval)
Sets a time interval at which trigger activation is fired.void
setSessionService(SessionService sessionService)
void
setTriggerDao(TriggerDao triggerDao)
-
-
-
Field Detail
-
IGNORE_VALUE
public static final int IGNORE_VALUE
ignored value for time, interval, max acceptable waits- See Also:
- Constant Field Values
-
-
Method Detail
-
setCronJobService
public void setCronJobService(CronJobService cronJobService)
-
setModelService
public void setModelService(ModelService modelService)
-
setTriggerDao
public void setTriggerDao(TriggerDao triggerDao)
-
setI18NService
public void setI18NService(I18NService i18nService)
-
setSessionService
public void setSessionService(SessionService sessionService)
-
activateForTest
public boolean activateForTest(TriggerModel trigger, long currentTime)
-
activate
public void activate(TriggerModel trigger)
Description copied from interface:TriggerService
Executes the assignedJobModel
using the assignedCronJobModel
if the next activation time ((@link TriggerModel#getActivationTime()} is less or equal than the current system time.- Specified by:
activate
in interfaceTriggerService
- Parameters:
trigger
- the trigger instance
-
getConfigAttributes
protected java.util.Map<java.lang.String,java.lang.String> getConfigAttributes()
-
getNextTime
public java.util.Calendar getNextTime(TriggerModel trigger, java.util.Calendar relativeTo)
Description copied from interface:TriggerService
Returns the next activation time for theTriggerModel
in relation to the specified calendar.Use this method e.g. for different first day of week modes.
- Specified by:
getNextTime
in interfaceTriggerService
- Parameters:
trigger
- the trigger instancerelativeTo
- the calendar which the next activation time should be calculated relatively for- Returns:
- the next activation time(
Calendar
) for theTriggerModel
in relation to the specified time
-
getActiveTriggers
public java.util.List<TriggerModel> getActiveTriggers()
Description copied from interface:TriggerService
Returns aList
of all Triggers, whose next activation time (TriggerService.getNextTime(TriggerModel, Calendar)
lies before the current system time.- Specified by:
getActiveTriggers
in interfaceTriggerService
- Returns:
- a
List
of all Triggers, whose next activation time (TriggerService.getNextTime(TriggerModel, Calendar)
is smaller than current system time
-
getActiveTriggers
public java.util.List<TriggerModel> getActiveTriggers(java.util.Calendar calendar)
Description copied from interface:TriggerService
Returns aList
of all Triggers, whose next activation time (TriggerService.getNextTime(TriggerModel, Calendar)
lies before the specified calendar date.- Specified by:
getActiveTriggers
in interfaceTriggerService
- Parameters:
calendar
- the calendar- Returns:
- a
List
of all Triggers, whose next activation time (TriggerService.getNextTime(TriggerModel, Calendar)
lies before the specified calendar date
-
getPulseSeconds
public int getPulseSeconds()
Description copied from interface:TriggerService
Returns a time interval at which trigger activation is fired. See cronjob.trigger.interval' property- Specified by:
getPulseSeconds
in interfaceTriggerService
-
setPulseSeconds
public void setPulseSeconds(int interval)
Description copied from interface:TriggerService
Sets a time interval at which trigger activation is fired. See cronjob.trigger.interval' property .- Specified by:
setPulseSeconds
in interfaceTriggerService
-
-