use of com.zimbra.cs.filter.SoapToSieve in project zm-mailbox by Zimbra.
the class TestFilter method normalize.
/**
* Converts the script to XML and back again.
*/
private String normalize(String script) throws ParseException, ServiceException {
List<String> ruleNames = RuleManager.getRuleNames(script);
Node node = RuleManager.getSieveFactory().parse(new ByteArrayInputStream(script.getBytes()));
// Convert from Sieve to SOAP and back again.
SieveToSoap sieveToSoap = new SieveToSoap(ruleNames);
sieveToSoap.accept(node);
SoapToSieve soapToSieve = new SoapToSieve(sieveToSoap.toFilterRules());
return soapToSieve.getSieveScript();
}
Aggregations