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.schema;
025    
026    import microsoft.exchange.webservices.data.attribute.Schema;
027    import microsoft.exchange.webservices.data.core.XmlElementNames;
028    import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
029    import microsoft.exchange.webservices.data.core.enumeration.property.MeetingResponseType;
030    import microsoft.exchange.webservices.data.core.enumeration.property.PropertyDefinitionFlags;
031    import microsoft.exchange.webservices.data.property.complex.ICreateComplexPropertyDelegate;
032    import microsoft.exchange.webservices.data.property.complex.ItemId;
033    import microsoft.exchange.webservices.data.property.definition.BoolPropertyDefinition;
034    import microsoft.exchange.webservices.data.property.definition.ComplexPropertyDefinition;
035    import microsoft.exchange.webservices.data.property.definition.GenericPropertyDefinition;
036    import microsoft.exchange.webservices.data.property.definition.PropertyDefinition;
037    
038    import java.util.EnumSet;
039    
040    /**
041     * Represents the schema for meeting messages.
042     */
043    @Schema
044    public class MeetingMessageSchema extends EmailMessageSchema {
045    
046      /**
047       * Field URIs for MeetingMessage.
048       */
049      private static interface FieldUris {
050    
051        /**
052         * The Associated calendar item id.
053         */
054        String AssociatedCalendarItemId = "meeting:AssociatedCalendarItemId";
055    
056        /**
057         * The Is delegated.
058         */
059        String IsDelegated = "meeting:IsDelegated";
060    
061        /**
062         * The Is out of date.
063         */
064        String IsOutOfDate = "meeting:IsOutOfDate";
065    
066        /**
067         * The Has been processed.
068         */
069        String HasBeenProcessed = "meeting:HasBeenProcessed";
070    
071        /**
072         * The Response type.
073         */
074        String ResponseType = "meeting:ResponseType";
075      }
076    
077    
078      /**
079       * Defines the AssociatedAppointmentId property.
080       */
081      public static final PropertyDefinition AssociatedAppointmentId =
082          new ComplexPropertyDefinition<ItemId>(
083              //    ItemId.class,
084              XmlElementNames.AssociatedCalendarItemId,
085              FieldUris.AssociatedCalendarItemId,
086              ExchangeVersion.Exchange2007_SP1,
087              new ICreateComplexPropertyDelegate<ItemId>() {
088                @Override
089                public ItemId createComplexProperty() {
090                  return new ItemId();
091                }
092              });
093    
094      /**
095       * Defines the IsDelegated property.
096       */
097      public static final PropertyDefinition IsDelegated =
098          new BoolPropertyDefinition(
099              XmlElementNames.IsDelegated, FieldUris.IsDelegated, EnumSet
100              .of(PropertyDefinitionFlags.CanFind),
101              ExchangeVersion.Exchange2007_SP1);
102    
103      /**
104       * Defines the IsOutOfDate property.
105       */
106      public static final PropertyDefinition IsOutOfDate =
107          new BoolPropertyDefinition(
108              XmlElementNames.IsOutOfDate, FieldUris.IsOutOfDate,
109              ExchangeVersion.Exchange2007_SP1);
110    
111      /**
112       * Defines the HasBeenProcessed property.
113       */
114      public static final PropertyDefinition HasBeenProcessed =
115          new BoolPropertyDefinition(
116              XmlElementNames.HasBeenProcessed, FieldUris.HasBeenProcessed,
117              EnumSet.of(PropertyDefinitionFlags.CanFind),
118              ExchangeVersion.Exchange2007_SP1);
119    
120      /**
121       * Defines the ResponseType property.
122       */
123      public static final PropertyDefinition ResponseType =
124          new GenericPropertyDefinition<MeetingResponseType>(
125              MeetingResponseType.class,
126              XmlElementNames.ResponseType, FieldUris.ResponseType, EnumSet
127              .of(PropertyDefinitionFlags.CanFind),
128              ExchangeVersion.Exchange2007_SP1);
129    
130      /**
131       * Defines the ICalendar Uid property.
132       */
133      public static final PropertyDefinition ICalUid = AppointmentSchema.ICalUid;
134    
135      /**
136       * Defines the ICalendar RecurrenceId property.
137       */
138      public static final PropertyDefinition ICalRecurrenceId =
139          AppointmentSchema.ICalRecurrenceId;
140    
141      /**
142       * Defines the ICalendar DateTimeStamp property.
143       */
144      public static final PropertyDefinition ICalDateTimeStamp =
145          AppointmentSchema.ICalDateTimeStamp;
146    
147      /**
148       * This must be after the declaration of property definitions.
149       */
150      protected static final MeetingMessageSchema Instance =
151          new MeetingMessageSchema();
152    
153      /**
154       * Gets the single instance of MeetingMessageSchema.
155       *
156       * @return single instance of MeetingMessageSchema
157       */
158      public static MeetingMessageSchema getInstance() {
159        return Instance;
160      }
161    
162      /**
163       * Registers property.
164       * <p/>
165       * IMPORTANT NOTE: PROPERTIES MUST BE REGISTERED IN SCHEMA ORDER (i.e. the
166       * same order as they are defined in types.xsd)
167       */
168      @Override
169      protected void registerProperties() {
170        super.registerProperties();
171    
172        this.registerProperty(AssociatedAppointmentId);
173        this.registerProperty(IsDelegated);
174        this.registerProperty(IsOutOfDate);
175        this.registerProperty(HasBeenProcessed);
176        this.registerProperty(ResponseType);
177        this.registerProperty(ICalUid);
178        this.registerProperty(ICalRecurrenceId);
179        this.registerProperty(ICalDateTimeStamp);
180      }
181    
182      /**
183       * Initializes a new instance of the class.
184       */
185      protected MeetingMessageSchema() {
186        super();
187      }
188    
189    }