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.misc; 025 026import microsoft.exchange.webservices.data.core.EwsUtilities; 027import microsoft.exchange.webservices.data.core.service.item.Appointment; 028import microsoft.exchange.webservices.data.core.service.item.Item; 029import microsoft.exchange.webservices.data.core.service.item.MeetingCancellation; 030import microsoft.exchange.webservices.data.core.service.item.MeetingRequest; 031import microsoft.exchange.webservices.data.core.service.item.MeetingResponse; 032 033/** 034 * Represents the results of an action performed on a calendar item or meeting 035 * message, such as accepting, tentatively accepting or declining a meeting 036 * request. 037 */ 038public final class CalendarActionResults { 039 040 /** 041 * The appointment. 042 */ 043 private Appointment appointment; 044 045 /** 046 * The meeting request. 047 */ 048 private MeetingRequest meetingRequest; 049 050 /** 051 * The meeting response. 052 */ 053 private MeetingResponse meetingResponse; 054 055 /** 056 * The meeting cancellation. 057 */ 058 private MeetingCancellation meetingCancellation; 059 060 /** 061 * Initializes a new instance of the class. 062 * 063 * @param items the item 064 */ 065 public CalendarActionResults(Iterable<Item> items) { 066 this.appointment = EwsUtilities.findFirstItemOfType(Appointment.class, items); 067 this.meetingRequest = EwsUtilities.findFirstItemOfType( 068 MeetingRequest.class, items); 069 this.meetingResponse = EwsUtilities.findFirstItemOfType( 070 MeetingResponse.class, items); 071 this.meetingCancellation = EwsUtilities.findFirstItemOfType( 072 MeetingCancellation.class, items); 073 } 074 075 /** 076 * Gets the meeting that was accepted, tentatively accepted or declined. 077 * <p/> 078 * When a meeting is accepted or tentatively accepted via an Appointment 079 * object, EWS recreates the meeting, and Appointment represents that new 080 * version. When a meeting is accepted or tentatively accepted via a 081 * MeetingRequest object, EWS creates an associated meeting in the 082 * attendee's calendar and Appointment represents that meeting. When 083 * declining a meeting via an Appointment object, EWS moves the appointment 084 * to the attendee's Deleted Items folder and Appointment represents that 085 * moved copy. When declining a meeting via a MeetingRequest object, EWS 086 * creates an associated meeting in the attendee's Deleted Items folder, and 087 * Appointment represents that meeting. When a meeting is declined via 088 * either an Appointment or a MeetingRequest object from the Deleted Items 089 * folder, Appointment is null. 090 * 091 * @return appointment 092 */ 093 public Appointment getAppointment() { 094 return this.appointment; 095 } 096 097 /** 098 * Gets the meeting request that was moved to the Deleted Items folder as a 099 * result of an attendee accepting, tentatively accepting or declining a 100 * meeting request. If the meeting request is accepted, tentatively accepted 101 * or declined from the Deleted Items folder, it is permanently deleted and 102 * MeetingRequest is null. 103 * 104 * @return meetingRequest 105 */ 106 public MeetingRequest getMeetingRequest() { 107 return this.meetingRequest; 108 } 109 110 /** 111 * Gets the copy of the response that is sent to the organizer of a meeting 112 * when the meeting is accepted, tentatively accepted or declined by an 113 * attendee. MeetingResponse is null if the attendee chose not to send a 114 * response. 115 * 116 * @return meetingResponse 117 */ 118 public MeetingResponse getMeetingResponse() { 119 return this.meetingResponse; 120 } 121 122 /** 123 * Gets the copy of the meeting cancellation message sent by the organizer 124 * to the attendees of a meeting when the meeting is cancelled. 125 * 126 * @return meetingCancellation 127 */ 128 public MeetingCancellation getMeetingCancellation() { 129 return this.meetingCancellation; 130 } 131 132}