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.property.complex; 025 026import microsoft.exchange.webservices.data.core.EwsServiceXmlReader; 027import microsoft.exchange.webservices.data.core.XmlElementNames; 028import microsoft.exchange.webservices.data.core.exception.service.local.ServiceXmlDeserializationException; 029import org.apache.commons.logging.Log; 030import org.apache.commons.logging.LogFactory; 031 032import javax.xml.stream.XMLStreamException; 033 034import java.util.Date; 035 036/** 037 * Encapsulates information on the deleted occurrence of a recurring 038 * appointment. 039 */ 040public class DeletedOccurrenceInfo extends ComplexProperty { 041 042 private static final Log LOG = LogFactory.getLog(DeletedOccurrenceInfo.class); 043 044 /** 045 * The original start date and time of the deleted occurrence. The EWS 046 * schema contains a Start property for deleted occurrences but it's really 047 * the original start date and time of the occurrence. 048 */ 049 private Date originalStart; 050 051 /** 052 * Initializes a new instance of the "DeletedOccurrenceInfo" class. 053 */ 054 protected DeletedOccurrenceInfo() { 055 } 056 057 /** 058 * Tries to read element from XML. 059 * 060 * @param reader The reader. 061 * @return True if element was read. 062 * @throws Exception the exception 063 */ 064 @Override 065 public boolean tryReadElementFromXml(EwsServiceXmlReader reader) 066 throws Exception { 067 if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Start)) { 068 try { 069 this.originalStart = reader.readElementValueAsDateTime(); 070 } catch (ServiceXmlDeserializationException e) { 071 LOG.error(e); 072 } catch (XMLStreamException e) { 073 LOG.error(e); 074 } 075 return true; 076 } else { 077 return false; 078 } 079 } 080 081 /** 082 * Gets the original start date and time of the deleted occurrence. 083 * 084 * @return the original start 085 */ 086 public Date getOriginalStart() { 087 return this.originalStart; 088 } 089 090}