001/*
002 * The MIT License
003 * Copyright (c) 2012 Microsoft Corporation
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023
024package microsoft.exchange.webservices.data.property.complex;
025
026import microsoft.exchange.webservices.data.core.EwsServiceXmlReader;
027import microsoft.exchange.webservices.data.core.XmlElementNames;
028import microsoft.exchange.webservices.data.misc.OutParam;
029
030/**
031 * Represents information for a managed folder.
032 */
033public final class ManagedFolderInformation extends ComplexProperty {
034
035  /**
036   * The can delete.
037   */
038  private Boolean canDelete;
039
040  /**
041   * The can rename or move.
042   */
043  private Boolean canRenameOrMove;
044
045  /**
046   * The must display comment.
047   */
048  private Boolean mustDisplayComment;
049
050  /**
051   * The has quota.
052   */
053  private Boolean hasQuota;
054
055  /**
056   * The is managed folder root.
057   */
058  private Boolean isManagedFoldersRoot;
059
060  /**
061   * The managed folder id.
062   */
063  private String managedFolderId;
064
065  /**
066   * The comment.
067   */
068  private String comment;
069
070  /**
071   * The storage quota.
072   */
073  private Integer storageQuota;
074
075  /**
076   * The folder size.
077   */
078  private Integer folderSize;
079
080  /**
081   * The home page.
082   */
083  private String homePage;
084
085  /**
086   * Initializes a new instance of the ManagedFolderInformation class.
087   */
088  public ManagedFolderInformation() {
089    super();
090  }
091
092  /**
093   * Tries to read element from XML.
094   *
095   * @param reader the reader
096   * @return True if element was read.
097   * @throws Exception the exception
098   */
099  public boolean tryReadElementFromXml(EwsServiceXmlReader reader)
100      throws Exception {
101    if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.CanDelete)) {
102      this.canDelete = reader.readValue(Boolean.class);
103      return true;
104    } else if (reader.getLocalName().equalsIgnoreCase(
105        XmlElementNames.CanRenameOrMove)) {
106      this.canRenameOrMove = reader.readValue(Boolean.class);
107      return true;
108    } else if (reader.getLocalName().equalsIgnoreCase(
109        XmlElementNames.MustDisplayComment)) {
110      this.mustDisplayComment = reader.readValue(Boolean.class);
111      return true;
112    } else if (reader.getLocalName().equalsIgnoreCase(
113        XmlElementNames.HasQuota)) {
114      this.hasQuota = reader.readValue(Boolean.class);
115      return true;
116    } else if (reader.getLocalName().equalsIgnoreCase(
117        XmlElementNames.IsManagedFoldersRoot)) {
118      this.isManagedFoldersRoot = reader.readValue(Boolean.class);
119      return true;
120    } else if (reader.getLocalName().equalsIgnoreCase(
121        XmlElementNames.ManagedFolderId)) {
122      this.managedFolderId = reader.readValue();
123      return true;
124    } else if (reader.getLocalName().equalsIgnoreCase(
125        XmlElementNames.Comment)) {
126      OutParam<String> value = new OutParam<String>();
127      reader.tryReadValue(value);
128      this.comment = value.getParam();
129      return true;
130    } else if (reader.getLocalName().equalsIgnoreCase(
131        XmlElementNames.StorageQuota)) {
132      this.storageQuota = reader.readValue(Integer.class);
133      return true;
134    } else if (reader.getLocalName().equalsIgnoreCase(
135        XmlElementNames.FolderSize)) {
136      this.folderSize = reader.readValue(Integer.class);
137      return true;
138    } else if (reader.getLocalName().equalsIgnoreCase(
139        XmlElementNames.HomePage)) {
140      OutParam<String> value = new OutParam<String>();
141      reader.tryReadValue(value);
142      this.homePage = value.getParam();
143      return true;
144    } else {
145      return false;
146    }
147
148  }
149
150  /**
151   * Gets a value indicating whether the user can delete objects in the
152   * folder.
153   *
154   * @return the can delete
155   */
156  public Boolean getCanDelete() {
157    return this.canDelete;
158  }
159
160  /**
161   * Gets a value indicating whether the user can rename or move objects in
162   * the folder.
163   *
164   * @return the can rename or move
165   */
166  public Boolean getCanRenameOrMove() {
167    return canRenameOrMove;
168  }
169
170  /**
171   * Gets a value indicating whether the client application must display the
172   * Comment property to the user.
173   *
174   * @return the must display comment
175   */
176  public Boolean getMustDisplayComment() {
177    return mustDisplayComment;
178  }
179
180  /**
181   * Gets a value indicating whether the folder has a quota.
182   *
183   * @return the checks for quota
184   */
185  public Boolean getHasQuota() {
186    return hasQuota;
187  }
188
189  /**
190   * Gets a value indicating whether the folder is the root of the managed
191   * folder hierarchy.
192   *
193   * @return the checks if is managed folder root
194   */
195  public Boolean getIsManagedFoldersRoot() {
196    return isManagedFoldersRoot;
197  }
198
199  /**
200   * Gets the Managed Folder Id of the folder.
201   *
202   * @return the managed folder id
203   */
204  public String getManagedFolderId() {
205    return managedFolderId;
206  }
207
208  /**
209   * Gets the comment associated with the folder.
210   *
211   * @return the comment
212   */
213  public String getComment() {
214    return comment;
215  }
216
217  /**
218   * Gets the storage quota of the folder.
219   *
220   * @return the storage quota
221   */
222  public Integer getStorageQuota() {
223    return storageQuota;
224  }
225
226  /**
227   * Gets the size of the folder.
228   *
229   * @return the folder size
230   */
231  public Integer getFolderSize() {
232    return folderSize;
233  }
234
235  /**
236   * Gets the home page associated with the folder.
237   *
238   * @return the home page
239   */
240  public String getHomePage() {
241    return homePage;
242  }
243
244}