use of jakarta.mail.search.RecipientStringTerm in project exist by eXist-db.
the class MessageListFunctions method parseRecipientTerm.
private SearchTerm parseRecipientTerm(Node terms) throws XPathException {
SearchTerm st = null;
String pattern = ((Element) terms).getAttribute("pattern");
String type = ((Element) terms).getAttribute("recipientType");
if (StringUtils.isEmpty(type)) {
throw (new XPathException(this, "recipientType not specified for term with type: " + ((Element) terms).getAttribute("type")));
}
if (pattern != null && !pattern.isEmpty()) {
Message.RecipientType rtype = null;
if (type.equalsIgnoreCase("to")) {
rtype = Message.RecipientType.TO;
} else if (type.equalsIgnoreCase("cc")) {
rtype = Message.RecipientType.CC;
} else if (type.equalsIgnoreCase("bcc")) {
rtype = Message.RecipientType.BCC;
} else {
throw (new XPathException(this, "Invalid recipientType: " + type + ", for term with type: " + ((Element) terms).getAttribute("type")));
}
st = new RecipientStringTerm(rtype, pattern);
} else {
throw (new XPathException(this, "Pattern attribute must be specified for term with type: " + ((Element) terms).getAttribute("type")));
}
return (st);
}
Aggregations