use of org.apache.jsieve.parser.generated.ASTstring_list in project zm-mailbox by Zimbra.
the class RuleRewriter method test.
private void test(Element elem, Node node) {
int numChildren = node.jjtGetNumChildren();
for (int i = 0; i < numChildren; i++) {
Node childNode = node.jjtGetChild(i);
if (childNode instanceof ASTargument) {
Object val = ((SieveNode) childNode).getValue();
if (val != null) {
if (MATCH_TYPES.contains(val.toString())) {
if (!mStack.isEmpty())
val = mStack.pop() + " " + val;
elem.addAttribute(MailConstants.A_OPERATION, val.toString());
} else {
String cname = elem.getAttribute(MailConstants.A_NAME, null);
if ("size".equals(cname)) {
// special casing size test
elem.addAttribute(MailConstants.A_RHS, getSize(val.toString()));
} else {
elem.addAttribute(MailConstants.A_MODIFIER, val.toString());
}
}
}
} else if (childNode instanceof ASTstring_list) {
List<Object> val = getStringList(childNode);
String cname = elem.getAttribute(MailConstants.A_NAME, null);
String param = null;
if ("date".equals(cname) || "body".equals(cname))
param = MailConstants.A_RHS;
else
param = PARAM_PREFIX + String.valueOf(x++);
elem.addAttribute(param, toString(val));
}
test(elem, childNode);
}
}
Aggregations