Interface ScheduleContext
- All Superinterfaces:
BaseContext
,ScriptContext
,SpecialistsBroker
A context with access to schedule entry execution-related objects.
- Since:
- 4.0.17
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.espirit.firstspirit.access.BaseContext
BaseContext.Env
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCloseable
(@NotNull Closeable closeable) To register closeable instances which should beclosed
when theschedule terminates.int
Returns the number of errors that occurred while execution.long
The id of the currentcontrol
int
Returns the number of fatal errors that occurred while execution.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$/@Nullable Project
Returns the project the currently running schedule entry belongs to.Get the start time - the start time is not necessarily the time the schedule entry has been startet - seesetStartTime(java.util.Date)
.@Nullable ScheduleTask
getTask()
the acutal task ornull
if no task is currently executedint
the index of the actual task in thetask list
or-1
if no task iscurrently executedList<? extends ScheduleTask>
getTasks()
Returns the list of schedule tasks defined by the currently executed schedule entry.@NotNull UserService
the user service for the project of executed schedule entrygetVariable
(String name) Returns the variable value of the variable from this context specified by the given name.Gets a list of all variable names which were set bysetVariable(String,java.io.Serializable)
int
Returns the number of warnings that occurred while execution.boolean
Returnstrue
if the current run state of this execution is set to failed.boolean
Returnstrue
if the current run state of this execution is set to successful.void
removeVariable
(String name) Removes the variable with the given name from the context.void
setProperty
(String name, Object value) Creates a property entry for the given value identified by the given name.void
setStartTime
(@NotNull Date value) Set the start time, e.g. to generate an old version of the project.void
Sets the run state of this execution to failed.void
Sets the run state of this execution to successful.void
setVariable
(String name, Serializable value) Sets a variable to this context.Methods inherited from interface de.espirit.firstspirit.access.BaseContext
is
Methods inherited from interface de.espirit.firstspirit.access.ScriptContext
getConnection, getProperties, getProperty, logDebug, logError, logError, logInfo, logWarning, removeProperty
Methods inherited from interface de.espirit.firstspirit.agency.SpecialistsBroker
requestSpecialist, requireSpecialist
-
Method Details
-
getExecutionId
long getExecutionId()The id of the currentcontrol
- Since:
- 5.2.221003
-
getTask
the acutal task ornull
if no task is currently executed- Since:
- 4.0.17
- See Also:
-
getTaskIndex
int getTaskIndex()the index of the actual task in thetask 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
Returns the project the currently running schedule entry belongs to.- Since:
- 4.0.52
- See Also:
-
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
Gets a list of all variable names which were set bysetVariable(String,java.io.Serializable)
- Returns:
- List - list of variable names
- Since:
- 4.0.17
-
getVariable
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
Sets a variable to this context. This variable will be hold persistent beyond the schedule execution.
UsesetProperty(String,Object)
to set a property only for the time of the schedule execution.- Parameters:
name
- name of the variablevalue
- value of the variable- Throws:
IllegalArgumentException
- if the value is not serializable- Since:
- 4.0.17
- See Also:
-
removeVariable
Removes the variable with the given name from the context.- Parameters:
name
- the name of variable to be removed- Since:
- 4.0.17
-
setProperty
Creates a property entry for the given value identified by the given name. The created property will be available viaScriptContext.getProperty(String)
during the executionof the belonging schedule entry. To persist values beyond execution schedule execution usesetVariable(String,java.io.Serializable)
instead.- Specified by:
setProperty
in interfaceScriptContext
- Parameters:
name
- the name of the propertyvalue
- 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()Returnstrue
if the current run state of this execution is set to failed.- Since:
- 4.0.17
- See Also:
-
isStateSuccess
boolean isStateSuccess()Returnstrue
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 - seesetStartTime(java.util.Date)
.- Since:
- 4.0.28
-
setStartTime
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
To register closeable instances which should beclosed
when theschedule terminates.- Since:
- 4.0.52
-