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.service.response; 025 026import java.util.Date; 027 028import microsoft.exchange.webservices.data.attribute.EditorBrowsable; 029import microsoft.exchange.webservices.data.core.service.item.EmailMessage; 030import microsoft.exchange.webservices.data.core.service.item.Item; 031import microsoft.exchange.webservices.data.core.service.schema.CalendarResponseObjectSchema; 032import microsoft.exchange.webservices.data.core.service.schema.EmailMessageSchema; 033import microsoft.exchange.webservices.data.core.service.schema.ItemSchema; 034import microsoft.exchange.webservices.data.core.service.schema.MeetingResponseSchema; 035import microsoft.exchange.webservices.data.core.service.schema.ServiceObjectSchema; 036import microsoft.exchange.webservices.data.core.enumeration.attribute.EditorBrowsableState; 037import microsoft.exchange.webservices.data.core.enumeration.property.Sensitivity; 038import microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException; 039import microsoft.exchange.webservices.data.property.complex.AttachmentCollection; 040import microsoft.exchange.webservices.data.property.complex.EmailAddress; 041import microsoft.exchange.webservices.data.property.complex.EmailAddressCollection; 042import microsoft.exchange.webservices.data.property.complex.InternetMessageHeaderCollection; 043import microsoft.exchange.webservices.data.property.complex.MessageBody; 044 045/** 046 * Represents the base class for accept, tentatively accept and decline response 047 * messages. 048 * 049 * @param <TMessage> The type of message that is created when this response message is 050 * saved. 051 */ 052@EditorBrowsable(state = EditorBrowsableState.Never) 053public abstract class CalendarResponseMessage<TMessage extends EmailMessage> 054 extends CalendarResponseMessageBase<TMessage> { 055 056 /** 057 * Initializes a new instance of the CalendarResponseMessage class. 058 * 059 * @param referenceItem The reference item 060 * @throws Exception the exception 061 */ 062 protected CalendarResponseMessage(Item referenceItem) throws Exception { 063 super(referenceItem); 064 } 065 066 /** 067 * Internal method to return the schema associated with this type of object. 068 * 069 * @return The schema associated with this type of object. 070 */ 071 @Override public ServiceObjectSchema getSchema() { 072 return CalendarResponseObjectSchema.Instance; 073 } 074 075 /** 076 * Gets the body of the response. 077 * 078 * @return the body 079 * @throws Exception the exception 080 */ 081 public MessageBody getBody() throws Exception { 082 return (MessageBody) this 083 .getObjectFromPropertyDefinition(ItemSchema.Body); 084 } 085 086 /** 087 * Sets the body. 088 * 089 * @param value the new body 090 * @throws Exception the exception 091 */ 092 public void setBody(MessageBody value) throws Exception { 093 this.getPropertyBag().setObjectFromPropertyDefinition(ItemSchema.Body, 094 value); 095 } 096 097 /** 098 * Gets a list of recipients the response will be sent to. 099 * 100 * @return the to recipients 101 * @throws Exception the exception 102 */ 103 public EmailAddressCollection getToRecipients() throws Exception { 104 return (EmailAddressCollection) this 105 .getObjectFromPropertyDefinition( 106 EmailMessageSchema.ToRecipients); 107 } 108 109 /** 110 * Gets a list of recipients the response will be sent to as Cc. 111 * 112 * @return the cc recipients 113 * @throws Exception the exception 114 */ 115 public EmailAddressCollection getCcRecipients() throws Exception { 116 return (EmailAddressCollection) this 117 .getObjectFromPropertyDefinition( 118 EmailMessageSchema.CcRecipients); 119 } 120 121 /** 122 * Gets a list of recipients this response will be sent to as Bcc. 123 * 124 * @return the bcc recipients 125 * @throws Exception the exception 126 */ 127 public EmailAddressCollection getBccRecipients() throws Exception { 128 return (EmailAddressCollection) this 129 .getObjectFromPropertyDefinition( 130 EmailMessageSchema.BccRecipients); 131 } 132 133 /** 134 * Gets the item class. 135 * 136 * @return the item class 137 * @throws Exception the exception 138 */ 139 protected String getItemClass() throws Exception { 140 return (String) this 141 .getObjectFromPropertyDefinition(ItemSchema.ItemClass); 142 } 143 144 /** 145 * Sets the item class. 146 * 147 * @param value the new item class 148 * @throws Exception the exception 149 */ 150 protected void setItemClass(String value) throws Exception { 151 this.getPropertyBag().setObjectFromPropertyDefinition( 152 ItemSchema.ItemClass, value); 153 } 154 155 /** 156 * Gets the sensitivity of this response. 157 * 158 * @return the sensitivity 159 * @throws Exception the exception 160 */ 161 public Sensitivity getSensitivity() throws Exception { 162 return (Sensitivity) this 163 .getObjectFromPropertyDefinition(ItemSchema.Sensitivity); 164 } 165 166 /** 167 * Sets the sensitivity. 168 * 169 * @param value the new sensitivity 170 * @throws Exception the exception 171 */ 172 public void setSensitivity(Sensitivity value) throws Exception { 173 this.getPropertyBag().setObjectFromPropertyDefinition( 174 ItemSchema.Sensitivity, value); 175 } 176 177 /** 178 * Gets a list of attachments to this response. 179 * 180 * @return the attachments 181 * @throws Exception the exception 182 */ 183 public AttachmentCollection getAttachments() throws Exception { 184 return (AttachmentCollection) this 185 .getObjectFromPropertyDefinition(ItemSchema.Attachments); 186 } 187 188 /** 189 * Gets the internet message headers. 190 * 191 * @return the internet message headers 192 * @throws Exception the exception 193 */ 194 protected InternetMessageHeaderCollection getInternetMessageHeaders() 195 throws Exception { 196 return (InternetMessageHeaderCollection) this 197 .getObjectFromPropertyDefinition( 198 ItemSchema.InternetMessageHeaders); 199 } 200 201 /** 202 * Gets the sender of this response. 203 * 204 * @return the sender 205 * @throws Exception the exception 206 */ 207 public EmailAddress getSender() throws Exception { 208 return (EmailAddress) this 209 .getObjectFromPropertyDefinition(EmailMessageSchema.Sender); 210 } 211 212 /** 213 * Sets the sender. 214 * 215 * @param value the new sender 216 * @throws Exception the exception 217 */ 218 public void setSender(EmailAddress value) throws Exception { 219 this.getPropertyBag().setObjectFromPropertyDefinition( 220 EmailMessageSchema.Sender, value); 221 } 222 223 /** 224 * Gets the proposed start time. 225 * 226 * @return the start 227 * @throws ServiceLocalException the service local exception 228 */ 229 public Date getProposedStart() throws ServiceLocalException { 230 return getPropertyBag().getObjectFromPropertyDefinition( 231 MeetingResponseSchema.ProposedStart); 232 } 233 234 /** 235 * Sets the proposed start time. 236 * 237 * @param value the new start time 238 * @throws Exception the exception 239 */ 240 public void setProposedStart(Date value) throws Exception { 241 this.getPropertyBag().setObjectFromPropertyDefinition( 242 MeetingResponseSchema.ProposedStart, value); 243 } 244 245 /** 246 * Gets the proposed end time. 247 * 248 * @return the start 249 * @throws ServiceLocalException the service local exception 250 */ 251 public Date getProposedEnd() throws ServiceLocalException { 252 return getPropertyBag().getObjectFromPropertyDefinition( 253 MeetingResponseSchema.ProposedEnd); 254 } 255 256 257 /** 258 * Sets the proposed end time. 259 * 260 * @param value the new end time 261 * @throws Exception the exception 262 */ 263 public void setProposedEnd(Date value) throws Exception { 264 this.getPropertyBag().setObjectFromPropertyDefinition( 265 MeetingResponseSchema.ProposedEnd, value); 266 } 267 268}