public interface RuleBuilder
RuleBuilder
objects can be instantiated via the MassManagementEngine.createRuleBuilder(String)
method.
Example:
RuleEngine engine = ...
RuleBuilder builder = engine.createRuleBuilder("My Rule");
Rule rule =
builder.setDeviceScope("ROOT/", null)
.addTriger(ManualTrigger.create(), null, false)
.setAction("target.consoleCommand('config.ls')")
.buildRule();
rule.enable();
rule.fire();
Modifier and Type | Method and Description |
---|---|
RuleBuilder |
addTriger(TriggerFireDef fire,
String triggerConditionScript)
Deprecated.
syntax error here, pls use addTrigger(...)
|
RuleBuilder |
addTrigger(TriggerFireDef fire,
String triggerConditionScript)
Adds a trigger definition to this Rule.
|
CompletionStage<Rule> |
buildRule()
Assembles all Rule parameters set via this builder and creates the built Rule object.
|
RuleBuilder |
setAction(String actionType,
org.eclipse.ditto.json.JsonObject actionDef)
Defines the Rule action.
|
RuleBuilder |
setAutoDisable(boolean autoDisable)
Defines whether the Rule should be automatically disabled once all targets from the Scope pass through the triggering conditions.
|
RuleBuilder |
setConcurrency(int limit,
int timeoutSeconds)
Defines concurrency limit execution option.
|
RuleBuilder |
setDeviceIdsList(String... deviceIds)
Deprecated.
pls use public TaskBuilder setDeviceScopeIdsList(String... deviceIds);
|
RuleBuilder |
setDeviceScopeFilter(String filter) |
RuleBuilder |
setDeviceScopeFilterNamespaces(String namespaces) |
RuleBuilder |
setDeviceScopeFilterOption(String option) |
RuleBuilder |
setDeviceScopeGroup(Optional<String> groupId) |
RuleBuilder |
setDeviceScopeIdsList(String... deviceIds) |
RuleBuilder |
setDeviceScopeIsMemberScript(String isMemberScript) |
RuleBuilder |
setDeviceScopeListingScript(String listingScript) |
RuleBuilder |
setGeneralCondition(String triggerConditionScript)
Sets the general condition for the Rule triggers.
|
RuleBuilder |
setOncePerDeviceFlag(boolean oncePerDevice)
Defines whether the Rule can be executed multiple times on a given device, or should be executed only once,
skipping subsequent triggers for that device.
|
RuleBuilder |
setOverlapping(ExecOptions.Overlapping option)
Sets
ExecOptions.Overlapping execution option to the created Rule. |
RuleBuilder |
setSystemScope()
Sets the built-up Rule to have System scope.
|
RuleBuilder |
setTimeConstraint(String timeConstraint)
Defines at what time-schedule it is permitted for the Rule to act.
|
RuleBuilder setSystemScope()
RuleBuilder
having the changes applied.RuleBuilder setDeviceScopeGroup(Optional<String> groupId)
RuleBuilder setDeviceScopeFilter(String filter)
RuleBuilder setDeviceScopeFilterOption(String option)
RuleBuilder setDeviceScopeFilterNamespaces(String namespaces)
RuleBuilder setDeviceScopeIsMemberScript(String isMemberScript)
RuleBuilder setDeviceScopeListingScript(String listingScript)
RuleBuilder setDeviceScopeIdsList(String... deviceIds)
RuleBuilder setDeviceIdsList(String... deviceIds)
deviceIds
- device idRuleBuilder
having the changes applied.RuleBuilder addTriger(TriggerFireDef fire, String triggerConditionScript)
fire
- fire definitiontriggerConditionScript
- trigger condition scriptRuleBuilder
having the changes applied.RuleBuilder addTrigger(TriggerFireDef fire, String triggerConditionScript)
TriggerFireDef
, condition and sync
option. All triggers then go under an option general condition
specified via the setGeneralCondition(String)
method.fire
- Fire definition.triggerConditionScript
- trigger condition.RuleBuilder
having the changes applied.IllegalArgumentException
- if fire
supplied parameter is null
.RuleBuilder setGeneralCondition(String triggerConditionScript)
true
or false
.triggerConditionScript
- general condition in the form of a groovy script.RuleBuilder
having the changes applied.RuleBuilder setOverlapping(ExecOptions.Overlapping option)
ExecOptions.Overlapping
execution option to the created Rule.option
- overlapping option.RuleBuilder
having the changes applied.RuleBuilder setConcurrency(int limit, int timeoutSeconds)
limit
- concurrency limit number.timeoutSeconds
- timeout after which the execution if not confirmed is removed from concurrency number
and space is freed for other one.RuleBuilder
having the changes applied.RuleBuilder setOncePerDeviceFlag(boolean oncePerDevice)
oncePerDevice
- flag indicating whether the Rule should be triggered no more than once for the same device.RuleBuilder
having the changes applied.RuleBuilder setAutoDisable(boolean autoDisable)
setOncePerDeviceFlag(boolean)
set to
true
.autoDisable
- flag indicating whether autoDisable
option is switched on.RuleBuilder
having the changes applied.RuleBuilder setTimeConstraint(String timeConstraint)
timeConstraint
- time schedule constraint definition.RuleBuilder
having the changes applied.RuleBuilder setAction(String actionType, org.eclipse.ditto.json.JsonObject actionDef)
actionType
- the type of the action provideractionDef
- the Rule action provided as json object with needed action definition data.RuleBuilder
having the changes applied.CompletionStage<Rule> buildRule()
Rule
object representing built up Rule.IllegalArgumentException
- if Task parameters are inconsistent or not correct.Copyright © 2022 Bosch.IO GmbH. All rights reserved.