public interface Task
Modifier and Type | Interface and Description |
---|---|
static class |
Task.State
Defines possible Task states.
|
Modifier and Type | Method and Description |
---|---|
CompletionStage<Void> |
cancel()
Cancels the execution of this Task.
|
CompletionStage<Void> |
delete()
Deletes the Task.
|
org.eclipse.ditto.json.JsonObject |
getAction()
Returns the action for this Task.
|
String |
getDisplayName()
Returns the user-friendly display name of this Task.
|
ExecOptions |
getExecutionOptions()
Returns the execution options with which this Task has been launched.
|
Date |
getFinishTime()
Returns the Task finish time.
|
CompletionStage<Integer> |
getInvolvedDevicesCount(DeviceExecStatus.State deviceExecState)
Calculates the count of involved devices with given execution status in this Task.
|
CompletionStage<DeviceTaskStatus> |
getInvolvedDeviceState(String deviceId)
Returns the execution status of a given device within this Task.
|
Date |
getLaunchTime()
Returns the Task launch time.
|
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. |
Date |
getNextResumeTime()
In case the Task execution is currently paused (see
isTimePaused() ),
this method calculates the time at which the execution will resume. |
CompletionStage<Map<String,Object>> |
getProperties()
Returns custom properties assigned to this Task.
|
CompletionStage<Object> |
getProperty(String key)
Gets the value of a Task property by property name.
|
CompletionStage<Optional<Rule>> |
getRule()
Returns the Rule initiated this Task or
null if Task was manually launched by user via
MassManagementEngine.launchTask(String) , MassManagementEngine.launchTask(TaskParameters) or
MassManagementEngine.launchTask(String, Scope, ExecOptions, Action) . |
Scope |
getScope()
Returns the Task scope.
|
Task.State |
getState()
Returns the state of this Task.
|
String |
getStateDescription()
May return a text message explaining the Task state.
|
String |
getTaskId()
Returns the id of this Task.
|
String |
getTextRepresentation() |
boolean |
isTimePaused()
Tells whether the Task execution is currently paused due to time-constraint restrictions,
see
ExecOptions.getConcurrencyLimit() . |
CompletionStage<List<DeviceTaskStatus>> |
listInvolvedDevices(DeviceExecStatus.State deviceExecState)
Retrieves a list of all involved devices into this Task with the respective execution status for each device.
|
com.bosch.iot.dm.util.PageIterator<DeviceTaskStatus> |
listInvolvedDevices(DeviceExecStatus.State deviceExecState,
int pageSize) |
CompletionStage<Void> |
retryDevice(String deviceId)
Retry for a device
|
CompletionStage<Void> |
retryDevices(DeviceExecStatus.State[] statusFilter)
Retries for all devices in these states
|
CompletionStage<Void> |
setProperties(Map<String,Object> properties,
boolean append)
Sets the custom Task properties.
|
CompletionStage<Void> |
setProperty(String key,
Object value)
Sets custom Task property.
|
void |
subscribeForTaskEvents(List<TaskEvent.Type> eventTypes,
StreamConsumer<TaskEvent> consumer) |
Task.State getState()
String getStateDescription()
"Task failed to launch, Reason: some reason"
for Tasks in state Task.State.FAILED_TO_LAUNCH
.Date getLaunchTime()
Date getFinishTime()
boolean isTimePaused()
ExecOptions.getConcurrencyLimit()
.true
of the Task execution is currently paused due to time-constraint restrictions, false
otherwise.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.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.CompletionStage<List<DeviceTaskStatus>> listInvolvedDevices(DeviceExecStatus.State deviceExecState)
deviceExecState
- filter on the execution status for the retrieved involved devices. For example, there could be retrieved
only devices finished with any status (use: DeviceExecStatus.State.FINISHED
or completely all involved devices
regardless of the execution status (use: DeviceExecStatus.State.ANY
)DeviceTaskStatus
objects representing the execution status of a single involved device.com.bosch.iot.dm.util.PageIterator<DeviceTaskStatus> listInvolvedDevices(DeviceExecStatus.State deviceExecState, int pageSize)
CompletionStage<DeviceTaskStatus> getInvolvedDeviceState(String deviceId)
deviceId
- device id.CompletionStage<Integer> 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 with any status (use: Task.State.FINISHED
)CompletionStage<Optional<Rule>> getRule()
null
if Task was manually launched by user via
MassManagementEngine.launchTask(String)
, MassManagementEngine.launchTask(TaskParameters)
or
MassManagementEngine.launchTask(String, Scope, ExecOptions, Action)
.ExecOptions getExecutionOptions()
Scope getScope()
org.eclipse.ditto.json.JsonObject getAction()
String getTaskId()
String getDisplayName()
CompletionStage<Void> cancel()
CompletionStage<Void> delete()
CompletionStage<Void> retryDevices(DeviceExecStatus.State[] statusFilter)
statusFilter
- status filterCompletionStage<Void> retryDevice(String deviceId)
deviceId
- device idString getTextRepresentation()
CompletionStage<Map<String,Object>> getProperties()
setProperties(Map, boolean)
and setProperty(String, Object)
methods.CompletionStage<Void> setProperties(Map<String,Object> properties, boolean append)
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.CompletionStage<Object> getProperty(String key)
key
- property nameCompletionStage<Void> setProperty(String key, Object value)
key
- property name.value
- property value.void subscribeForTaskEvents(List<TaskEvent.Type> eventTypes, StreamConsumer<TaskEvent> consumer)
Copyright © 2022 Bosch.IO GmbH. All rights reserved.