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.core.request;
025
026import microsoft.exchange.webservices.data.core.EwsServiceXmlReader;
027import microsoft.exchange.webservices.data.core.EwsServiceXmlWriter;
028import microsoft.exchange.webservices.data.core.ExchangeService;
029import microsoft.exchange.webservices.data.core.XmlElementNames;
030import microsoft.exchange.webservices.data.core.response.GetRoomListsResponse;
031import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
032
033/**
034 * Represents a GetRoomList request.
035 */
036public final class GetRoomListsRequest extends SimpleServiceRequestBase<GetRoomListsResponse> {
037
038  /**
039   * Initializes a new instance of the class.
040   *
041   * @param service the service
042   * @throws Exception
043   */
044  public GetRoomListsRequest(ExchangeService service)
045      throws Exception {
046    super(service);
047  }
048
049  /**
050   * Gets the name of the XML element.
051   *
052   * @return XML element name
053   */
054  @Override public String getXmlElementName() {
055    return XmlElementNames.GetRoomListsRequest;
056  }
057
058  /**
059   * Writes XML elements.
060   *
061   * @param writer the writer
062   */
063  @Override
064  protected void writeElementsToXml(EwsServiceXmlWriter writer) {
065    // Don't have parameter in request
066  }
067
068  /**
069   * Gets the name of the response XML element.
070   *
071   * @return XML element name
072   */
073  @Override
074  protected String getResponseXmlElementName() {
075    return XmlElementNames.GetRoomListsResponse;
076  }
077
078  /**
079   * {@inheritDoc}
080   */
081  @Override
082  protected GetRoomListsResponse parseResponse(EwsServiceXmlReader reader)
083      throws Exception {
084    GetRoomListsResponse response = new GetRoomListsResponse();
085    response.loadFromXml(reader, XmlElementNames.GetRoomListsResponse);
086    return response;
087  }
088
089  /**
090   * Gets the request version.
091   *
092   * @return Earliest Exchange version in which this request is supported.
093   */
094  @Override
095  protected ExchangeVersion getMinimumRequiredServerVersion() {
096    return ExchangeVersion.Exchange2010;
097  }
098
099  /**
100   * Executes this request.
101   *
102   * @return Service response
103   * @throws Exception the exception
104   */
105  public GetRoomListsResponse execute() throws Exception {
106    GetRoomListsResponse serviceResponse = internalExecute();
107    serviceResponse.throwIfNecessary();
108    return serviceResponse;
109  }
110}