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