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 java.io.IOException;
22 import java.io.Writer;
23
24
25
26
27 public class FolderId extends Option {
28 protected String changeKey;
29 protected String mailbox;
30
31
32
33
34
35
36
37
38
39 protected FolderId(String name, String value, String changeKey, String mailbox) {
40 this(name, value, changeKey);
41 this.mailbox = mailbox;
42 }
43
44
45
46
47
48
49
50
51 protected FolderId(String name, String value, String changeKey) {
52 super(name, value);
53 this.changeKey = changeKey;
54 }
55
56
57
58
59
60
61 public FolderId(EWSMethod.Item item) {
62 this("t:FolderId", item.get("FolderId"), item.get("ChangeKey"));
63 }
64
65
66
67
68
69 @Override
70 public void write(Writer writer) throws IOException {
71 writer.write('<');
72 writer.write(name);
73 writer.write(" Id=\"");
74 writer.write(value);
75 if (changeKey != null) {
76 writer.write("\" ChangeKey=\"");
77 writer.write(changeKey);
78 }
79 if (mailbox == null) {
80 writer.write("\"/>");
81 } else {
82 writer.write("\"><t:Mailbox><t:EmailAddress>");
83 writer.write(mailbox);
84 writer.write("</t:EmailAddress></t:Mailbox></");
85 writer.write(name);
86 writer.write('>');
87 }
88 }
89
90 }