Class BlueMindMailboxClient

java.lang.Object
org.exoplatform.bluemind.client.BlueMindMailboxClient

public class BlueMindMailboxClient extends Object
The mailbox settings automatic reply, forwarding and filter rules rest on, over BlueMind's core REST API (IMailboxes, javadoc 5.0.7563): _vacation and _forwarding, each read and written; the per-rule _rules API, one rule at a time; and the folder listing a rule's move names. The login, the key header, the bounds and the redirect refusal are the session's (BlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)), so a kept session serves these calls too and a refused one is renewed once like any other.

The session's own mailbox, and nobody else's. Every call is addressed /api/mailboxes/{domainUid}/{userUid}/… with the two uids the login answered — never a value a caller supplies. A session whose login named neither addresses nothing.

Narrow writes. POST _vacation writes the reply and nothing else (IMailboxes.setMailboxVacation), and POST _forwarding the forward and nothing else (IMailboxes.setMailboxForwarding): the rules of the mailbox's filter, and the setting the call does not name, are left as they are, by construction. A rule is added, replaced or removed by its own call (PUT _rules, POST _rules/{id}, DELETE _rules/{id}), which touches no other rule and neither setting. No write of _filter exists here: it deletes and re-inserts every rule of the mailbox, the webmail's included, under new ids (MailFilterStore.set, master 302bc396). Which destination a forward may name is not this client's to decide: a forward is an exfiltration vector, and its caller checks the destination before writing it.

Failures by what they mean, as BlueMind's REST layer states them (ResponseBuilder.replyServerFault: 403 for PERMISSION_DENIED, 500 naming the fault code for every other one): 401 BlueMindAuthenticationException; 403 or a PERMISSION_DENIED fault BlueMindForbiddenException (its BlueMindRouteFilteredException kind when the 403 is not BlueMind's own); 404 or a NOT_FOUND fault BlueMindNotFoundException; any other 500 fault and every status above 500 BlueMindUnreachableException, except that a rule write refused by BlueMind's filter validators (a 500 naming INVALID_PARAMETER or FORBIDDEN) is a BlueMindRefusedException; anything else, and an answer eXo cannot read, BlueMindException (BlueMindAnswers).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The forward of a mailbox.
    static final String
    The filter rules of a mailbox, one by one.
    static final String
    The filter rules of a mailbox written by one client.
    static final String
    The automatic reply of a mailbox.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    addRule(BlueMindSession session, tools.jackson.databind.node.ObjectNode rule)
    Adds one rule to the session's own mailbox (PUT _rules): BlueMind places it after the last rule of the same client and type, else at the end, and leaves every other rule as it is.
    void
    deleteRule(BlueMindSession session, long id)
    Removes one rule of the session's own mailbox (DELETE _rules/{id}).
    Lists the folders of the session's own mailbox (GET /api/mail_folders/{partition}/{mailboxRoot}/_all), the deleted ones left out.
    Reads GET _forwarding of the session's own mailbox.
    List<tools.jackson.databind.node.ObjectNode>
    Reads GET _rules of the session's own mailbox: every rule, whatever client wrote it, the automatic reply's and the forward's rows included, in the order BlueMind keeps them (by type, then by position).
    List<tools.jackson.databind.node.ObjectNode>
    Reads GET _rulesByClient?client= of the session's own mailbox: the rules one client wrote, in BlueMind's order.
    Reads GET _vacation of the session's own mailbox.
    void
    Writes POST _forwarding of the session's own mailbox, and nothing else: every member of MailFilter.Forwarding, the addresses in the forward's own order.
    void
    Writes POST _vacation of the session's own mailbox, and nothing else: every member of MailFilter.Vacation, a null member sent as a JSON null, dates as epoch milliseconds.
    void
    updateRule(BlueMindSession session, long id, tools.jackson.databind.node.ObjectNode rule)
    Replaces one rule of the session's own mailbox in place (POST _rules/{id}): its position is kept, every other rule is left as it is.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait