Interface RulesService

  • All Known Implementing Classes:
    RulesServiceImpl

    public interface RulesService
    A service to access and operate on Rules.
    • Method Detail

      • getRuleMetadatas

        Set<Metadata> getRuleMetadatas()
        Retrieves the metadata for all known rules.
        Returns:
        the Set of known metadata
      • getRuleMetadatas

        PartialList<Metadata> getRuleMetadatas​(Query query)
        Retrieves rule metadatas for rules matching the specified Query.
        Parameters:
        query - the query the rules which metadata we want to retrieve must match
        Returns:
        a PartialList of rules metadata for the rules matching the specified query
      • getRuleDetails

        PartialList<Rule> getRuleDetails​(Query query)
        Retrieves rule details for rules matching the specified query.
        Parameters:
        query - the query specifying which rules to retrieve
        Returns:
        a PartialList of rule details for the rules matching the specified query
      • getAllRules

        List<Rule> getAllRules()
        Get all rules available in the system. (This is not doing a persistence query to retrieve the rules, it's using the internal in memory cache that is refreshed every second by default but can vary depending on your own configuration)
        Returns:
        all rules available.
      • getRule

        Rule getRule​(String ruleId)
        Retrieves the rule identified by the specified identifier.
        Parameters:
        ruleId - the identifier of the rule we want to retrieve
        Returns:
        the rule identified by the specified identifier or null if no such rule exists.
      • getRuleStatistics

        RuleStatistics getRuleStatistics​(String ruleId)
        Retrieves the statistics for a rule
        Parameters:
        ruleId - the identifier of the rule
        Returns:
        a long representing the number of times the rule was matched and executed.
      • getAllRuleStatistics

        Map<String,​RuleStatistics> getAllRuleStatistics()
        Retrieves the statistics for all the rules
        Returns:
        a map containing rule IDs as key, and the RuleStatistics object as a value
      • resetAllRuleStatistics

        void resetAllRuleStatistics()
        Resets all the rule statistics to zero, useful when testing or if you want to set a point in time.
      • setRule

        void setRule​(Rule rule)
        Persists the specified rule to the context server.
        Parameters:
        rule - the rule to be persisted
      • removeRule

        void removeRule​(String ruleId)
        Deletes the rule identified by the specified identifier.
        Parameters:
        ruleId - the identifier of the rule we want to delete
      • getTrackedConditions

        Set<Condition> getTrackedConditions​(Item item)
        Retrieves tracked conditions (rules with a condition marked with the trackedCondition tag and which sourceEventCondition matches the specified item) for the specified item.
        Parameters:
        item - the item which tracked conditions we want to retrieve
        Returns:
        the Set of tracked conditions for the specified item
      • getMatchingRules

        Set<Rule> getMatchingRules​(Event event)
        Retrieves all the matching rules for a specific event
        Parameters:
        event - the event we want to retrieve all the matching rules for
        Returns:
        a set of rules that match the event passed in the parameters
      • refreshRules

        void refreshRules()
        Refresh the rules for this instance by reloading them from the persistence backend