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.misc.id;
025
026import microsoft.exchange.webservices.data.core.EwsServiceXmlReader;
027import microsoft.exchange.webservices.data.core.EwsServiceXmlWriter;
028import microsoft.exchange.webservices.data.core.XmlAttributeNames;
029import microsoft.exchange.webservices.data.core.XmlElementNames;
030import microsoft.exchange.webservices.data.core.enumeration.misc.IdFormat;
031import microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlSerializationException;
032
033/**
034 * Represents the Id of a public folder item expressed in a specific format.
035 */
036public class AlternatePublicFolderItemId extends AlternatePublicFolderId {
037
038  /**
039   * Schema type associated with AlternatePublicFolderItemId.
040   */
041  public final static String SchemaTypeName =
042      "AlternatePublicFolderItemIdType";
043
044  /**
045   * Item id.
046   */
047  private String itemId;
048
049  /**
050   * Initializes a new instance of the class.
051   */
052  public AlternatePublicFolderItemId() {
053    super();
054  }
055
056  /**
057   * Initializes a new instance of the class.
058   *
059   * @param format   the format
060   * @param folderId the folder id
061   * @param itemId   the item id
062   */
063  public AlternatePublicFolderItemId(IdFormat format, String folderId,
064      String itemId) {
065    super(format, folderId);
066    this.itemId = itemId;
067  }
068
069  /**
070   * Gets The Id of the public folder item.
071   *
072   * @return the item id
073   */
074  public String getItemId() {
075    return this.itemId;
076  }
077
078  /**
079   * Sets the item id.
080   *
081   * @param itemId the new item id
082   */
083  public void setItemId(String itemId) {
084    this.itemId = itemId;
085  }
086
087  /**
088   * Gets the name of the XML element.
089   *
090   * @return XML element name.
091   */
092  @Override
093  protected String getXmlElementName() {
094    return XmlElementNames.AlternatePublicFolderItemId;
095  }
096
097  /**
098   * Writes the attribute to XML.
099   *
100   * @param writer the writer
101   * @throws ServiceXmlSerializationException the service xml serialization exception
102   */
103  @Override
104  protected void writeAttributesToXml(EwsServiceXmlWriter writer)
105      throws ServiceXmlSerializationException {
106    super.writeAttributesToXml(writer);
107    writer.writeAttributeValue(XmlAttributeNames.ItemId, this.getItemId());
108  }
109
110  /**
111   * Loads the attribute from XML.
112   *
113   * @param reader the reader
114   * @throws Exception the exception
115   */
116  @Override public void loadAttributesFromXml(EwsServiceXmlReader reader)
117      throws Exception {
118    super.loadAttributesFromXml(reader);
119    this.itemId = reader.readAttributeValue(XmlAttributeNames.ItemId);
120  }
121
122}