@@ -53,11 +53,22 @@ public final class AlternateMailbox {
5353 */
5454 private String server ;
5555
56+ /**
57+ * The SMTP address of alternate mailbox. It is only set if it is available
58+ * for the given type. E.g. type 'Delegate' has one type 'Archive' not.
59+ */
60+ private String smtpAddress ;
61+
62+
63+ /**
64+ * The SMTP address of the owner of this alternate mailbox.
65+ */
66+ private String ownerSmtpAddress ;
67+
5668 /**
5769 * Initializes a new instance of the AlternateMailbox class.
5870 */
59- private AlternateMailbox () {
60- }
71+ private AlternateMailbox () {}
6172
6273 /**
6374 * PLoads AlternateMailbox instance from XML.
@@ -66,28 +77,31 @@ private AlternateMailbox() {
6677 * @return AlternateMailbox
6778 * @throws Exception the exception
6879 */
69- public static AlternateMailbox loadFromXml (EwsXmlReader reader )
80+ public static AlternateMailbox loadFromXml (final EwsXmlReader reader )
7081 throws Exception {
71- AlternateMailbox altMailbox = new AlternateMailbox ();
82+ final AlternateMailbox altMailbox = new AlternateMailbox ();
7283
7384 do {
7485 reader .read ();
7586
7687 if (reader .getNodeType ().getNodeType () == XmlNodeType .START_ELEMENT ) {
77- if (reader .getLocalName ()
78- .equalsIgnoreCase (XmlElementNames .Type )) {
88+ if (reader .getLocalName ().equalsIgnoreCase (XmlElementNames .Type )) {
7989 altMailbox .setType (reader .readElementValue (String .class ));
80- } else if (reader .getLocalName ().equalsIgnoreCase (
81- XmlElementNames .DisplayName )) {
82- altMailbox .setDisplayName (reader
83- .readElementValue (String .class ));
84- } else if (reader .getLocalName ().equalsIgnoreCase (
85- XmlElementNames .LegacyDN )) {
86- altMailbox .setLegacyDN (reader
87- .readElementValue (String .class ));
88- } else if (reader .getLocalName ().equalsIgnoreCase (
89- XmlElementNames .Server )) {
90+ } else if (reader .getLocalName ()
91+ .equalsIgnoreCase (XmlElementNames .DisplayName )) {
92+ altMailbox .setDisplayName (reader .readElementValue (String .class ));
93+ } else if (reader .getLocalName ()
94+ .equalsIgnoreCase (XmlElementNames .LegacyDN )) {
95+ altMailbox .setLegacyDN (reader .readElementValue (String .class ));
96+ } else
97+ if (reader .getLocalName ().equalsIgnoreCase (XmlElementNames .Server )) {
9098 altMailbox .setServer (reader .readElementValue (String .class ));
99+ } else if (reader .getLocalName ()
100+ .equalsIgnoreCase (XmlElementNames .SmtpAddress )) {
101+ altMailbox .setSmtpAddress (reader .readElementValue (String .class ));
102+ } else if (reader .getLocalName ()
103+ .equalsIgnoreCase (XmlElementNames .OwnerSmtpAddress )) {
104+ altMailbox .setOwnerSmtpAddress (reader .readElementValue (String .class ));
91105 }
92106 }
93107 } while (!reader .isEndElement (XmlNamespace .Autodiscover ,
@@ -110,7 +124,7 @@ public String getType() {
110124 *
111125 * @param type the new type
112126 */
113- protected void setType (String type ) {
127+ protected void setType (final String type ) {
114128 this .type = type ;
115129 }
116130
@@ -128,7 +142,7 @@ public String getDisplayName() {
128142 *
129143 * @param displayName the new display name
130144 */
131- protected void setDisplayName (String displayName ) {
145+ protected void setDisplayName (final String displayName ) {
132146 this .displayName = displayName ;
133147 }
134148
@@ -146,7 +160,7 @@ public String getLegacyDN() {
146160 *
147161 * @param legacyDN the new legacy dn
148162 */
149- protected void setLegacyDN (String legacyDN ) {
163+ protected void setLegacyDN (final String legacyDN ) {
150164 this .legacyDN = legacyDN ;
151165 }
152166
@@ -162,10 +176,47 @@ public String getServer() {
162176 /**
163177 * Sets the server.
164178 *
165- * @param server the new server
179+ * @param server the new server.
166180 */
167- protected void setServer (String server ) {
181+ protected void setServer (final String server ) {
168182 this .server = server ;
169183 }
170184
185+ /**
186+ * Gets the SMTP address.
187+ *
188+ * @return the SMTP address if available for the mailbox type otherwise null
189+ * is returned.
190+ */
191+ public String getSmtpAddress () {
192+ return smtpAddress ;
193+ }
194+
195+ /**
196+ * Sets the SMTP address.
197+ *
198+ * @param smtpAddress the new SMTP address.
199+ */
200+ protected void setSmtpAddress (final String smtpAddress ) {
201+ this .smtpAddress = smtpAddress ;
202+ }
203+
204+ /**
205+ * Gets the owner SMTP address.
206+ *
207+ * @return the SMTP address of the owner of this mailbox.
208+ */
209+ public String getOwnerSmtpAddress () {
210+ return ownerSmtpAddress ;
211+ }
212+
213+ /**
214+ * Sets the owner SMTP address.
215+ *
216+ * @param ownerSmtpAdress the new owner SMTP address
217+ */
218+ protected void setOwnerSmtpAddress (final String ownerSmtpAddress ) {
219+ this .ownerSmtpAddress = ownerSmtpAddress ;
220+ }
221+
171222}
0 commit comments