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 protected String graphId;
33
34
35
36
37
38
39
40
41
42 public IndexedFieldURI(String fieldURI, String fieldIndex, String fieldItemType, String collectionName) {
43 this.fieldURI = fieldURI;
44 this.fieldIndex = fieldIndex;
45 this.fieldItemType = fieldItemType;
46 this.collectionName = collectionName;
47 }
48
49 public IndexedFieldURI(String fieldURI, String fieldIndex, String fieldItemType, String collectionName, String graphId) {
50 this(fieldURI, fieldIndex, fieldItemType, collectionName);
51 this.graphId = graphId;
52 }
53
54 public void appendTo(StringBuilder buffer) {
55 buffer.append("<t:IndexedFieldURI FieldURI=\"").append(fieldURI);
56 buffer.append("\" FieldIndex=\"").append(fieldIndex);
57 buffer.append("\"/>");
58 }
59
60 public void appendValue(StringBuilder buffer, String itemType, String value) {
61 if (itemType != null) {
62
63 appendTo(buffer);
64 buffer.append("<t:").append(fieldItemType).append('>');
65 buffer.append("<t:").append(collectionName).append('>');
66 }
67 if (value != null && value.length() > 0) {
68 buffer.append("<t:Entry Key=\"").append(fieldIndex).append("\">");
69 buffer.append(StringUtil.xmlEncodeAttribute(value));
70 buffer.append("</t:Entry>");
71 }
72 if (itemType != null) {
73 buffer.append("</t:").append(collectionName).append('>');
74 buffer.append("</t:").append(fieldItemType).append('>');
75 }
76 }
77
78 public String getResponseName() {
79 return fieldIndex;
80 }
81
82 @Override
83 public String getGraphId() {
84 return graphId;
85 }
86
87 @Override
88 public boolean isMultiValued() {
89 return true;
90 }
91
92 @Override
93 public boolean isNumber() {
94
95 throw new UnsupportedOperationException();
96 }
97
98 @Override
99 public boolean isBoolean() {
100 throw new UnsupportedOperationException();
101 }
102 }