Package org.openhab.core.automation
Interface RuleManager
@NonNullByDefault
public interface RuleManager
This class is responsible to provide a 
RegistryChangeListener logic. An instance of it is added to
 RuleRegistry service, to listen for changes when a single Rule has been added, updated, enabled,
 disabled or removed and to involve Rule Engine to process these changes. Also to send a run command
 for a single Rule to the Rule Engine.- Author:
 - Kai Kreuzer - Initial contribution
 
- 
Method Summary
Modifier and TypeMethodDescription@Nullable RuleStatusUtility method which getsRuleStatusof the specifiedRule.@Nullable RuleStatusInfogetStatusInfo(String ruleUID) This method getsRuleStatusInfoof the specifiedRule.@Nullable BooleanThis method gets enabledRuleStatusfor aRule.The method skips the triggers and the conditions and directly executes the actions of the rule.Same asrunNow(String)with the additional option to enable/disable evaluation of conditions defined in the target rule.voidsetEnabled(String uid, boolean isEnabled) This method is used for changing enabled state of theRule.simulateRuleExecutions(ZonedDateTime from, ZonedDateTime until) Simulates the execution of all rules with tag 'Schedule' for the given time interval. 
- 
Method Details
- 
isEnabled
This method gets enabledRuleStatusfor aRule. The enabled rule statuses areRuleStatus.UNINITIALIZED,RuleStatus.IDLEandRuleStatus.RUNNING. The disabled rule status isRuleStatus.UNINITIALIZEDwithRuleStatusDetail.DISABLED.- Parameters:
 ruleUID- UID of theRule- Returns:
 truewhen theRuleStatusis one of theRuleStatus.UNINITIALIZEDwith any otherRuleStatusDetailthanRuleStatusDetail.DISABLED,RuleStatus.IDLEandRuleStatus.RUNNING,falsewhen it isRuleStatus.UNINITIALIZEDwithRuleStatusDetail.DISABLEDandnullwhen it is not available.
 - 
setEnabled
This method is used for changing enabled state of theRule. The enabled rule statuses areRuleStatus.UNINITIALIZED,RuleStatus.IDLEandRuleStatus.RUNNING. The disabled rule status isRuleStatus.UNINITIALIZEDwithRuleStatusDetail.DISABLED. - 
getStatusInfo
This method getsRuleStatusInfoof the specifiedRule.- Parameters:
 ruleUID- UID of theRule- Returns:
 RuleStatusInfoobject containing status of the lookingRuleor null when a rule with specified UID does not exist.
 - 
getStatus
Utility method which getsRuleStatusof the specifiedRule.- Parameters:
 ruleUID- UID of theRule- Returns:
 RuleStatusobject containing status of the lookingRuleor null when a rule with specified UID does not exist.
 - 
runNow
The method skips the triggers and the conditions and directly executes the actions of the rule. This should always be possible unless an action has a mandatory input that is linked to a trigger. In that case the action is skipped and the rule engine continues execution of rest actions.- Parameters:
 uid- id of the rule whose actions have to be executed.- Returns:
 - a copy of the rule context, including possible return values
 
 - 
runNow
Map<String,Object> runNow(String uid, boolean considerConditions, @Nullable Map<String, Object> context) Same asrunNow(String)with the additional option to enable/disable evaluation of conditions defined in the target rule. The context can be set here, too, but also might benull.- Parameters:
 uid- id of the rule whose actions have to be executed.considerConditions- iftruethe conditions of the rule will be checked.context- the context that is passed to the conditions and the actions of the rule.- Returns:
 - a copy of the rule context, including possible return values
 
 - 
simulateRuleExecutions
Simulates the execution of all rules with tag 'Schedule' for the given time interval. The result is sorted ascending by execution time.- Parameters:
 from-ZonedDateTimeearliest time to be contained in the rule simulation.until-ZonedDateTimelatest time to be contained in the rule simulation.- Returns:
 - A 
Streamwith all expectedRuleExecution. 
 
 -