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.PropertyDefinitionFlags;
030    import microsoft.exchange.webservices.data.property.definition.DateTimePropertyDefinition;
031    import microsoft.exchange.webservices.data.property.definition.PropertyDefinition;
032    
033    import java.util.EnumSet;
034    
035    /**
036     * Represents the schema for post item.
037     */
038    @Schema
039    public final class PostItemSchema extends ItemSchema {
040    
041      /**
042       * Field URIs for PostItem.
043       */
044      private static interface FieldUris {
045    
046        /**
047         * The Posted time.
048         */
049        String PostedTime = "postitem:PostedTime";
050      }
051    
052    
053      /**
054       * Defines the ConversationIndex property.
055       */
056      public static final PropertyDefinition ConversationIndex =
057          EmailMessageSchema.ConversationIndex;
058    
059      /**
060       * Defines the ConversationTopic property.
061       */
062      public static final PropertyDefinition ConversationTopic =
063          EmailMessageSchema.ConversationTopic;
064    
065      /**
066       * Defines the From property.
067       */
068      public static final PropertyDefinition From = EmailMessageSchema.From;
069    
070      /**
071       * Defines the InternetMessageId property.
072       */
073      public static final PropertyDefinition InternetMessageId =
074          EmailMessageSchema.InternetMessageId;
075    
076      /**
077       * Defines the IsRead property.
078       */
079      public static final PropertyDefinition IsRead = EmailMessageSchema.IsRead;
080    
081      /**
082       * Defines the PostedTime property.
083       */
084      public static final PropertyDefinition PostedTime =
085          new DateTimePropertyDefinition(
086              XmlElementNames.PostedTime, FieldUris.PostedTime, EnumSet
087              .of(PropertyDefinitionFlags.CanFind),
088              ExchangeVersion.Exchange2007_SP1);
089    
090      /**
091       * Defines the References property.
092       */
093      public static final PropertyDefinition References =
094          EmailMessageSchema.References;
095    
096      /**
097       * Defines the Sender property.
098       */
099      public static final PropertyDefinition Sender = EmailMessageSchema.Sender;
100    
101      // This must be after the declaration of property definitions
102      /**
103       * The Constant Instance.
104       */
105      public static final PostItemSchema Instance = new PostItemSchema();
106    
107      /**
108       * Registers property.
109       * <p/>
110       * IMPORTANT NOTE: PROPERTIES MUST BE REGISTERED IN SCHEMA ORDER (i.e. the
111       * same order as they are defined in types.xsd)
112       */
113      @Override
114      protected void registerProperties() {
115        super.registerProperties();
116    
117        this.registerProperty(ConversationIndex);
118        this.registerProperty(ConversationTopic);
119        this.registerProperty(From);
120        this.registerProperty(InternetMessageId);
121        this.registerProperty(IsRead);
122        this.registerProperty(PostedTime);
123        this.registerProperty(References);
124        this.registerProperty(Sender);
125      }
126    
127      /**
128       * Initializes a new instance of the PostItemSchema class.
129       */
130      protected PostItemSchema() {
131        super();
132      }
133    }