Interface ScheduleContext

All Superinterfaces:
BaseContext, ScriptContext, SpecialistsBroker

public interface ScheduleContext extends ScriptContext
A context with access to schedule entry execution-related objects.
Since:
4.0.17
  • Method Details

    • getExecutionId

      long getExecutionId()
      The id of the current control
      Since:
      5.2.221003
    • getTask

      @Nullable @Nullable ScheduleTask getTask()
      the acutal task or null if no task is currently executed
      Since:
      4.0.17
      See Also:
    • getTaskIndex

      int getTaskIndex()
      the index of the actual task in the task list or -1 if no task iscurrently executed
      Since:
      4.0.17
    • getTasks

      List<? extends ScheduleTask> getTasks()
      Returns the list of schedule tasks defined by the currently executed schedule entry.
      Since:
      4.0.17
      See Also:
    • getProject

      @Nullable @Nullable Project getProject()
      Returns the project the currently running schedule entry belongs to.
      Since:
      4.0.52
      See Also:
    • getUserService

      @NotNull @NotNull UserService getUserService()
      the user service for the project of executed schedule entry
      Throws:
      IllegalStateException - if the schedule entry is not project dependent
      Since:
      4.0.17
    • getPath

      String getPath()
      For generation this will return a path to
        $CMS_SERVER_ROOT$/www/project_$PROJECT_ID$/$SCHEDULE_ENTRY_ID$/
      for all other schedule entries
        $CMS_SERVER_ROOT$/schedule/$SCHEDULE_ENTRY_ID$/
      Since:
      4.0.17
    • getVariableNames

      Set<String> getVariableNames()
      Gets a list of all variable names which were set by setVariable(String,java.io.Serializable)
      Returns:
      List - list of variable names
      Since:
      4.0.17
    • getVariable

      Object getVariable(String name)
      Returns the variable value of the variable from this context specified by the given name.
      Parameters:
      name - the name of the variable to get the value for
      Since:
      4.0.17
      See Also:
    • setVariable

      void setVariable(String name, Serializable value)
      Sets a variable to this context. This variable will be hold persistent beyond the schedule execution.
      Use setProperty(String,Object) to set a property only for the time of the schedule execution.
      Parameters:
      name - name of the variable
      value - value of the variable
      Throws:
      IllegalArgumentException - if the value is not serializable
      Since:
      4.0.17
      See Also:
    • removeVariable

      void removeVariable(String name)
      Removes the variable with the given name from the context.
      Parameters:
      name - the name of variable to be removed
      Since:
      4.0.17
    • setProperty

      void setProperty(String name, Object value)
      Creates a property entry for the given value identified by the given name. The created property will be available via ScriptContext.getProperty(String) during the executionof the belonging schedule entry. To persist values beyond execution schedule execution use setVariable(String,java.io.Serializable) instead.
      Specified by:
      setProperty in interface ScriptContext
      Parameters:
      name - the name of the property
      value - the value of the property
      Since:
      4.0.17
      See Also:
    • getFatalErrorCount

      int getFatalErrorCount()
      Returns the number of fatal errors that occurred while execution.
      Since:
      4.0.17
    • getErrorCount

      int getErrorCount()
      Returns the number of errors that occurred while execution.
      Since:
      4.0.17
    • getWarningCount

      int getWarningCount()
      Returns the number of warnings that occurred while execution.
      Since:
      4.0.17
    • setStateToFailed

      void setStateToFailed()
      Sets the run state of this execution to failed.
      Since:
      4.0.17
      See Also:
    • setStateToSuccess

      void setStateToSuccess()
      Sets the run state of this execution to successful.
      Since:
      4.0.17
      See Also:
    • isStateFailed

      boolean isStateFailed()
      Returns true if the current run state of this execution is set to failed.
      Since:
      4.0.17
      See Also:
    • isStateSuccess

      boolean isStateSuccess()
      Returns true if the current run state of this execution is set to successful.
      Since:
      4.0.17
      See Also:
    • getStartTime

      Date getStartTime()
      Get the start time - the start time is not necessarily the time the schedule entry has been startet - see setStartTime(java.util.Date).
      Since:
      4.0.28
    • setStartTime

      void setStartTime(@NotNull @NotNull Date value)
      Set the start time, e.g. to generate an old version of the project. The start time is set to the time of the next fitting revision, the oldest revision with a time less or equal to the provided value.
      Since:
      4.0.28
    • addCloseable

      void addCloseable(@NotNull @NotNull Closeable closeable)
      To register closeable instances which should be closed when theschedule terminates.
      Since:
      4.0.52