1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package davmail.exchange.ews;
21
22 import davmail.exchange.XMLStreamUtil;
23
24 import javax.xml.stream.XMLStreamException;
25 import javax.xml.stream.XMLStreamReader;
26
27
28
29
30 public class ConvertIdMethod extends EWSMethod {
31
32
33
34
35
36
37 public ConvertIdMethod(String value) {
38 super("SourceIds", "ConvertId", "ResponseMessages");
39 addMethodOption(new AttributeOption("DestinationFormat", "EwsId"));
40 unresolvedEntry = new ElementOption("m:SourceIds",
41 new AlternateId("EwsId", value));
42 }
43
44 @Override
45 protected Item handleItem(XMLStreamReader reader) throws XMLStreamException {
46 Item responseItem = new Item();
47 responseItem.type = "AlternateId";
48
49 while (reader.hasNext() && !XMLStreamUtil.isStartTag(reader, "AlternateId")) {
50 reader.next();
51 }
52 if (XMLStreamUtil.isStartTag(reader, "AlternateId")) {
53 String mailbox = reader.getAttributeValue(null, "Mailbox");
54 if (mailbox != null) {
55 responseItem.put("Mailbox", mailbox);
56 }
57 while (reader.hasNext() && !XMLStreamUtil.isEndTag(reader, "AlternateId")) {
58 reader.next();
59 }
60 }
61 return responseItem;
62 }
63
64 }