Skip to content

Commit 26e7832

Browse files
committed
[EI-3288] Solve conversation issue in EWS Java API SDK
1 parent b72fe13 commit 26e7832

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed

src/main/java/microsoft/exchange/webservices/data/core/XmlElementNames.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4784,5 +4784,17 @@ public class XmlElementNames {
47844784

47854785
// by
47864786
// UM
4787+
4788+
public static final String HighlightTerms = "HighlightTerms";
4789+
4790+
public static final String HighlightTerm = "Term";
4791+
4792+
public static final String HighlightTermScope = "Scope";
4793+
4794+
public static final String HighlightTermValue = "Value";
4795+
4796+
public static final String TotalConversationsInView = "TotalConversationsInView";
4797+
4798+
public static final String IndexedOffset = "IndexedOffset";
47874799

47884800
}

src/main/java/microsoft/exchange/webservices/data/core/response/FindConversationResponse.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import microsoft.exchange.webservices.data.core.EwsUtilities;
2828
import microsoft.exchange.webservices.data.core.XmlElementNames;
2929
import microsoft.exchange.webservices.data.core.service.item.Conversation;
30+
import microsoft.exchange.webservices.data.property.complex.HighlightTerm;
3031
import microsoft.exchange.webservices.data.core.enumeration.misc.XmlNamespace;
3132
import microsoft.exchange.webservices.data.security.XmlNodeType;
3233

@@ -39,6 +40,9 @@
3940
*/
4041
public final class FindConversationResponse extends ServiceResponse {
4142
List<Conversation> conversations = new ArrayList<Conversation>();
43+
List<HighlightTerm> highlightTerms = new ArrayList<HighlightTerm>();
44+
int totalCount;
45+
int indexedOffset;
4246

4347
/**
4448
* Initializes a new instance of the FindConversationResponse class.
@@ -55,6 +59,33 @@ public Collection<Conversation> getConversations() {
5559
return this.conversations;
5660

5761
}
62+
63+
/**
64+
* Gets the results of the operation.
65+
*/
66+
public Collection<HighlightTerm> getHighlightTerms() {
67+
68+
return this.highlightTerms;
69+
70+
}
71+
72+
/**
73+
* Gets the results of the operation.
74+
*/
75+
public int getIndexedOffset() {
76+
77+
return this.indexedOffset;
78+
79+
}
80+
81+
/**
82+
* Gets the results of the operation.
83+
*/
84+
public int getCounts() {
85+
86+
return this.totalCount;
87+
88+
}
5889

5990
/**
6091
* Read Conversations from XML.
@@ -95,5 +126,34 @@ protected void readElementsFromXml(EwsServiceXmlReader reader)
95126
while (!reader.isEndElement(XmlNamespace.Messages,
96127
XmlElementNames.Conversations));
97128
}
129+
reader.read();
130+
131+
if (reader.isStartElement(XmlNamespace.Messages, XmlElementNames.HighlightTerms) &&
132+
!reader.isEmptyElement()) {
133+
do {
134+
reader.read();
135+
136+
if (reader.getNodeType().getNodeType() == XmlNodeType.START_ELEMENT) {
137+
HighlightTerm term = new HighlightTerm();
138+
term.loadFromXml(
139+
reader,
140+
XmlNamespace.Types,
141+
XmlElementNames.HighlightTerm);
142+
this.highlightTerms.add(term);
143+
}
144+
} while (!reader.isEndElement(XmlNamespace.Messages, XmlElementNames.HighlightTerms));
145+
}
146+
147+
if (reader.isStartElement(XmlNamespace.Messages, XmlElementNames.TotalConversationsInView)
148+
&& !reader.isEmptyElement()) {
149+
this.totalCount = Integer.parseInt(reader.readElementValue());
150+
reader.read();
151+
}
152+
153+
if (reader.isStartElement(XmlNamespace.Messages, XmlElementNames.IndexedOffset)
154+
&& !reader.isEmptyElement()) {
155+
this.indexedOffset = Integer.parseInt(reader.readElementValue());
156+
reader.read();
157+
}
98158
}
99159
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package microsoft.exchange.webservices.data.property.complex;
2+
3+
import microsoft.exchange.webservices.data.core.EwsServiceXmlReader;
4+
import microsoft.exchange.webservices.data.core.XmlElementNames;
5+
6+
public class HighlightTerm extends ComplexProperty {
7+
8+
private String scope;
9+
10+
private String value;
11+
12+
public HighlightTerm() {
13+
14+
}
15+
16+
/**
17+
* Tries to read element from XML.
18+
*
19+
* @param reader The reader.
20+
* @return true, if successful
21+
* @throws Exception the exception
22+
*/
23+
@Override
24+
public boolean tryReadElementFromXml(EwsServiceXmlReader reader) throws Exception {
25+
26+
if (reader.getLocalName().equals(XmlElementNames.HighlightTermScope)) {
27+
this.scope = reader.readElementValue();
28+
return true;
29+
} else if (reader.getLocalName().equals(XmlElementNames.HighlightTermValue)) {
30+
this.value = reader.readElementValue();
31+
return true;
32+
} else {
33+
return false;
34+
}
35+
}
36+
37+
}

0 commit comments

Comments
 (0)