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
024 package microsoft.exchange.webservices.data.core.request;
025
026 import microsoft.exchange.webservices.data.core.EwsServiceXmlReader;
027 import microsoft.exchange.webservices.data.core.EwsServiceXmlWriter;
028 import microsoft.exchange.webservices.data.core.ExchangeService;
029 import microsoft.exchange.webservices.data.core.XmlElementNames;
030 import microsoft.exchange.webservices.data.core.response.GetPhoneCallResponse;
031 import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
032 import microsoft.exchange.webservices.data.core.enumeration.misc.XmlNamespace;
033 import microsoft.exchange.webservices.data.messaging.PhoneCallId;
034
035 /**
036 * Represents a GetPhoneCall request.
037 */
038 public final class GetPhoneCallRequest extends SimpleServiceRequestBase<GetPhoneCallResponse> {
039
040 /**
041 * The id.
042 */
043 private PhoneCallId id;
044
045 /**
046 * Initializes a new instance of the GetPhoneCallRequest class.
047 *
048 * @param service the service
049 * @throws Exception
050 */
051 public GetPhoneCallRequest(ExchangeService service)
052 throws Exception {
053 super(service);
054 }
055
056 /**
057 * Gets the name of the XML element.
058 *
059 * @return XML element name.
060 */
061 @Override public String getXmlElementName() {
062 return XmlElementNames.GetPhoneCall;
063 }
064
065 /**
066 * Writes XML elements.
067 *
068 * @param writer the writer
069 * @throws Exception the exception
070 */
071 @Override
072 protected void writeElementsToXml(EwsServiceXmlWriter writer)
073 throws Exception {
074 this.id.writeToXml(writer, XmlNamespace.Messages,
075 XmlElementNames.PhoneCallId);
076 }
077
078 /**
079 * Gets the name of the response XML element.
080 *
081 * @return XML element name.
082 */
083 @Override
084 protected String getResponseXmlElementName() {
085 return XmlElementNames.GetPhoneCallResponse;
086 }
087
088 /**
089 * {@inheritDoc}
090 */
091 @Override
092 protected GetPhoneCallResponse parseResponse(EwsServiceXmlReader reader)
093 throws Exception {
094 GetPhoneCallResponse response = new GetPhoneCallResponse(getService());
095 response.loadFromXml(reader, XmlElementNames.GetPhoneCallResponse);
096 return response;
097 }
098
099 /**
100 * Gets the request version.
101 *
102 * @return Earliest Exchange version in which this request is supported.
103 */
104 @Override
105 protected ExchangeVersion getMinimumRequiredServerVersion() {
106 return ExchangeVersion.Exchange2010;
107 }
108
109 /**
110 * Executes this request.
111 *
112 * @return Service response.
113 * @throws Exception the exception
114 */
115 public GetPhoneCallResponse execute() throws Exception {
116 GetPhoneCallResponse serviceResponse = internalExecute();
117 serviceResponse.throwIfNecessary();
118 return serviceResponse;
119 }
120
121 /**
122 * Gets the Id of the phone call.
123 *
124 * @return the id
125 */
126 protected PhoneCallId getId() {
127 return id;
128 }
129
130 /**
131 * Sets the id.
132 *
133 * @param id the new id
134 */
135 public void setId(PhoneCallId id) {
136 this.id = id;
137 }
138
139 }