Class ScheduledJob

java.lang.Object
com.broadleafcommerce.scheduledjob.domain.ScheduledJob
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable

public class ScheduledJob extends Object implements com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable
Represents a scheduled job for the system to execute. Can be a single use or repeatable job.
Author:
Chad Harchar (charchar)
See Also:
  • Constructor Details

    • ScheduledJob

      public ScheduledJob(String id)
      Convenience constructor mostly intended for testing.
      Parameters:
      id -
    • ScheduledJob

      public ScheduledJob(boolean enabled, String id, String name, String type, String timingType, boolean executed, Instant previousLastExecuted, Instant lastExecuted, Instant updated, Instant targetDate, String cron, List<ScheduledJobDetail> details, boolean manageInAdmin, String author, boolean trackExecutionDetails, com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
    • ScheduledJob

      public ScheduledJob()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Whether this scheduled job is enabled, thus allowing it to run.
      Returns:
      Whether this scheduled job is enabled, thus allowing it to run.
    • getId

      public String getId()
      The context ID of the scheduled job.
      Returns:
      the context ID of the scheduled job.
    • getName

      public String getName()
      Display name for this scheduled job.
      Returns:
      the name of this scheduled job
    • getType

      public String getType()
      The type of this scheduled job, used to help identify and organize jobs that share a common origin.
      Returns:
      The type of this scheduled job, used to help identify and organize targets that share a common origin.
    • getTimingType

      public String getTimingType()
      The timing type of this scheduled job. Can be either based on a target date or recurring based on a cron expression.
      Returns:
      The timing type of this scheduled job. Can be either single date or recurring based on a cron expression.
    • isExecuted

      public boolean isExecuted()
      Whether this scheduled job has been executed.
      Returns:
      Whether or not the job has been executed
    • getPreviousLastExecuted

      public Instant getPreviousLastExecuted()
      The previous date on which the job last executed. This is useful for jobs that need to communicate the previous date they executed on to external listeners since lastExecuted will already have been updated to the current execution date (i.e., now) by the time they receive the message.

      Some jobs will use the date the job last executed in order to limit queries to entities that have been modified since then, such as checking which Product Tags have gone expired since the last time they were checked.

      Returns:
      The previous date on which the job last executed.
    • getLastExecuted

      public Instant getLastExecuted()
      The date on which the job last executed.
      Returns:
      The date on which the job last executed.
    • getUpdated

      public Instant getUpdated()
      The date on which the job was last updated by a user.
      Returns:
      The date on which the job was last updated by a user.
    • getTargetDate

      public Instant getTargetDate()
      The date on which a single use job should execute.
      Returns:
      The date on which a single use job should execute
    • getCron

      public String getCron()
      A cron expression used to drive the schedule for the job execution.
      Returns:
      A cron expression used to drive the schedule for the job execution
    • getDetails

      public List<ScheduledJobDetail> getDetails()
      Collection of detailed information for the job
      Returns:
      Collection of detailed information for the job
    • isManageInAdmin

      public boolean isManageInAdmin()
      Whether or not the job can be managed through the Admin interface.
      Returns:
      Whether or not the job can be managed through the Admin interface
    • getAuthor

      public String getAuthor()
      The admin user who created this job
    • isTrackExecutionDetails

      public boolean isTrackExecutionDetails()
      A flag to indicate whether the execution details of this scheduled-job should be tracked.

      Set as false by default

    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • setEnabled

      public void setEnabled(boolean enabled)
      Whether this scheduled job is enabled, thus allowing it to run.
      Parameters:
      enabled - Whether this scheduled job is enabled, thus allowing it to run.
    • setId

      public void setId(String id)
      The context ID of the scheduled job.
      Parameters:
      id - the context ID of the scheduled job.
    • setName

      public void setName(String name)
      Display name for this scheduled job.
      Parameters:
      name - the name of this scheduled job
    • setType

      public void setType(String type)
      The type of this scheduled job, used to help identify and organize jobs that share a common origin.
      Parameters:
      type - The type of this scheduled job, used to help identify and organize targets that share a common origin.
    • setTimingType

      public void setTimingType(String timingType)
      The timing type of this scheduled job. Can be either based on a target date or recurring based on a cron expression.
      Parameters:
      timingType - The timing type of this scheduled job. Can be either single date or recurring based on a cron expression.
    • setExecuted

      public void setExecuted(boolean executed)
      Whether this scheduled job has been executed.
      Parameters:
      executed - Whether or not the job has been executed
    • setPreviousLastExecuted

      public void setPreviousLastExecuted(Instant previousLastExecuted)
      The previous date on which the job last executed. This is useful for jobs that need to communicate the previous date they executed on to external listeners since lastExecuted will already have been updated to the current execution date (i.e., now) by the time they receive the message.

      Some jobs will use the date the job last executed in order to limit queries to entities that have been modified since then, such as checking which Product Tags have gone expired since the last time they were checked.

      Parameters:
      previousLastExecuted - The previous date on which the job last executed.
    • setLastExecuted

      public void setLastExecuted(Instant lastExecuted)
      The date on which the job last executed.
      Parameters:
      lastExecuted - The date on which the job last executed.
    • setUpdated

      public void setUpdated(Instant updated)
      The date on which the job was last updated by a user.
      Parameters:
      updated - The date on which the job was last updated by a user.
    • setTargetDate

      public void setTargetDate(Instant targetDate)
      The date on which a single use job should execute.
      Parameters:
      targetDate - The date on which a single use job should execute
    • setCron

      public void setCron(String cron)
      A cron expression used to drive the schedule for the job execution.
      Parameters:
      cron - A cron expression used to drive the schedule for the job execution
    • setDetails

      public void setDetails(List<ScheduledJobDetail> details)
      Collection of detailed information for the job
      Parameters:
      details - Collection of detailed information for the job
    • setManageInAdmin

      public void setManageInAdmin(boolean manageInAdmin)
      Whether or not the job can be managed through the Admin interface.
      Parameters:
      manageInAdmin - Whether or not the job can be managed through the Admin interface
    • setAuthor

      public void setAuthor(String author)
      The admin user who created this job
    • setTrackExecutionDetails

      public void setTrackExecutionDetails(boolean trackExecutionDetails)
      A flag to indicate whether the execution details of this scheduled-job should be tracked.

      Set as false by default

    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object