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.*; 027import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion; 028import microsoft.exchange.webservices.data.core.enumeration.misc.XmlNamespace; 029import microsoft.exchange.webservices.data.core.enumeration.service.error.ServiceErrorHandling; 030import microsoft.exchange.webservices.data.core.response.ExportItemsResponse; 031import microsoft.exchange.webservices.data.misc.ItemIdWrapperList; 032 033/** 034 * Represents a DeleteItem request. 035 */ 036public final class ExportItemsRequest extends MultiResponseServiceRequest<ExportItemsResponse> { 037 038 /** 039 * The item ids. 040 */ 041 private ItemIdWrapperList itemIds = new ItemIdWrapperList(); 042 043 /** 044 * Initializes a new instance of the class. 045 * 046 * @param service the service 047 * @param errorHandlingMode the error handling mode 048 * @throws Exception 049 */ 050 public ExportItemsRequest(ExchangeService service, ServiceErrorHandling errorHandlingMode) 051 throws Exception { 052 super(service, errorHandlingMode); 053 } 054 055 @Override 056 protected void validate() throws Exception { 057 EwsUtilities.validateParamCollection(itemIds.iterator(), "itemIds"); 058 } 059 060 /** 061 * Gets the expected response message count. 062 * 063 * @return Number of expected response messages 064 */ 065 @Override 066 protected int getExpectedResponseMessageCount() { 067 return itemIds.getCount(); 068 } 069 070 /** 071 * Creates the service response. 072 * 073 * @param service the service 074 * @param responseIndex the response index 075 * @return Service response. 076 */ 077 @Override 078 protected ExportItemsResponse createServiceResponse(ExchangeService service, 079 int responseIndex) { 080 return new ExportItemsResponse(); 081 } 082 083 /** 084 * Gets the name of the XML element. 085 * 086 * @return XML element name 087 */ 088 @Override public String getXmlElementName() { 089 return XmlElementNames.ExportItems; 090 } 091 092 /** 093 * Gets the name of the response XML element. 094 * 095 * @return XML element name 096 */ 097 @Override 098 protected String getResponseXmlElementName() { 099 return XmlElementNames.ExportItemsResponse; 100 } 101 102 /** 103 * Gets the name of the response message XML element. 104 * 105 * @return XML element name 106 */ 107 @Override 108 protected String getResponseMessageXmlElementName() { 109 return XmlElementNames.ExportItemsResponseMessage; 110 } 111 112 /** 113 * Writes XML elements. 114 * 115 * @param writer the writer 116 * @throws Exception the exception 117 */ 118 @Override 119 protected void writeElementsToXml(EwsServiceXmlWriter writer) 120 throws Exception { 121 itemIds.writeToXml(writer, XmlNamespace.Messages, 122 XmlElementNames.ItemIds); 123 } 124 125 /** 126 * Gets the request version. 127 * 128 * @return Earliest Exchange version in which this request is supported. 129 */ 130 @Override 131 protected ExchangeVersion getMinimumRequiredServerVersion() { 132 return ExchangeVersion.Exchange2010_SP1; 133 } 134 135 /** 136 * Gets the item ids. 137 * 138 * @return the item ids 139 */ 140 public ItemIdWrapperList getItemIds() { 141 return itemIds; 142 } 143 144 145}