1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package davmail.exchange.ews;
20
21 import davmail.util.StringUtil;
22
23
24
25
26 public class TwoOperandExpression implements SearchExpression {
27 @SuppressWarnings({"UnusedDeclaration"})
28 protected enum Operator {
29 IsEqualTo, IsNotEqualTo, IsGreaterThan, IsGreaterThanOrEqualTo, IsLessThan, IsLessThanOrEqualTo
30 }
31
32 protected final Operator operator;
33 protected final FieldURI fieldURI;
34 protected final String value;
35
36
37
38
39
40
41
42
43 public TwoOperandExpression(Operator operator, FieldURI fieldURI, String value) {
44 this.operator = operator;
45 this.fieldURI = fieldURI;
46 this.value = value;
47 }
48
49 public void appendTo(StringBuilder buffer) {
50 buffer.append("<t:").append(operator.toString()).append('>');
51 fieldURI.appendTo(buffer);
52
53 buffer.append("<t:FieldURIOrConstant><t:Constant Value=\"");
54
55 if (fieldURI instanceof ExtendedFieldURI && "0x10f3".equals(((ExtendedFieldURI) fieldURI).propertyTag)) {
56 buffer.append(StringUtil.xmlEncodeAttribute(StringUtil.encodeUrlcompname(value)));
57 } else {
58 buffer.append(StringUtil.xmlEncodeAttribute(value));
59 }
60 buffer.append("\"/></t:FieldURIOrConstant>");
61
62 buffer.append("</t:").append(operator.toString()).append('>');
63 }
64
65 }