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    
024    package microsoft.exchange.webservices.data.core.service.item;
025    
026    import microsoft.exchange.webservices.data.attribute.ServiceObjectDefinition;
027    import microsoft.exchange.webservices.data.core.ExchangeService;
028    import microsoft.exchange.webservices.data.core.PropertySet;
029    import microsoft.exchange.webservices.data.core.XmlElementNames;
030    import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
031    import microsoft.exchange.webservices.data.property.complex.ItemAttachment;
032    import microsoft.exchange.webservices.data.property.complex.ItemId;
033    import org.apache.commons.logging.Log;
034    import org.apache.commons.logging.LogFactory;
035    
036    /**
037     * Represents a response to a meeting request. Properties available on meeting
038     * messages are defined in the MeetingMessageSchema class.
039     */
040    @ServiceObjectDefinition(xmlElementName = XmlElementNames.MeetingResponse)
041    public class MeetingResponse extends MeetingMessage {
042    
043      private static final Log LOG = LogFactory.getLog(MeetingResponse.class);
044    
045      /**
046       * Initializes a new instance of the class.
047       *
048       * @param parentAttachment The parentAttachment
049       * @throws Exception the exception
050       */
051      public MeetingResponse(ItemAttachment parentAttachment)
052          throws Exception {
053        super(parentAttachment);
054      }
055    
056      /**
057       * Initializes a new instance of the class.
058       *
059       * @param service EWS service to which this object belongs.
060       * @throws Exception the exception
061       */
062      public MeetingResponse(ExchangeService service) throws Exception {
063        super(service);
064      }
065    
066      /**
067       * Binds to an existing meeting response and loads the specified set of
068       * property. Calling this method results in a call to EWS.
069       *
070       * @param service     The service to use to bind to the meeting response.
071       * @param id          The Id of the meeting response to bind to.
072       * @param propertySet The set of property to load.
073       * @return A MeetingResponse instance representing the meeting response
074       * corresponding to the specified Id.
075       */
076      public static MeetingResponse bind(ExchangeService service, ItemId id,
077          PropertySet propertySet) {
078        try {
079          return service.bindToItem(MeetingResponse.class, id, propertySet);
080        } catch (Exception e) {
081          LOG.error(e);
082          return null;
083        }
084      }
085    
086      /**
087       * Binds to an existing meeting response and loads the specified set of
088       * property. Calling this method results in a call to EWS.
089       *
090       * @param service The service to use to bind to the meeting response.
091       * @param id      The Id of the meeting response to bind to.
092       * @return A MeetingResponse instance representing the meeting response
093       * corresponding to the specified Id.
094       */
095      public static MeetingResponse bind(ExchangeService service, ItemId id) {
096        return MeetingResponse.bind(service, id, PropertySet
097            .getFirstClassProperties());
098      }
099    
100      /**
101       * Gets the minimum required server version.
102       *
103       * @return Earliest Exchange version in which this service object type is
104       * supported.
105       */
106      @Override public ExchangeVersion getMinimumRequiredServerVersion() {
107        return ExchangeVersion.Exchange2007_SP1;
108      }
109    }