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 IndexedFieldURI implements FieldURI {
27 protected final String fieldURI;
28 protected final String fieldIndex;
29 protected final String fieldItemType;
30 protected final String collectionName;
31
32
33
34
35
36
37
38
39
40 public IndexedFieldURI(String fieldURI, String fieldIndex, String fieldItemType, String collectionName) {
41 this.fieldURI = fieldURI;
42 this.fieldIndex = fieldIndex;
43 this.fieldItemType = fieldItemType;
44 this.collectionName = collectionName;
45 }
46
47 public void appendTo(StringBuilder buffer) {
48 buffer.append("<t:IndexedFieldURI FieldURI=\"").append(fieldURI);
49 buffer.append("\" FieldIndex=\"").append(fieldIndex);
50 buffer.append("\"/>");
51 }
52
53 public void appendValue(StringBuilder buffer, String itemType, String value) {
54 if (itemType != null) {
55
56 appendTo(buffer);
57 buffer.append("<t:").append(fieldItemType).append('>');
58 buffer.append("<t:").append(collectionName).append('>');
59 }
60 if (value != null && value.length() > 0) {
61 buffer.append("<t:Entry Key=\"").append(fieldIndex).append("\">");
62 buffer.append(StringUtil.xmlEncodeAttribute(value));
63 buffer.append("</t:Entry>");
64 }
65 if (itemType != null) {
66 buffer.append("</t:").append(collectionName).append('>');
67 buffer.append("</t:").append(fieldItemType).append('>');
68 }
69 }
70
71 public String getResponseName() {
72 return fieldIndex;
73 }
74 }