public interface Task
| Modifier and Type | Interface and Description |
|---|---|
static class |
Task.State
Defines possible Task states.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTaskListener(TaskListener taskListener,
java.util.Map<java.lang.String,java.lang.Object> listenerProps)
Registers Task listener for receiving event notifications about the current Task.
|
void |
cancel()
Cancels the execution of this Task.
|
void |
delete()
Deletes the Task.
|
java.lang.String |
getActionScript()
Returns the groovy script defining the action for this Task.
|
java.lang.String |
getDisplayName()
Returns the user-friendly display name of this Task.
|
ExecOptions |
getExecutionOptions()
Returns the execution options with which this Task has been launched.
|
java.util.Date |
getFinishTime()
Returns the Task finish time.
|
int |
getInvolvedDevicesCount(DeviceExecStatus.State deviceExecState)
Calculates the count of involved devices with given execution status in this Task.
|
DeviceTaskStatus |
getInvolvedDeviceState(java.lang.String deviceType,
java.lang.String deviceId)
Returns the execution status of a given device within this Task.
|
java.util.Date |
getLaunchTime()
Returns the Task launch time.
|
java.util.Date |
getNextPauseTime()
In case the Task execution has some concurrency limit restrictions see
ExecOptions.getConcurrencyLimit() and
is currently not paused in charge of those restriction, this method calculates the time at which the Task execution is
going to be paused. |
java.util.Date |
getNextResumeTime()
In case the Task execution is currently paused (see
isTimePaused()),
this method calculates the time at which the execution will resume. |
java.lang.String |
getOrigin()
May return a human readable description of how the Task was initiated, i.e., launched by user or automatically
launched by certain Rule and certain event.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns custom properties assigned to this Task.
|
java.lang.Object |
getProperty(java.lang.String key)
Gets the value of a Task property by property name.
|
Rule |
getRule()
Returns the Rule initiated this Task or
null if Task was manually launched by user via
RuleEngine#launchTask(Scope, String, ExecOptions). |
Scope |
getScope()
Returns the Task scope.
|
Task.State |
getState()
Returns the state of this Task.
|
java.lang.String |
getStateDescription()
May return a text message explaining the Task state.
|
java.lang.String |
getTaskId()
Returns the id of this Task.
|
java.lang.String |
getTextRepresentation() |
boolean |
isTimePaused()
Tells whether the Task execution is currently paused due to time-constraint restrictions,
see
ExecOptions.getConcurrencyLimit(). |
<any> |
listInvolvedDevices(DeviceExecStatus.State deviceExecState)
Retrieves a list of all involved devices into this Task with the respective execution status for each device.
|
void |
removeTaskListener(TaskListener taskListener)
Unregisters Task listener.
|
void |
retryDevice(java.lang.String deviceType,
java.lang.String deviceId) |
void |
retryDevices(DeviceExecStatus.State[] statusFilter) |
void |
setProperties(java.util.Map<java.lang.String,java.lang.Object> properties,
boolean append)
Sets the custom Task properties.
|
void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets custom Task property.
|
Task.State getState()
java.lang.String getStateDescription()
"Task failed to launch, Reason: some reason" for Tasks in state Task.State.FAILED_TO_LAUNCH.ManagementException - if system error occurs.java.util.Date getLaunchTime()
java.util.Date getFinishTime()
boolean isTimePaused()
ExecOptions.getConcurrencyLimit().true of the Task execution is currently paused due to time-constraint restrictions, false otherwise.java.util.Date getNextResumeTime()
isTimePaused()),
this method calculates the time at which the execution will resume. In case the execution is currently not paused,
the result produced by this method is not meaningful.java.util.Date getNextPauseTime()
ExecOptions.getConcurrencyLimit() and
is currently not paused in charge of those restriction, this method calculates the time at which the Task execution is
going to be paused.<any> listInvolvedDevices(DeviceExecStatus.State deviceExecState) throws ManagementException
deviceExecState - filter on the execution status for the retrieved involved devices. For example, there could be retrieved
only devices that have finished the Task execution with error (use: DeviceExecStatus.State.FINISHED_ERROR)
or devices that have finished with any status (use: DeviceExecStatus.State#FINISHED) or completely all involved devices
regardless of the execution status (use: {@link DeviceExecStatus.State#ANY})DeviceTaskStatus objects representing the execution status of a single involved device.ManagementException - if system error occurs.DeviceTaskStatus getInvolvedDeviceState(java.lang.String deviceType, java.lang.String deviceId) throws ManagementException
deviceType - device type.deviceId - device id.ManagementException - if system error occurs.int getInvolvedDevicesCount(DeviceExecStatus.State deviceExecState)
deviceExecState - filter on the execution status for the counted involved devices. For example, there could be counted
only devices that have finished the Task execution with error (use: State#FINISHED_ERROR)
or devices that have finished with any status (use: Task.State.FINISHED) or completely all involved devices
regardless of the execution status (use: State#FINISHED_ANY)ManagementException - if system error occurs.java.lang.IllegalArgumentException - if the supplied parameter is not an expected Task.State value.java.lang.String getOrigin()
Rule getRule()
null if Task was manually launched by user via
RuleEngine#launchTask(Scope, String, ExecOptions).ExecOptions getExecutionOptions()
Scope getScope()
java.lang.String getActionScript()
java.lang.String getTaskId()
java.lang.String getDisplayName()
void cancel()
throws ManagementException
ManagementException - if system error occurs.void delete()
throws ManagementException
ManagementException - if system error occurs.void retryDevices(DeviceExecStatus.State[] statusFilter) throws ManagementException
statusFilter - ManagementExceptionvoid retryDevice(java.lang.String deviceType,
java.lang.String deviceId)
throws ManagementException
deviceType - deviceId - ManagementExceptionvoid addTaskListener(TaskListener taskListener, java.util.Map<java.lang.String,java.lang.Object> listenerProps) throws ManagementException
taskListener - user-implemented listener interface.listenerProps - registration properties of the Task listener. Here filtering on the desired event types
could be supplied using TaskListener.TASK_EVENT_FILTER as a key and array of TaskEventType-s as a value.ManagementException - if system error occurs.void removeTaskListener(TaskListener taskListener)
taskListener - user-implemented listener interface.java.lang.String getTextRepresentation()
java.util.Map<java.lang.String,java.lang.Object> getProperties()
throws ManagementException
setProperties(Map, boolean)
and setProperty(String, Object) methods.ManagementExceptionvoid setProperties(java.util.Map<java.lang.String,java.lang.Object> properties,
boolean append)
throws ManagementException
properties - Task properties.append - if true the supplied properties will be appended/added to any properties currently existing for
this Task, otherwise any existing properties will be fully replaced by the supplied ones.ManagementException - if system error occurs.java.lang.Object getProperty(java.lang.String key)
throws ManagementException
key - property nameManagementExceptionvoid setProperty(java.lang.String key,
java.lang.Object value)
throws ManagementException
key - property name.value - property value.ManagementException - if system error occurs.Copyright © 2019 Bosch Software Innovations GmbH. All Rights Reserved.