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.ServiceResponse; 031import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion; 032import microsoft.exchange.webservices.data.core.enumeration.misc.XmlNamespace; 033import microsoft.exchange.webservices.data.messaging.PhoneCallId; 034 035/** 036 * Represents a DisconnectPhoneCall request. 037 */ 038public final class DisconnectPhoneCallRequest extends SimpleServiceRequestBase<ServiceResponse> { 039 040 /** 041 * The id. 042 */ 043 private PhoneCallId id; 044 045 /** 046 * Initializes a new instance of the DisconnectPhoneCallRequest class. 047 * 048 * @param service the service 049 * @throws Exception 050 */ 051 public DisconnectPhoneCallRequest(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.DisconnectPhoneCall; 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.DisconnectPhoneCallResponse; 086 } 087 088 /** 089 * {@inheritDoc} 090 */ 091 @Override 092 protected ServiceResponse parseResponse(EwsServiceXmlReader reader) 093 throws Exception { 094 ServiceResponse serviceResponse = new ServiceResponse(); 095 serviceResponse.loadFromXml(reader, 096 XmlElementNames.DisconnectPhoneCallResponse); 097 return serviceResponse; 098 } 099 100 /** 101 * Gets the request version. 102 * 103 * @return Earliest Exchange version in which this request is supported. 104 */ 105 @Override 106 protected ExchangeVersion getMinimumRequiredServerVersion() { 107 return ExchangeVersion.Exchange2010; 108 } 109 110 /** 111 * Executes this request. 112 * 113 * @return Service response. 114 * @throws Exception the exception 115 */ 116 public ServiceResponse execute() throws Exception { 117 ServiceResponse serviceResponse = internalExecute(); 118 serviceResponse.throwIfNecessary(); 119 return serviceResponse; 120 } 121 122 /** 123 * Gets the Id of the phone call. 124 * 125 * @return the id 126 */ 127 protected PhoneCallId getId() { 128 return this.id; 129 } 130 131 /** 132 * Sets the id. 133 * 134 * @param id the new id 135 */ 136 public void setId(PhoneCallId id) { 137 this.id = id; 138 } 139 140}