Search in sources :

Example 6 with TokenMgrError

use of org.apache.jsieve.parser.generated.TokenMgrError in project zm-mailbox by Zimbra.

the class RuleManager method getAdminRulesAsXML.

public static List<FilterRule> getAdminRulesAsXML(Entry entry, FilterType filterType, AdminFilterType afType) throws ServiceException {
    Node node;
    try {
        node = getRulesNode(entry, filterType, afType);
    } catch (ParseException | TokenMgrError e) {
        throw ServiceException.PARSE_ERROR("parsing Sieve script", e);
    }
    String sieveScriptAttrName = getAdminScriptAttributeName(filterType, afType);
    SieveToSoap sieveToSoap = new SieveToSoap(getRuleNames(entry.getAttr(sieveScriptAttrName)));
    sieveToSoap.accept(node);
    return sieveToSoap.toFilterRules();
}
Also used : Node(org.apache.jsieve.parser.generated.Node) TokenMgrError(org.apache.jsieve.parser.generated.TokenMgrError) ParseException(org.apache.jsieve.parser.generated.ParseException)

Aggregations

Node (org.apache.jsieve.parser.generated.Node)6 ParseException (org.apache.jsieve.parser.generated.ParseException)6 TokenMgrError (org.apache.jsieve.parser.generated.TokenMgrError)6 Account (com.zimbra.cs.account.Account)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 SieveException (org.apache.jsieve.exception.SieveException)3 DeliveryServiceException (com.zimbra.common.service.DeliveryServiceException)2 ServiceException (com.zimbra.common.service.ServiceException)2 ErejectException (com.zimbra.cs.filter.jsieve.ErejectException)2 Message (com.zimbra.cs.mailbox.Message)2 ParsedMessage (com.zimbra.cs.mime.ParsedMessage)2 ItemId (com.zimbra.cs.service.util.ItemId)2 IOException (java.io.IOException)2 Cos (com.zimbra.cs.account.Cos)1 Domain (com.zimbra.cs.account.Domain)1 Server (com.zimbra.cs.account.Server)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 HashMap (java.util.HashMap)1