public interface RuleEngine
RuleEngine service provides functionality for appointing and monitoring of Task executions
and automation Rules over the mPRM System and devices managed by mPRM.| Modifier and Type | Method and Description |
|---|---|
void |
addRuleListener(RuleListener ruleListener,
java.util.Map<java.lang.String,java.lang.Object> listenerProps)
Registers Rule listener for receiving event notifications about created/deleted Rules in the system Tasks, changes in Task
as well as changes in Rules states.
|
void |
addTaskListener(TaskListener taskListener,
java.util.Map<java.lang.String,java.lang.Object> listenerProps)
Registers Task listener for receiving event notifications about launched Tasks, changes in Task
progress, etc.
|
Rule |
createRule(java.lang.String ruleDef)
Creates a Rule by given JSON-encoded Rule definition.
|
Rule |
createRule(java.lang.String ruleDisplayName,
Scope scope,
Trigger trigger,
ExecOptions options,
java.lang.String actionScript)
Creates a Rule with given attributes - display name, execution scope, trigger definition, execution options and groovy script text.
|
RuleBuilder |
createRuleBuilder(java.lang.String ruleName)
Returns RuleBuilder service for convenient building of a Rule via multiple set-methods.
|
TaskBuilder |
createTaskBuilder(java.lang.String taskName)
Returns TaskBuilder service for convenient building of a Task via multiple set-methods.
|
void |
fireAllRules()
Fires all Rules that have
TriggerEvent.getTriggerMode() equal to TriggerMode#MANAUL in some of
their TriggerElements. |
EventsMetadata[] |
getEventsMetadata()
Provides metadata information about the available events dedicated for triggering of Rules with functional event
trigger -
FunctionalEventTrigger. |
DeviceExecItem |
getExecItem(java.lang.String execItemId)
Retrieves a partial execution report -
DeviceExecItem - by given execution item id. |
Rule |
getRule(java.lang.String ruleId)
Retrieves a Rule by given Rule Id.
|
Task |
getTask(java.lang.String taskId)
Retrieves a Task by given Task Id.
|
Task |
launchTask(java.lang.String taskDef)
Launches a Task by given JSON-encoded Task definition.
|
Task |
launchTask(java.lang.String displayName,
Scope scope,
ExecOptions options,
java.lang.String actionScript)
Launches a Task with given attributes - display name, execution scope, execution options and groovy script text.
|
<any> |
listExecutionsForDevice(java.lang.String deviceType,
java.lang.String deviceId,
DeviceExecStatus.State execStatusFilter)
Retrieves all execution items for a given device.
|
<any> |
listRules()
Retrieves all Rule available in mPRM.
|
FilteredSet<Rule> |
listRules(java.lang.String ruleFilter)
Retrieves all Rules available in mPRM that satisfy given filtering criteria.
|
<any> |
listRulesForDevice(java.lang.String deviceType,
java.lang.String deviceId,
DeviceExecStatus.State execStatusFilter)
Retrieves all Rules and respective execution status for a given device.
|
<any> |
listTasks()
Retrieves all Tasks available in mPRM.
|
FilteredSet<Task> |
listTasks(java.lang.String taskFilter)
Retrieves all Tasks available in mPRM that satisfy given filtering criteria.
|
<any> |
listTasksForDevice(java.lang.String deviceType,
java.lang.String deviceId,
DeviceExecStatus.State execStatusFilter,
boolean freeTasks)
Retrieves all Tasks and respective execution status for a given device.
|
void |
removeRuleListener(RuleListener ruleListener)
Unregisters Rule listener.
|
void |
removeTaskListener(TaskListener taskListener)
Unregisters Task listener.
|
Task launchTask(java.lang.String displayName, Scope scope, ExecOptions options, java.lang.String actionScript) throws ManagementException
displayName - user-friendly display name of the Task.scope - defines the execution scope of the Task to be launched.
The Task could be system-scoped or device-scoped and could cover arbitrary set of respective targets.options - defines the execution options of the Task.
Note, that the only options applicable for the Task executions are
ExecOptions#overlap(com.prosyst.mprm.admin.rule.ExecOptions.Overlapping)
and {@link ExecOptions#timeConstraint(com.prosyst.mprm.rule.time.constraint.TimeConstraint)}.
All other options defined in @link {@link ExecOptions} class (including those two) are applicable for Rules.actionScript - the Task action provided as groovy script.Task object representing the launched Task.ManagementException - if system error occurs.java.lang.IllegalArgumentException - if Task parameters are inconsistent or not correct.Task launchTask(java.lang.String taskDef) throws ManagementException
taskDef - JSON-encoded Task definition containing all elements from launchTask(String, Scope, ExecOptions, String)ManagementException - if system error occurs.java.lang.IllegalArgumentException - if Task parameters are inconsistent or not correct.TaskBuilder createTaskBuilder(java.lang.String taskName) throws ManagementException
taskName - display name of the new Task.ManagementException - if system error occurs.Task getTask(java.lang.String taskId) throws ManagementException
taskId - task id.Task object representing the current monitoring state of the requested Task
or null if Task with the provided Task Id does not exist.ManagementException - if system error occurs.<any> listTasks()
throws ManagementException
Task objects representing the monitoring state of each retrieved Task.ManagementException - if system error occurs.FilteredSet<Task> listTasks(java.lang.String taskFilter) throws ManagementException
taskFilter - a filter in mPRM-Filter syntax over the Task attributes. ((errorCount > 0 | state == 2) & (ruleId != "R5K2A92DX8J" | !(action includes "myService.myMethod()")))
true when the execution is paused die to time constraint restrictions.
nextResume - corresponds to resume time (in milliseconds since 1 Jan 1970) if the Task is currently paused.
nextPause - corresponds to next pause time (in milliseconds since 1 Jan 1970) if the Task is currently not paused.
taskId - string value corresponding to the task id.
ruleId - string value corresponding to the rule id if the Task originates from a Rule trigger.
user - string value corresponding to the user name of the user that has launched the Task.
action - string value corresponding to groovy script of the Task action.
displayName - string value corresponding Task display name.FilteredSet from which the list of Tasks satisfying the filter could be listed
(see: FilteredSet#listTasks()) and arbitrary Tasks (potentially caught by events) could be matched
if they satisfy the filtering criteria of the FilteredSet. See FilteredSet#match(Object)).ManagementException - if system error occurs.<any> listTasksForDevice(java.lang.String deviceType,
java.lang.String deviceId,
DeviceExecStatus.State execStatusFilter,
boolean freeTasks)
throws ManagementException
deviceType - device type.deviceId - device id.execStatusFilter - execution status filter.freeTasks - value of true specifies that only Task executions not bound to any Rule should be retrieved,
while value of false specifies all task executions to be retrieved (including those bound to rules).DeviceTaskStatus objects - one for each Task the given device is involved in.ManagementException - if system error occurs.<any> listExecutionsForDevice(java.lang.String deviceType,
java.lang.String deviceId,
DeviceExecStatus.State execStatusFilter)
throws ManagementException
deviceType - device type.deviceId - device id.execStatusFilter - execution status filter.DeviceExecItem objects - one for each execution the given device is involved in.ManagementException - if system error occurs.DeviceExecItem getExecItem(java.lang.String execItemId) throws ManagementException
DeviceExecItem - by given execution item id.execItemId - execution item id.ManagementException - if system error occurs.void addTaskListener(TaskListener taskListener, java.util.Map<java.lang.String,java.lang.Object> listenerProps) throws ManagementException
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.Rule createRule(java.lang.String ruleDisplayName, Scope scope, Trigger trigger, ExecOptions options, java.lang.String actionScript) throws ManagementException
ruleDisplayName - user-friendly display name of the Rule.scope - defines the initial execution scope of the Rule.
The Rule could be system-scoped or device-scoped and could cover arbitrary set of respective targets.trigger - defines the triggering criteria for the Rule.options - defines the execution options of the Rule.actionScript - the Rule action provided as groovy script.Rule object representing the created Rule.ManagementException - if system error occurs.java.lang.IllegalArgumentException - if Rule parameters are inconsistent or not correct.Rule createRule(java.lang.String ruleDef) throws ManagementException
ruleDef - JSON-encoded Rule definition containing
all elements from createRule(String, Scope, Trigger, ExecOptions, String)Rule object representing the created Rule.ManagementException - if system error occurs.java.lang.IllegalArgumentException - if Rule parameters are inconsistent or not correct.RuleBuilder createRuleBuilder(java.lang.String ruleName) throws ManagementException
rulesName - display name of the new Task.ManagementException - if system error occurs.Rule getRule(java.lang.String ruleId) throws ManagementException
ruleId - task id.Rule object representing the current monitoring state of the requested Rule
or null if Rule with the provided Rule Id does not exist.ManagementException - if system error occurs.<any> listRules()
throws ManagementException
Rule objects representing the monitoring state of each retrieved Rule.ManagementException - if system error occurs.FilteredSet<Rule> listRules(java.lang.String ruleFilter) throws ManagementException
ruleFilter - a filter in mPRM-Filter syntax over the Rule attributes. ((errorCount > 0 | state == 2) & (ruleId != "R5K2A92DX8J" | !(action includes "myService.myMethod()")))
FilteredSet from which the list of Rules satisfying the filter could be listed
(see: FilteredSet#listRules())and arbitrary Rules (potentially caught by events) could be matched
if they satisfy the current filtering criteria of the FilteredSet. See FilteredSet#match(Rule).ManagementException - if system error occurs.<any> listRulesForDevice(java.lang.String deviceType,
java.lang.String deviceId,
DeviceExecStatus.State execStatusFilter)
throws ManagementException
deviceType - device type.deviceId - device id.execStatusFilter - execution status filter.DeviceRuleStatus objects - one for each Rule the given device is involved in.ManagementException - if system error occurs.void addRuleListener(RuleListener ruleListener, java.util.Map<java.lang.String,java.lang.Object> listenerProps) throws ManagementException
listenerProps - registration properties of the Rule listener. Here filtering on the desired event types
could be supplied using RuleListener.RULE_EVENT_FILTER as a key and array of RuleEventType-s as a value.ManagementException - if system error occurs.void removeRuleListener(RuleListener ruleListener)
ruleListener - user-implemented listener interface.void fireAllRules()
throws ManagementException
TriggerEvent.getTriggerMode() equal to TriggerMode#MANAUL in some of
their TriggerElements.ManagementException - if system error occurs.EventsMetadata[] getEventsMetadata() throws ManagementException
FunctionalEventTrigger. The metadata is organized hierarchically to facilitate the good-ordering
of potentially many possible events.ManagementException - if system error occurs.Copyright © 2019 Bosch Software Innovations GmbH. All Rights Reserved.