All Downloads are FREE. Search and download functionalities are using the official Maven repository.

microsoft.exchange.webservices.data.core.service.item.MeetingResponse Maven / Gradle / Ivy

There is a newer version: 2.15
Show newest version
/*
 * The MIT License
 * Copyright (c) 2012 Microsoft Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package microsoft.exchange.webservices.data.core.service.item;

import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import microsoft.exchange.webservices.data.attribute.ServiceObjectDefinition;
import microsoft.exchange.webservices.data.core.ExchangeService;
import microsoft.exchange.webservices.data.core.PropertySet;
import microsoft.exchange.webservices.data.core.XmlElementNames;
import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
import microsoft.exchange.webservices.data.core.enumeration.service.calendar.AppointmentType;
import microsoft.exchange.webservices.data.core.exception.service.local.ServiceLocalException;
import microsoft.exchange.webservices.data.core.service.schema.MeetingResponseSchema;
import microsoft.exchange.webservices.data.core.service.schema.ServiceObjectSchema;
import microsoft.exchange.webservices.data.property.complex.ItemAttachment;
import microsoft.exchange.webservices.data.property.complex.ItemId;
import microsoft.exchange.webservices.data.property.complex.recurrence.pattern.Recurrence;

/**
 * Represents a response to a meeting request. Properties available on meeting
 * messages are defined in the MeetingMessageSchema class.
 */
@ServiceObjectDefinition(xmlElementName = XmlElementNames.MeetingResponse)
public class MeetingResponse extends MeetingMessage {

  private static final Log LOG = LogFactory.getLog(MeetingResponse.class);

  /**
   * Initializes a new instance of the class.
   *
   * @param parentAttachment The parentAttachment
   * @throws Exception the exception
   */
  public MeetingResponse(ItemAttachment parentAttachment)
      throws Exception {
    super(parentAttachment);
  }

  /**
   * Initializes a new instance of the class.
   *
   * @param service EWS service to which this object belongs.
   * @throws Exception the exception
   */
  public MeetingResponse(ExchangeService service) throws Exception {
    super(service);
  }

  /**
   * Binds to an existing meeting response and loads the specified set of
   * property. Calling this method results in a call to EWS.
   *
   * @param service     The service to use to bind to the meeting response.
   * @param id          The Id of the meeting response to bind to.
   * @param propertySet The set of property to load.
   * @return A MeetingResponse instance representing the meeting response
   * corresponding to the specified Id.
   */
  public static MeetingResponse bind(ExchangeService service, ItemId id,
      PropertySet propertySet) {
    try {
      return service.bindToItem(MeetingResponse.class, id, propertySet);
    } catch (Exception e) {
      LOG.error(e);
      return null;
    }
  }

  /**
   * Binds to an existing meeting response and loads the specified set of
   * property. Calling this method results in a call to EWS.
   *
   * @param service The service to use to bind to the meeting response.
   * @param id      The Id of the meeting response to bind to.
   * @return A MeetingResponse instance representing the meeting response
   * corresponding to the specified Id.
   */
  public static MeetingResponse bind(ExchangeService service, ItemId id) {
    return MeetingResponse.bind(service, id, PropertySet
        .getFirstClassProperties());
  }

  /**
   * Internal method to return the schema associated with this type of object.
   *
   * @return The schema associated with this type of object.
   */
  @Override public ServiceObjectSchema getSchema() {
    return MeetingResponseSchema.Instance;
  }

  /**
   * Gets the minimum required server version.
   *
   * @return Earliest Exchange version in which this service object type is
   * supported.
   */
  @Override public ExchangeVersion getMinimumRequiredServerVersion() {
    return ExchangeVersion.Exchange2007_SP1;
  }

  // Properties

  /**
   * Gets the start time of the appointment.
   *
   * @return the start
   * @throws ServiceLocalException the service local exception
   */
  public Date getStart() throws ServiceLocalException {
    return getPropertyBag().getObjectFromPropertyDefinition(
        MeetingResponseSchema.Start);
  }

  /**
   * Gets or sets the end time of the appointment.
   *
   * @return the end
   * @throws ServiceLocalException the service local exception
   */
  public Date getEnd() throws ServiceLocalException {
    return getPropertyBag().getObjectFromPropertyDefinition(
        MeetingResponseSchema.End);
  }

  /**
   * Gets  the location of this appointment.
   *
   * @return the location
   * @throws ServiceLocalException the service local exception
   */
  public String getLocation() throws ServiceLocalException {
    return getPropertyBag().getObjectFromPropertyDefinition(
        MeetingResponseSchema.Location);
  }

  /**
   * Gets the recurrence pattern for this appointment. Available
   * recurrence pattern classes include Recurrence.DailyPattern,
   * Recurrence.MonthlyPattern and Recurrence.YearlyPattern.
   *
   * @return the recurrence
   * @throws ServiceLocalException the service local exception
   */
  public Recurrence getRecurrence() throws ServiceLocalException {
    return getPropertyBag().getObjectFromPropertyDefinition(
        MeetingResponseSchema.Recurrence);
  }

  /**
   * Gets a value indicating the type of this appointment.
   *
   * @return the appointment type
   * @throws ServiceLocalException the service local exception
   */
  public AppointmentType getAppointmentType() throws ServiceLocalException {
    return getPropertyBag().getObjectFromPropertyDefinition(
        MeetingResponseSchema.AppointmentType);
  }

  /**
   * Gets the proposed start time.
   *
   * @return the start
   * @throws ServiceLocalException the service local exception
   */
  public Date getProposedStart() throws ServiceLocalException {
    return getPropertyBag().getObjectFromPropertyDefinition(
        MeetingResponseSchema.ProposedStart);
  }

  /**
   * Sets the proposed start.
   *
   * @param value the proposed start
   * @throws Exception
   */
  public void setProposedStart(Date value) throws Exception {
    this.getPropertyBag().setObjectFromPropertyDefinition(
        MeetingResponseSchema.ProposedStart, value);
  }

  /**
   * Gets the proposed end time.
   *
   * @return the start
   * @throws ServiceLocalException the service local exception
   */
  public Date getProposedEnd() throws ServiceLocalException {
    return getPropertyBag().getObjectFromPropertyDefinition(
        MeetingResponseSchema.ProposedEnd);
  }

  /**
   * Sets the proposed end.
   *
   * @param value the proposed start
   * @throws Exception
   */
  public void setProposedEnd(Date value) throws Exception {
    this.getPropertyBag().setObjectFromPropertyDefinition(
        MeetingResponseSchema.ProposedEnd, value);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy