Class BlueMindRules

java.lang.Object
org.exoplatform.bluemind.mail.util.BlueMindRules

public final class BlueMindRules extends Object
eXo's server rules in BlueMind's own rule model (MailFilterRule, master 302bc396), both ways, and the marker eXo finds its rules by.

The marker. Every rule eXo writes carries client "exo", which BlueMind's webmail does not list, and in its clientProperties the kind "server-rule" under "exoKind" and eXo's reference under "exoRef". A rule without both is not eXo's, whatever its client: it is never read as eXo's, nor written, nor removed.

The vocabulary, as the live run on BlueMind 5.6.4 accepted and kept every form (EXO-90801): the conditions are one AND group of leaves, each joining the one before it by AND for "all" or OR for "any" (BlueMind ignores the first leaf's join, eXo writes it too so that "all" or "any" reads back from a single condition); text compares are BlueMind's CONTAINS with CASE_INSENSITIVE, a sub-string, the whole value or a prefix, and "does not contain" is the negated sub-string; "ends with" and "is in the domain" are BlueMind's globs (MATCHES), which have no escape for * and ? and compare case (WildcardMatcher, master 302bc396): unlike the Sieve engine's, they miss a sender whose domain is written with a capital letter -- the domain eXo is given is lower-cased -- and a subject ending the same text in another case; a size is a RANGE on the size in bytes, bounds excluded; a mailing list is one of the three list headers present; an automated mail has an Auto-Submitted header other than no. A move names the folder by BlueMind's internalId and its full name, as the webmail writes it; Junk and Trash are moves to the default folder by name, never MARK_AS_DELETED, which expunges; a star is MARK_AS_IMPORTANT; a tag is SET_FLAGS with the keyword; a forward is REDIRECT with a copy kept.

Reading back accepts exactly those forms, and a rule's reading goes through ServerRule.validated() again: anything else is a rule eXo does not read, never one it guesses.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The client every rule eXo writes carries.
    static final String
    The prefix BlueMind's delivery reads as a parameter to replace, not a text to compare (ParameterValueCoreProvider, master 302bc396).
    static final String
    The clientProperties key holding the type of the rule's filing action.
    static final String
    The clientProperties key holding the eXo key of the folder the rule files into.
    static final String
    The kind of every server rule eXo writes.
    static final String
    The clientProperties key holding the kind of eXo rule.
    static final String
    The clientProperties key holding eXo's reference of the rule.
    static final String
    Why a value is refused: BlueMind replaces a value with this prefix at delivery.
    static final String
    The client of the rules BlueMind's own webmail writes and lists.
    static final String
    Why a value is refused: BlueMind's globs cannot hold a * or a ? as text.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    The SHA-256 of eXo's rules as BlueMind holds them, in order: each rule's JSON with its members sorted and its id left out, so that a renumbering changes nothing and any change to a rule does.
    static boolean
    isActiveWebmailRule(tools.jackson.databind.JsonNode json)
    Whether a rule as BlueMind answered it is one of the webmail's own that runs on incoming mail: what the user sees and edits in BlueMind's webmail (filterRules.ts: client "bluemind", trigger IN, not deferred), generic, and switched on.
    static boolean
    isExos(tools.jackson.databind.JsonNode json)
    Whether a rule as BlueMind answered it carries eXo's marker.
    static tools.jackson.databind.node.ObjectNode
    toBlueMind(org.exoplatform.emailConnector.model.ServerRule rule, List<org.exoplatform.bluemind.client.model.BlueMindMailFolder> folders)
    The rule eXo writes for one of its server rules: the marker, the conditions and the actions in BlueMind's model.
    toExoRule(tools.jackson.databind.node.ObjectNode json)
    One of eXo's rules as BlueMind answered it, read back.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CLIENT

      public static final String CLIENT
      The client every rule eXo writes carries.
      See Also:
    • WEBMAIL_CLIENT

      public static final String WEBMAIL_CLIENT
      The client of the rules BlueMind's own webmail writes and lists.
      See Also:
    • REF_KEY

      public static final String REF_KEY
      The clientProperties key holding eXo's reference of the rule.
      See Also:
    • KIND_KEY

      public static final String KIND_KEY
      The clientProperties key holding the kind of eXo rule.
      See Also:
    • KIND

      public static final String KIND
      The kind of every server rule eXo writes.
      See Also:
    • FILING_KEY

      public static final String FILING_KEY
      The clientProperties key holding the type of the rule's filing action.
      See Also:
    • FOLDER_KEY

      public static final String FOLDER_KEY
      The clientProperties key holding the eXo key of the folder the rule files into.
      See Also:
    • WILDCARD_VALUE

      public static final String WILDCARD_VALUE
      Why a value is refused: BlueMind's globs cannot hold a * or a ? as text.
      See Also:
    • RESERVED_VALUE

      public static final String RESERVED_VALUE
      Why a value is refused: BlueMind replaces a value with this prefix at delivery.
      See Also:
    • DYNAMIC_PREFIX

      public static final String DYNAMIC_PREFIX
      The prefix BlueMind's delivery reads as a parameter to replace, not a text to compare (ParameterValueCoreProvider, master 302bc396).
      See Also:
  • Method Details

    • toBlueMind

      public static tools.jackson.databind.node.ObjectNode toBlueMind(org.exoplatform.emailConnector.model.ServerRule rule, List<org.exoplatform.bluemind.client.model.BlueMindMailFolder> folders) throws org.exoplatform.emailConnector.exception.ServerRuleUnsupportedException
      The rule eXo writes for one of its server rules: the marker, the conditions and the actions in BlueMind's model.
      Parameters:
      rule - the rule, validated, its reference set
      folders - the mailbox's folders, needed when the rule moves mail to a folder of the user's; null otherwise
      Returns:
      the rule, as BlueMind's JSON object
      Throws:
      org.exoplatform.emailConnector.exception.ServerRuleUnsupportedException - when a value cannot be written as text in BlueMind's model
      IllegalArgumentException - emailConnector.rules.folder.unresolved when the folder a move names is not in the mailbox
    • isExos

      public static boolean isExos(tools.jackson.databind.JsonNode json)
      Whether a rule as BlueMind answered it carries eXo's marker.
      Parameters:
      json - the rule
      Returns:
      true for client "exo", kind "server-rule" and a valid reference
    • toExoRule

      public static BlueMindExoRule toExoRule(tools.jackson.databind.node.ObjectNode json)
      One of eXo's rules as BlueMind answered it, read back.
      Parameters:
      json - a rule isExos(tools.jackson.databind.JsonNode) accepts
      Returns:
      the rule; its reading is null when it is not a form eXo writes
    • isActiveWebmailRule

      public static boolean isActiveWebmailRule(tools.jackson.databind.JsonNode json)
      Whether a rule as BlueMind answered it is one of the webmail's own that runs on incoming mail: what the user sees and edits in BlueMind's webmail (filterRules.ts: client "bluemind", trigger IN, not deferred), generic, and switched on.
      Parameters:
      json - the rule
      Returns:
      true for an active webmail rule
    • hash

      public static String hash(List<BlueMindExoRule> rules)
      The SHA-256 of eXo's rules as BlueMind holds them, in order: each rule's JSON with its members sorted and its id left out, so that a renumbering changes nothing and any change to a rule does.
      Parameters:
      rules - eXo's rules, in BlueMind's order
      Returns:
      the hex digest; null when there is none