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.service.ConversationFlagStatus;
029    import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
030    import microsoft.exchange.webservices.data.core.enumeration.property.Importance;
031    import microsoft.exchange.webservices.data.core.enumeration.property.PropertyDefinitionFlags;
032    import microsoft.exchange.webservices.data.property.complex.ConversationId;
033    import microsoft.exchange.webservices.data.property.complex.ICreateComplexPropertyDelegate;
034    import microsoft.exchange.webservices.data.property.complex.ItemIdCollection;
035    import microsoft.exchange.webservices.data.property.complex.StringList;
036    import microsoft.exchange.webservices.data.property.definition.BoolPropertyDefinition;
037    import microsoft.exchange.webservices.data.property.definition.ComplexPropertyDefinition;
038    import microsoft.exchange.webservices.data.property.definition.DateTimePropertyDefinition;
039    import microsoft.exchange.webservices.data.property.definition.GenericPropertyDefinition;
040    import microsoft.exchange.webservices.data.property.definition.IntPropertyDefinition;
041    import microsoft.exchange.webservices.data.property.definition.PropertyDefinition;
042    import microsoft.exchange.webservices.data.property.definition.StringPropertyDefinition;
043    
044    import java.util.EnumSet;
045    
046    /**
047     * Represents the schema for Conversation.
048     */
049    @Schema
050    public class ConversationSchema extends ServiceObjectSchema {
051    
052      /**
053       * Field URIs for Item.
054       */
055      private static class FieldUris {
056        /**
057         * The Constant ConversationId.
058         */
059        public static final String ConversationId =
060            "conversation:ConversationId";
061    
062        /**
063         * The Constant ConversationTopic.
064         */
065        public static final String ConversationTopic =
066            "conversation:ConversationTopic";
067    
068        /**
069         * The Constant UniqueRecipients.
070         */
071        public static final String UniqueRecipients =
072            "conversation:UniqueRecipients";
073    
074        /**
075         * The Constant GlobalUniqueRecipients.
076         */
077        public static final String GlobalUniqueRecipients =
078            "conversation:GlobalUniqueRecipients";
079    
080        /**
081         * The Constant UniqueUnreadSenders.
082         */
083        public static final String UniqueUnreadSenders =
084            "conversation:UniqueUnreadSenders";
085    
086        /**
087         * The Constant GlobalUniqueUnreadSenders.
088         */
089        public static final String GlobalUniqueUnreadSenders =
090            "conversation:GlobalUniqueUnreadSenders";
091    
092        /**
093         * The Constant UniqueSenders.
094         */
095        public static final String UniqueSenders = "conversation:UniqueSenders";
096    
097        /**
098         * The Constant GlobalUniqueSenders.
099         */
100        public static final String GlobalUniqueSenders =
101            "conversation:GlobalUniqueSenders";
102    
103        /**
104         * The Constant LastDeliveryTime.
105         */
106        public static final String LastDeliveryTime =
107            "conversation:LastDeliveryTime";
108    
109        /**
110         * The Constant GlobalLastDeliveryTime.
111         */
112        public static final String GlobalLastDeliveryTime =
113            "conversation:GlobalLastDeliveryTime";
114    
115        /**
116         * The Constant Categories.
117         */
118        public static final String Categories = "conversation:Categories";
119    
120        /**
121         * The Constant GlobalCategories.
122         */
123        public static final String GlobalCategories =
124            "conversation:GlobalCategories";
125    
126        /**
127         * The Constant FlagStatus.
128         */
129        public static final String FlagStatus = "conversation:FlagStatus";
130    
131        /**
132         * The Constant GlobalFlagStatus.
133         */
134        public static final String GlobalFlagStatus =
135            "conversation:GlobalFlagStatus";
136    
137        /**
138         * The Constant HasAttachments.
139         */
140        public static final String HasAttachments =
141            "conversation:HasAttachments";
142    
143        /**
144         * The Constant GlobalHasAttachments.
145         */
146        public static final String GlobalHasAttachments =
147            "conversation:GlobalHasAttachments";
148    
149        /**
150         * The Constant MessageCount.
151         */
152        public static final String MessageCount = "conversation:MessageCount";
153    
154        /**
155         * The Constant GlobalMessageCount.
156         */
157        public static final String GlobalMessageCount =
158            "conversation:GlobalMessageCount";
159    
160        /**
161         * The Constant UnreadCount.
162         */
163        public static final String UnreadCount = "conversation:UnreadCount";
164    
165        /**
166         * The Constant GlobalUnreadCount.
167         */
168        public static final String GlobalUnreadCount =
169            "conversation:GlobalUnreadCount";
170    
171        /**
172         * The Constant Size.
173         */
174        public static final String Size = "conversation:Size";
175    
176        /**
177         * The Constant GlobalSize.
178         */
179        public static final String GlobalSize = "conversation:GlobalSize";
180    
181        /**
182         * The Constant ItemClasses.
183         */
184        public static final String ItemClasses = "conversation:ItemClasses";
185    
186        /**
187         * The Constant GlobalItemClasses.
188         */
189        public static final String GlobalItemClasses =
190            "conversation:GlobalItemClasses";
191    
192        /**
193         * The Constant Importance.
194         */
195        public static final String Importance = "conversation:Importance";
196    
197        /**
198         * The Constant GlobalImportance.
199         */
200        public static final String GlobalImportance =
201            "conversation:GlobalImportance";
202    
203        /**
204         * The Constant ItemIds.
205         */
206        public static final String ItemIds = "conversation:ItemIds";
207    
208        /**
209         * The Constant GlobalItemIds.
210         */
211        public static final String GlobalItemIds = "conversation:GlobalItemIds";
212    
213      }
214    
215    
216      /**
217       * Defines the Id property.
218       */
219      public static final PropertyDefinition Id = new ComplexPropertyDefinition<ConversationId>(
220          ConversationId.class,
221          XmlElementNames.ConversationId, FieldUris.ConversationId, EnumSet
222          .of(PropertyDefinitionFlags.CanFind),
223          ExchangeVersion.Exchange2010_SP1,
224          new ICreateComplexPropertyDelegate<ConversationId>() {
225            public ConversationId createComplexProperty() {
226              return new ConversationId();
227            }
228          });
229    
230      /**
231       * Defines the Topic property.
232       */
233      public static final PropertyDefinition Topic =
234          new StringPropertyDefinition(
235              XmlElementNames.ConversationTopic,
236              FieldUris.ConversationTopic,
237              EnumSet
238                  .of(PropertyDefinitionFlags.CanFind),
239              ExchangeVersion.Exchange2010_SP1);
240    
241      /**
242       * Defines the UniqueRecipients property.
243       */
244      public static final PropertyDefinition UniqueRecipients = new
245          ComplexPropertyDefinition<StringList>(
246          StringList.class,
247          XmlElementNames.UniqueRecipients,
248          FieldUris.UniqueRecipients, EnumSet
249          .of(PropertyDefinitionFlags.CanFind),
250          ExchangeVersion.Exchange2010_SP1,
251          new ICreateComplexPropertyDelegate<StringList>() {
252            public StringList createComplexProperty() {
253              return new StringList();
254            }
255          });
256    
257    
258      /**
259       * Defines the GlobalUniqueRecipients property.
260       */
261      public static final PropertyDefinition GlobalUniqueRecipients =
262          new ComplexPropertyDefinition<StringList>(
263              StringList.class,
264              XmlElementNames.GlobalUniqueRecipients,
265              FieldUris.GlobalUniqueRecipients,
266              EnumSet
267                  .of(PropertyDefinitionFlags.CanFind),
268              ExchangeVersion.Exchange2010_SP1,
269              new ICreateComplexPropertyDelegate<StringList>() {
270                public StringList createComplexProperty() {
271                  return new StringList();
272                }
273              });
274    
275      /**
276       * Defines the UniqueUnreadSenders property.
277       */
278      public static final PropertyDefinition UniqueUnreadSenders =
279          new ComplexPropertyDefinition<StringList>(
280              StringList.class,
281              XmlElementNames.UniqueUnreadSenders,
282              FieldUris.UniqueUnreadSenders,
283              EnumSet
284                  .of(PropertyDefinitionFlags.CanFind),
285              ExchangeVersion.Exchange2010_SP1,
286              new ICreateComplexPropertyDelegate<StringList>() {
287                public StringList createComplexProperty() {
288                  return new StringList();
289                }
290              });
291    
292      /**
293       * Defines the GlobalUniqueUnreadSenders property.
294       */
295      public static final PropertyDefinition GlobalUniqueUnreadSenders =
296          new ComplexPropertyDefinition<StringList>(
297              StringList.class,
298              XmlElementNames.GlobalUniqueUnreadSenders,
299              FieldUris.GlobalUniqueUnreadSenders,
300              EnumSet
301                  .of(PropertyDefinitionFlags.CanFind),
302              ExchangeVersion.Exchange2010_SP1,
303              new ICreateComplexPropertyDelegate<StringList>() {
304                public StringList createComplexProperty() {
305                  return new StringList();
306                }
307              });
308    
309      /**
310       * Defines the UniqueSenders property.
311       */
312      public static final PropertyDefinition UniqueSenders =
313          new ComplexPropertyDefinition<StringList>(
314              StringList.class,
315              XmlElementNames.UniqueSenders,
316              FieldUris.UniqueSenders,
317              EnumSet
318                  .of(PropertyDefinitionFlags.CanFind),
319              ExchangeVersion.Exchange2010_SP1,
320              new ICreateComplexPropertyDelegate<StringList>() {
321                public StringList createComplexProperty() {
322                  return new StringList();
323                }
324              });
325    
326      /**
327       * Defines the GlobalUniqueSenders property.
328       */
329      public static final PropertyDefinition GlobalUniqueSenders =
330          new ComplexPropertyDefinition<StringList>(
331              StringList.class,
332              XmlElementNames.GlobalUniqueSenders,
333              FieldUris.GlobalUniqueSenders,
334              EnumSet
335                  .of(PropertyDefinitionFlags.CanFind),
336              ExchangeVersion.Exchange2010_SP1,
337              new ICreateComplexPropertyDelegate<StringList>() {
338                public StringList createComplexProperty() {
339                  return new StringList();
340                }
341              });
342    
343      /**
344       * Defines the LastDeliveryTime property.
345       */
346      public static final PropertyDefinition LastDeliveryTime =
347          new DateTimePropertyDefinition(
348              XmlElementNames.LastDeliveryTime,
349              FieldUris.LastDeliveryTime,
350              EnumSet
351                  .of(PropertyDefinitionFlags.CanFind),
352              ExchangeVersion.Exchange2010_SP1);
353    
354      /**
355       * Defines the GlobalLastDeliveryTime property.
356       */
357      public static final PropertyDefinition GlobalLastDeliveryTime =
358          new DateTimePropertyDefinition(
359              XmlElementNames.GlobalLastDeliveryTime,
360              FieldUris.GlobalLastDeliveryTime,
361              EnumSet
362                  .of(PropertyDefinitionFlags.CanFind),
363              ExchangeVersion.Exchange2010_SP1);
364    
365      /**
366       * Defines the Categories property.
367       */
368      public static final PropertyDefinition Categories =
369          new ComplexPropertyDefinition<StringList>(
370              StringList.class,
371              XmlElementNames.Categories,
372              FieldUris.Categories,
373              EnumSet
374                  .of(PropertyDefinitionFlags.CanFind),
375              ExchangeVersion.Exchange2010_SP1,
376              new ICreateComplexPropertyDelegate<StringList>() {
377                public StringList createComplexProperty() {
378                  return new StringList();
379                }
380              });
381    
382      /**
383       * Defines the GlobalCategories property.
384       */
385      public static final PropertyDefinition GlobalCategories =
386          new ComplexPropertyDefinition<StringList>(
387              StringList.class,
388              XmlElementNames.GlobalCategories,
389              FieldUris.GlobalCategories,
390              EnumSet
391                  .of(PropertyDefinitionFlags.CanFind),
392              ExchangeVersion.Exchange2010_SP1,
393              new ICreateComplexPropertyDelegate<StringList>() {
394                public StringList createComplexProperty() {
395                  return new StringList();
396                }
397              });
398    
399      /**
400       * Defines the FlagStatus property.
401       */
402      public static final PropertyDefinition FlagStatus =
403          new GenericPropertyDefinition<ConversationFlagStatus>(
404              ConversationFlagStatus.class,
405              XmlElementNames.FlagStatus,
406              FieldUris.FlagStatus,
407              EnumSet
408                  .of(PropertyDefinitionFlags.CanFind),
409              ExchangeVersion.Exchange2010_SP1);
410    
411      /**
412       * Defines the GlobalFlagStatus property.
413       */
414      public static final PropertyDefinition GlobalFlagStatus =
415          new GenericPropertyDefinition<ConversationFlagStatus>(
416              ConversationFlagStatus.class,
417              XmlElementNames.GlobalFlagStatus,
418              FieldUris.GlobalFlagStatus,
419              EnumSet
420                  .of(PropertyDefinitionFlags.CanFind),
421              ExchangeVersion.Exchange2010_SP1);
422    
423      /**
424       * Defines the HasAttachments property.
425       */
426      public static final PropertyDefinition HasAttachments =
427          new BoolPropertyDefinition(
428              XmlElementNames.HasAttachments,
429              FieldUris.HasAttachments,
430              EnumSet
431                  .of(PropertyDefinitionFlags.CanFind),
432              ExchangeVersion.Exchange2010_SP1);
433    
434      /**
435       * Defines the GlobalHasAttachments property.
436       */
437      public static final PropertyDefinition GlobalHasAttachments =
438          new BoolPropertyDefinition(
439              XmlElementNames.GlobalHasAttachments,
440              FieldUris.GlobalHasAttachments,
441              EnumSet
442                  .of(PropertyDefinitionFlags.CanFind),
443              ExchangeVersion.Exchange2010_SP1);
444    
445      /**
446       * Defines the MessageCount property.
447       */
448      public static final PropertyDefinition MessageCount =
449          new IntPropertyDefinition(
450              XmlElementNames.MessageCount,
451              FieldUris.MessageCount,
452              EnumSet
453                  .of(PropertyDefinitionFlags.CanFind),
454              ExchangeVersion.Exchange2010_SP1);
455    
456      /**
457       * Defines the GlobalMessageCount property.
458       */
459      public static final PropertyDefinition GlobalMessageCount =
460          new IntPropertyDefinition(
461              XmlElementNames.GlobalMessageCount,
462              FieldUris.GlobalMessageCount,
463              EnumSet
464                  .of(PropertyDefinitionFlags.CanFind),
465              ExchangeVersion.Exchange2010_SP1);
466    
467      /**
468       * Defines the UnreadCount property.
469       */
470      public static final PropertyDefinition UnreadCount =
471          new IntPropertyDefinition(
472              XmlElementNames.UnreadCount,
473              FieldUris.UnreadCount,
474              EnumSet
475                  .of(PropertyDefinitionFlags.CanFind),
476              ExchangeVersion.Exchange2010_SP1);
477    
478      /**
479       * Defines the GlobalUnreadCount property.
480       */
481      public static final PropertyDefinition GlobalUnreadCount =
482          new IntPropertyDefinition(
483              XmlElementNames.GlobalUnreadCount,
484              FieldUris.GlobalUnreadCount,
485              EnumSet
486                  .of(PropertyDefinitionFlags.CanFind),
487              ExchangeVersion.Exchange2010_SP1);
488    
489      /**
490       * Defines the Size property.
491       */
492      public static final PropertyDefinition Size =
493          new IntPropertyDefinition(
494              XmlElementNames.Size,
495              FieldUris.Size,
496              EnumSet
497                  .of(PropertyDefinitionFlags.CanFind),
498              ExchangeVersion.Exchange2010_SP1);
499    
500      /**
501       * Defines the GlobalSize property.
502       */
503      public static final PropertyDefinition GlobalSize =
504          new IntPropertyDefinition(
505              XmlElementNames.GlobalSize,
506              FieldUris.GlobalSize,
507              EnumSet
508                  .of(PropertyDefinitionFlags.CanFind),
509              ExchangeVersion.Exchange2010_SP1);
510    
511      /**
512       * Defines the ItemClasses property.
513       */
514      public static final PropertyDefinition ItemClasses =
515          new ComplexPropertyDefinition<StringList>(
516              StringList.class,
517              XmlElementNames.ItemClasses,
518              FieldUris.ItemClasses,
519              EnumSet
520                  .of(PropertyDefinitionFlags.CanFind),
521              ExchangeVersion.Exchange2010_SP1,
522              new ICreateComplexPropertyDelegate<StringList>() {
523                public StringList createComplexProperty() {
524                  return new StringList(XmlElementNames.
525                      ItemClass);
526                }
527              });
528    
529      /**
530       * Defines the GlobalItemClasses property.
531       */
532      public static final PropertyDefinition GlobalItemClasses =
533          new ComplexPropertyDefinition<StringList>(
534              StringList.class,
535              XmlElementNames.GlobalItemClasses,
536              FieldUris.GlobalItemClasses,
537              EnumSet
538                  .of(PropertyDefinitionFlags.CanFind),
539              ExchangeVersion.Exchange2010_SP1,
540              new ICreateComplexPropertyDelegate<StringList>() {
541                public StringList createComplexProperty() {
542                  return new StringList(XmlElementNames.
543                      ItemClass);
544                }
545              });
546    
547      /**
548       * Defines the Importance property.
549       */
550      public static final PropertyDefinition Importance =
551          new GenericPropertyDefinition<microsoft.exchange.webservices.data.core.enumeration.property.Importance>(
552              Importance.class,
553              XmlElementNames.Importance,
554              FieldUris.Importance,
555              EnumSet
556                  .of(PropertyDefinitionFlags.CanFind),
557              ExchangeVersion.Exchange2010_SP1);
558    
559      /**
560       * Defines the GlobalImportance property.
561       */
562      public static final PropertyDefinition GlobalImportance =
563          new GenericPropertyDefinition<Importance>(
564              Importance.class,
565              XmlElementNames.GlobalImportance,
566              FieldUris.GlobalImportance,
567              EnumSet
568                  .of(PropertyDefinitionFlags.CanFind),
569              ExchangeVersion.Exchange2010_SP1);
570    
571      /**
572       * Defines the ItemIds property.
573       */
574      public static final PropertyDefinition ItemIds =
575          new ComplexPropertyDefinition<ItemIdCollection>(
576              ItemIdCollection.class,
577              XmlElementNames.ItemIds,
578              FieldUris.ItemIds,
579              EnumSet
580                  .of(PropertyDefinitionFlags.CanFind),
581              ExchangeVersion.Exchange2010_SP1,
582              new ICreateComplexPropertyDelegate<ItemIdCollection>() {
583                public ItemIdCollection createComplexProperty() {
584                  return new ItemIdCollection();
585                }
586              });
587    
588      /**
589       * Defines the GlobalItemIds property.
590       */
591      public static final PropertyDefinition GlobalItemIds =
592          new ComplexPropertyDefinition<ItemIdCollection>(
593              ItemIdCollection.class,
594              XmlElementNames.GlobalItemIds,
595              FieldUris.GlobalItemIds,
596              EnumSet
597                  .of(PropertyDefinitionFlags.CanFind),
598              ExchangeVersion.Exchange2010_SP1,
599              new ICreateComplexPropertyDelegate<ItemIdCollection>() {
600                public ItemIdCollection createComplexProperty() {
601                  return new ItemIdCollection();
602                }
603              });
604    
605      /**
606       * This must be declared after the property definitions
607       */
608      public static final ConversationSchema Instance =
609          new ConversationSchema();
610    
611      /**
612       * Registers property.
613       */
614      @Override
615      protected void registerProperties() {
616        super.registerProperties();
617    
618        this.registerProperty(Id);
619        this.registerProperty(Topic);
620        this.registerProperty(UniqueRecipients);
621        this.registerProperty(GlobalUniqueRecipients);
622        this.registerProperty(UniqueUnreadSenders);
623        this.registerProperty(GlobalUniqueUnreadSenders);
624        this.registerProperty(UniqueSenders);
625        this.registerProperty(GlobalUniqueSenders);
626        this.registerProperty(LastDeliveryTime);
627        this.registerProperty(GlobalLastDeliveryTime);
628        this.registerProperty(Categories);
629        this.registerProperty(GlobalCategories);
630        this.registerProperty(FlagStatus);
631        this.registerProperty(GlobalFlagStatus);
632        this.registerProperty(HasAttachments);
633        this.registerProperty(GlobalHasAttachments);
634        this.registerProperty(MessageCount);
635        this.registerProperty(GlobalMessageCount);
636        this.registerProperty(UnreadCount);
637        this.registerProperty(GlobalUnreadCount);
638        this.registerProperty(Size);
639        this.registerProperty(GlobalSize);
640        this.registerProperty(ItemClasses);
641        this.registerProperty(GlobalItemClasses);
642        this.registerProperty(Importance);
643        this.registerProperty(GlobalImportance);
644        this.registerProperty(ItemIds);
645        this.registerProperty(GlobalItemIds);
646      }
647    
648      /**
649       * Initializes a new instance of
650       * the ConversationSchema class.
651       */
652      protected ConversationSchema() {
653        super();
654      }
655    
656    
657    
658    }