Search in sources :

Example 1 with Rule

use of org.eclipse.smarthome.model.rule.rules.Rule in project smarthome by eclipse.

the class RuleEngineImpl method executeRules.

protected synchronized void executeRules(Iterable<Rule> rules, Item item, Command command) {
    for (Rule rule : rules) {
        RuleEvaluationContext context = new RuleEvaluationContext();
        context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_TRIGGERING_ITEM), item);
        context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_RECEIVED_COMMAND), command);
        executeRule(rule, context);
    }
}
Also used : Rule(org.eclipse.smarthome.model.rule.rules.Rule)

Example 2 with Rule

use of org.eclipse.smarthome.model.rule.rules.Rule in project smarthome by eclipse.

the class RuleEngineImpl method executeRules.

protected synchronized void executeRules(Iterable<Rule> rules, ChannelTriggeredEvent event) {
    for (Rule rule : rules) {
        RuleEvaluationContext context = new RuleEvaluationContext();
        context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_RECEIVED_EVENT), event);
        executeRule(rule, context);
    }
}
Also used : Rule(org.eclipse.smarthome.model.rule.rules.Rule)

Example 3 with Rule

use of org.eclipse.smarthome.model.rule.rules.Rule in project smarthome by eclipse.

the class RuleEngineImpl method executeRules.

protected synchronized void executeRules(Iterable<Rule> rules) {
    for (Rule rule : rules) {
        RuleEvaluationContext context = new RuleEvaluationContext();
        executeRule(rule, context);
    }
}
Also used : Rule(org.eclipse.smarthome.model.rule.rules.Rule)

Example 4 with Rule

use of org.eclipse.smarthome.model.rule.rules.Rule in project smarthome by eclipse.

the class RuleEngineImpl method executeRules.

protected synchronized void executeRules(Iterable<Rule> rules, Item item) {
    for (Rule rule : rules) {
        RuleEvaluationContext context = new RuleEvaluationContext();
        context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_TRIGGERING_ITEM), item);
        executeRule(rule, context);
    }
}
Also used : Rule(org.eclipse.smarthome.model.rule.rules.Rule)

Example 5 with Rule

use of org.eclipse.smarthome.model.rule.rules.Rule in project smarthome by eclipse.

the class RuleEngineImpl method executeRules.

protected synchronized void executeRules(Iterable<Rule> rules, Item item, State oldState) {
    for (Rule rule : rules) {
        RuleEvaluationContext context = new RuleEvaluationContext();
        context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_TRIGGERING_ITEM), item);
        context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_PREVIOUS_STATE), oldState);
        executeRule(rule, context);
    }
}
Also used : Rule(org.eclipse.smarthome.model.rule.rules.Rule)

Aggregations

Rule (org.eclipse.smarthome.model.rule.rules.Rule)18 ChangedEventTrigger (org.eclipse.smarthome.model.rule.rules.ChangedEventTrigger)5 CommandEventTrigger (org.eclipse.smarthome.model.rule.rules.CommandEventTrigger)5 EventTrigger (org.eclipse.smarthome.model.rule.rules.EventTrigger)5 GroupMemberChangedEventTrigger (org.eclipse.smarthome.model.rule.rules.GroupMemberChangedEventTrigger)5 GroupMemberCommandEventTrigger (org.eclipse.smarthome.model.rule.rules.GroupMemberCommandEventTrigger)5 GroupMemberUpdateEventTrigger (org.eclipse.smarthome.model.rule.rules.GroupMemberUpdateEventTrigger)5 ThingStateChangedEventTrigger (org.eclipse.smarthome.model.rule.rules.ThingStateChangedEventTrigger)5 ThingStateUpdateEventTrigger (org.eclipse.smarthome.model.rule.rules.ThingStateUpdateEventTrigger)5 UpdateEventTrigger (org.eclipse.smarthome.model.rule.rules.UpdateEventTrigger)5 ArrayList (java.util.ArrayList)3 Command (org.eclipse.smarthome.core.types.Command)3 State (org.eclipse.smarthome.core.types.State)3 HashSet (java.util.HashSet)2 ThingStatus (org.eclipse.smarthome.core.thing.ThingStatus)2 Script (org.eclipse.smarthome.model.script.engine.Script)2 ScriptExecutionException (org.eclipse.smarthome.model.script.engine.ScriptExecutionException)2 Collection (java.util.Collection)1 Set (java.util.Set)1 CopyOnWriteArraySet (java.util.concurrent.CopyOnWriteArraySet)1