Package org.openremote.manager.rules
Class RulesFacts
java.lang.Object
org.jeasy.rules.api.Facts
org.openremote.manager.rules.RulesFacts
- All Implemented Interfaces:
Iterable<org.jeasy.rules.api.Fact<?>>,org.jeasy.rules.api.RuleListener
public class RulesFacts
extends org.jeasy.rules.api.Facts
implements org.jeasy.rules.api.RuleListener
NOTE: THIS IS NOT THREADSAFE
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected final org.openremote.model.rules.Assetsprotected final AssetStorageServicestatic final Stringstatic final intprotected final Loggerprotected final Objectstatic final intprotected final org.openremote.container.timer.TimerServiceprotected booleanprotected int -
Constructor Summary
ConstructorsConstructorDescriptionRulesFacts(org.openremote.container.timer.TimerService timerService, AssetStorageService assetStorageService, org.openremote.model.rules.Assets assetsFacade, Object loggingContext, Logger logger) -
Method Summary
Modifier and TypeMethodDescriptionvoidafterEvaluate(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts, boolean evaluationResult) static Comparator<org.openremote.model.attribute.AttributeInfo> asComparator(org.openremote.model.query.AssetQuery.OrderBy orderBy) booleanbeforeEvaluate(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts) voidbeforeExecute(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts) <T> T<T> TCollection<org.openremote.model.attribute.AttributeInfo> org.openremote.model.rules.RulesClockgetClock()long<T> Optional<T> getOptional(String name) Stream<org.openremote.model.rules.TemporaryFact<?>> getVars()booleanbooleanprotected voidboolean<T> Stream<T> <T> Stream<T> <T> Stream<T> Stream<org.openremote.model.attribute.AttributeInfo> matchAssetState(Predicate<org.openremote.model.attribute.AttributeInfo> p) Stream<org.openremote.model.attribute.AttributeInfo> matchAssetState(org.openremote.model.query.AssetQuery assetQuery) protected <T> Optional<T> <T> Optional<T> matchFirst(Class<T> factType) <T> Optional<T> matchFirst(Class<T> factType, Predicate<T> predicate) <T> Optional<T> matchFirst(String name) <T> Optional<T> matchFirst(String name, Class<T> factType, Predicate<T> predicate) <T> Optional<T> matchFirst(String name, Predicate<T> predicate) <T> Optional<T> matchFirst(Predicate<T> predicate) Optional<org.openremote.model.attribute.AttributeInfo> matchFirstAssetState(org.openremote.model.query.AssetQuery assetQuery) voidvoidonSuccess(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts) <T> voidputAssetState(org.openremote.model.attribute.AttributeInfo assetState) putTemporary(double expires, Object value) putTemporary(long expires, Object value) putTemporary(String name, double expires, Object value) putTemporary(String name, long expires, Object value) putTemporary(String expires, Object value) putTemporary(String name, String expires, Object value) putTemporary(Duration expires, Object value) voidremoveAssetState(org.openremote.model.attribute.AttributeInfo assetState) voidvoidreset()Reset rules triggered counter, used for loop detection.protected voidprotected List<RulesEngine.AssetLocationPredicates> protected voidstoreLocationPredicates(List<org.openremote.model.query.filter.GeofencePredicate> foundLocationPredicates) updateAssetState(String assetId, String attributeName) Deprecated.updateAssetState(String assetId, String attributeName, Object value) Deprecated.Methods inherited from class org.jeasy.rules.api.Facts
add, asMap, clear, getFact, iterator, remove, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.jeasy.rules.api.RuleListener
onEvaluationError
-
Field Details
-
MAX_RULES_TRIGGERED_PER_EXECUTION
public static final int MAX_RULES_TRIGGERED_PER_EXECUTION- See Also:
-
INITIAL_CAPACITY
public static final int INITIAL_CAPACITY- See Also:
-
ASSET_STATES
- See Also:
-
EXECUTION_VARS
- See Also:
-
ANONYMOUS_FACTS
- See Also:
-
timerService
protected final org.openremote.container.timer.TimerService timerService -
assetStorageService
-
assetsFacade
protected final org.openremote.model.rules.Assets assetsFacade -
loggingContext
-
LOG
-
triggerCount
protected int triggerCount -
trackLocationRules
protected boolean trackLocationRules -
assetStateLocationPredicateMap
-
-
Constructor Details
-
RulesFacts
public RulesFacts(org.openremote.container.timer.TimerService timerService, AssetStorageService assetStorageService, org.openremote.model.rules.Assets assetsFacade, Object loggingContext, Logger logger)
-
-
Method Details
-
startTrackingLocationRules
protected void startTrackingLocationRules() -
stopTrackingLocationRules
-
getAssetStates
-
getAnonymousFacts
-
getNamedFacts
-
getAllFacts
-
getFactCount
public long getFactCount() -
getVars
-
bind
-
bound
-
get
- Overrides:
getin classorg.jeasy.rules.api.Facts
-
getOptional
-
put
- Overrides:
putin classorg.jeasy.rules.api.Facts
-
put
-
putAssetState
-
removeAssetState
-
putTemporary
-
putTemporary
-
putTemporary
-
putTemporary
-
putTemporary
-
putTemporary
-
putTemporary
-
hasTemporaryFacts
public boolean hasTemporaryFacts() -
getTemporaryFacts
-
remove
- Overrides:
removein classorg.jeasy.rules.api.Facts
-
remove
-
reset
public void reset()Reset rules triggered counter, used for loop detection. -
beforeEvaluate
public boolean beforeEvaluate(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts) - Specified by:
beforeEvaluatein interfaceorg.jeasy.rules.api.RuleListener
-
afterEvaluate
public void afterEvaluate(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts, boolean evaluationResult) - Specified by:
afterEvaluatein interfaceorg.jeasy.rules.api.RuleListener
-
beforeExecute
public void beforeExecute(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts) - Specified by:
beforeExecutein interfaceorg.jeasy.rules.api.RuleListener
-
onSuccess
public void onSuccess(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts) - Specified by:
onSuccessin interfaceorg.jeasy.rules.api.RuleListener
-
onFailure
public void onFailure(org.jeasy.rules.api.Rule rule, org.jeasy.rules.api.Facts facts, Exception exception) - Specified by:
onFailurein interfaceorg.jeasy.rules.api.RuleListener
-
matchFact
-
matchFirst
-
matchFirst
-
matchFirst
-
matchFirst
-
matchFirst
-
matchFirst
-
match
-
match
-
match
-
matchFirstAssetState
public Optional<org.openremote.model.attribute.AttributeInfo> matchFirstAssetState(org.openremote.model.query.AssetQuery assetQuery) -
matchAssetState
public Stream<org.openremote.model.attribute.AttributeInfo> matchAssetState(org.openremote.model.query.AssetQuery assetQuery) -
matchAssetState
-
updateAssetState
Deprecated. -
updateAssetState
Deprecated. -
removeExpiredTemporaryFacts
public void removeExpiredTemporaryFacts() -
logFacts
-
logVars
-
getClock
public org.openremote.model.rules.RulesClock getClock() -
asComparator
public static Comparator<org.openremote.model.attribute.AttributeInfo> asComparator(org.openremote.model.query.AssetQuery.OrderBy orderBy) -
storeLocationPredicates
protected void storeLocationPredicates(List<org.openremote.model.query.filter.GeofencePredicate> foundLocationPredicates) -
logRule
protected void logRule(org.jeasy.rules.api.Rule rule, String msg, boolean logFacts, boolean logVars)
-