Class BlueMindMailboxClient
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongaddRule(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.voiddeleteRule(BlueMindSession session, long id) Removes one rule of the session's own mailbox (DELETE _rules/{id}).getFolders(BlueMindSession session) Lists the folders of the session's own mailbox (GET /api/mail_folders/{partition}/{mailboxRoot}/_all), the deleted ones left out.getForwarding(BlueMindSession session) ReadsGET _forwardingof the session's own mailbox.List<tools.jackson.databind.node.ObjectNode> getRules(BlueMindSession session) ReadsGET _rulesof 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> getRulesByClient(BlueMindSession session, String client) ReadsGET _rulesByClient?client=of the session's own mailbox: the rules one client wrote, in BlueMind's order.getVacation(BlueMindSession session) ReadsGET _vacationof the session's own mailbox.voidsetForwarding(BlueMindSession session, BlueMindForwarding forwarding) WritesPOST _forwardingof the session's own mailbox, and nothing else: every member ofMailFilter.Forwarding, the addresses in the forward's own order.voidsetVacation(BlueMindSession session, BlueMindVacation vacation) WritesPOST _vacationof the session's own mailbox, and nothing else: every member ofMailFilter.Vacation, a null member sent as a JSON null, dates as epoch milliseconds.voidupdateRule(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.
-
Field Details
-
VACATION
The automatic reply of a mailbox.- See Also:
-
FORWARDING
The forward of a mailbox.- See Also:
-
RULES
The filter rules of a mailbox, one by one.- See Also:
-
RULES_BY_CLIENT
The filter rules of a mailbox written by one client.- See Also:
-
-
Constructor Details
-
BlueMindMailboxClient
public BlueMindMailboxClient()
-
-
Method Details
-
getVacation
ReadsGET _vacationof the session's own mailbox.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)- Returns:
- the reply; an empty body or a JSON null reads as a reply that is off and empty
- Throws:
BlueMindException- by kind, as the class comment lists
-
setVacation
WritesPOST _vacationof the session's own mailbox, and nothing else: every member ofMailFilter.Vacation, a null member sent as a JSON null, dates as epoch milliseconds.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)vacation- the reply- Throws:
BlueMindException- by kind, as the class comment lists
-
getForwarding
ReadsGET _forwardingof the session's own mailbox.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)- Returns:
- the forward; an empty body or a JSON null reads as no forward
- Throws:
BlueMindException- by kind, as the class comment lists
-
setForwarding
WritesPOST _forwardingof the session's own mailbox, and nothing else: every member ofMailFilter.Forwarding, the addresses in the forward's own order.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)forwarding- the forward, whose destinations the caller has checked- Throws:
BlueMindException- by kind, as the class comment lists
-
getRules
ReadsGET _rulesof 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).- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)- Returns:
- the rules as BlueMind's JSON objects, in order
- Throws:
BlueMindException- by kind, as the class comment lists, and when the answer is not a list of objects
-
getRulesByClient
public List<tools.jackson.databind.node.ObjectNode> getRulesByClient(BlueMindSession session, String client) ReadsGET _rulesByClient?client=of the session's own mailbox: the rules one client wrote, in BlueMind's order.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)client- the client, e.g.exo- Returns:
- the rules as BlueMind's JSON objects, in order
- Throws:
BlueMindException- by kind, as the class comment lists, and when the answer is not a list of objects
-
addRule
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.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)rule- the rule, as BlueMind's JSON object, without an id- Returns:
- the id BlueMind gave it
- Throws:
BlueMindRefusedException- when BlueMind's validators refuse itBlueMindException- by kind, as the class comment lists, and when the answer names no id
-
updateRule
public 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.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)id- the rule's idrule- the rule, as BlueMind's JSON object- Throws:
BlueMindRefusedException- when BlueMind's validators refuse itBlueMindException- by kind, as the class comment lists
-
deleteRule
Removes one rule of the session's own mailbox (DELETE _rules/{id}).- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)id- the rule's id- Throws:
BlueMindException- by kind, as the class comment lists
-
getFolders
Lists the folders of the session's own mailbox (GET /api/mail_folders/{partition}/{mailboxRoot}/_all), the deleted ones left out. The partition is the domain uid with its dots as underscores, the rootuser.and the login with its dots as carets, as BlueMind itself names them (EmptyTrashLogoutHook): both from the login answer, never from a request.- Parameters:
session- the session, fromBlueMindRestClient.call(org.exoplatform.bluemind.client.BlueMindAccountSource, java.util.function.Function<org.exoplatform.bluemind.client.BlueMindSession, T>)- Returns:
- the folders, in BlueMind's order
- Throws:
BlueMindException- by kind, as the class comment lists, when the session names no login in its domain, and when an entry names no internal id or no full name
-