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.ContactSource;
029    import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
030    import microsoft.exchange.webservices.data.core.enumeration.service.FileAsMapping;
031    import microsoft.exchange.webservices.data.core.enumeration.property.PhysicalAddressIndex;
032    import microsoft.exchange.webservices.data.core.enumeration.property.PropertyDefinitionFlags;
033    import microsoft.exchange.webservices.data.property.complex.ByteArrayArray;
034    import microsoft.exchange.webservices.data.property.complex.CompleteName;
035    import microsoft.exchange.webservices.data.property.complex.EmailAddress;
036    import microsoft.exchange.webservices.data.property.complex.EmailAddressCollection;
037    import microsoft.exchange.webservices.data.property.complex.EmailAddressDictionary;
038    import microsoft.exchange.webservices.data.property.complex.ICreateComplexPropertyDelegate;
039    import microsoft.exchange.webservices.data.property.complex.ImAddressDictionary;
040    import microsoft.exchange.webservices.data.property.complex.PhoneNumberDictionary;
041    import microsoft.exchange.webservices.data.property.complex.PhysicalAddressDictionary;
042    import microsoft.exchange.webservices.data.property.complex.StringList;
043    import microsoft.exchange.webservices.data.property.definition.BoolPropertyDefinition;
044    import microsoft.exchange.webservices.data.property.definition.ByteArrayPropertyDefinition;
045    import microsoft.exchange.webservices.data.property.definition.ComplexPropertyDefinition;
046    import microsoft.exchange.webservices.data.property.definition.ContainedPropertyDefinition;
047    import microsoft.exchange.webservices.data.property.definition.DateTimePropertyDefinition;
048    import microsoft.exchange.webservices.data.property.definition.GenericPropertyDefinition;
049    import microsoft.exchange.webservices.data.property.definition.IndexedPropertyDefinition;
050    import microsoft.exchange.webservices.data.property.definition.PropertyDefinition;
051    import microsoft.exchange.webservices.data.property.definition.StringPropertyDefinition;
052    
053    import java.util.EnumSet;
054    
055    /**
056     * Represents the schema for contacts.
057     */
058    @Schema
059    public class ContactSchema extends ItemSchema {
060    
061      /**
062       * FieldURIs for contacts.
063       */
064      private interface FieldUris {
065    
066        /**
067         * The File as.
068         */
069        String FileAs = "contacts:FileAs";
070    
071        /**
072         * The File as mapping.
073         */
074        String FileAsMapping = "contacts:FileAsMapping";
075    
076        /**
077         * The Display name.
078         */
079        String DisplayName = "contacts:DisplayName";
080    
081        /**
082         * The Given name.
083         */
084        String GivenName = "contacts:GivenName";
085    
086        /**
087         * The Initials.
088         */
089        String Initials = "contacts:Initials";
090    
091        /**
092         * The Middle name.
093         */
094        String MiddleName = "contacts:MiddleName";
095    
096        /**
097         * The Nick name.
098         */
099        String NickName = "contacts:Nickname";
100    
101        /**
102         * The Complete name.
103         */
104        String CompleteName = "contacts:CompleteName";
105    
106        /**
107         * The Company name.
108         */
109        String CompanyName = "contacts:CompanyName";
110    
111        /**
112         * The Email address.
113         */
114        String EmailAddress = "contacts:EmailAddress";
115    
116        /**
117         * The Email addresses.
118         */
119        String EmailAddresses = "contacts:EmailAddresses";
120    
121        /**
122         * The Physical addresses.
123         */
124        String PhysicalAddresses = "contacts:PhysicalAddresses";
125    
126        /**
127         * The Phone number.
128         */
129        String PhoneNumber = "contacts:PhoneNumber";
130    
131        /**
132         * The Phone numbers.
133         */
134        String PhoneNumbers = "contacts:PhoneNumbers";
135    
136        /**
137         * The Assistant name.
138         */
139        String AssistantName = "contacts:AssistantName";
140    
141        /**
142         * The Birthday.
143         */
144        String Birthday = "contacts:Birthday";
145    
146        /**
147         * The Business home page.
148         */
149        String BusinessHomePage = "contacts:BusinessHomePage";
150    
151        /**
152         * The Children.
153         */
154        String Children = "contacts:Children";
155    
156        /**
157         * The Companies.
158         */
159        String Companies = "contacts:Companies";
160    
161        /**
162         * The Contact source.
163         */
164        String ContactSource = "contacts:ContactSource";
165    
166        /**
167         * The Department.
168         */
169        String Department = "contacts:Department";
170    
171        /**
172         * The Generation.
173         */
174        String Generation = "contacts:Generation";
175    
176        /**
177         * The Im address.
178         */
179        String ImAddress = "contacts:ImAddress";
180    
181        /**
182         * The Im addresses.
183         */
184        String ImAddresses = "contacts:ImAddresses";
185    
186        /**
187         * The Job title.
188         */
189        String JobTitle = "contacts:JobTitle";
190    
191        /**
192         * The Manager.
193         */
194        String Manager = "contacts:Manager";
195    
196        /**
197         * The Mileage.
198         */
199        String Mileage = "contacts:Mileage";
200    
201        /**
202         * The Office location.
203         */
204        String OfficeLocation = "contacts:OfficeLocation";
205    
206        /**
207         * The Physical address city.
208         */
209        String PhysicalAddressCity = "contacts:PhysicalAddress:City";
210    
211        /**
212         * The Physical address country or region.
213         */
214        String PhysicalAddressCountryOrRegion =
215            "contacts:PhysicalAddress:CountryOrRegion";
216    
217        /**
218         * The Physical address state.
219         */
220        String PhysicalAddressState = "contacts:PhysicalAddress:State";
221    
222        /**
223         * The Physical address street.
224         */
225        String PhysicalAddressStreet = "contacts:PhysicalAddress:Street";
226    
227        /**
228         * The Physical address postal code.
229         */
230        String PhysicalAddressPostalCode =
231            "contacts:PhysicalAddress:PostalCode";
232    
233        /**
234         * The Postal address index.
235         */
236        String PostalAddressIndex = "contacts:PostalAddressIndex";
237    
238        /**
239         * The Profession.
240         */
241        String Profession = "contacts:Profession";
242    
243        /**
244         * The Spouse name.
245         */
246        String SpouseName = "contacts:SpouseName";
247    
248        /**
249         * The Surname.
250         */
251        String Surname = "contacts:Surname";
252    
253        /**
254         * The Wedding anniversary.
255         */
256        String WeddingAnniversary = "contacts:WeddingAnniversary";
257    
258        /**
259         * The Has picture.
260         */
261        String HasPicture = "contacts:HasPicture";
262    
263        /**
264         * The PhoneticFullName.
265         */
266    
267        String PhoneticFullName = "contacts:PhoneticFullName";
268    
269        /**
270         * The PhoneticFirstName.
271         */
272    
273        String PhoneticFirstName = "contacts:PhonetiFirstName";
274    
275        /**
276         * The PhoneticFirstName.
277         */
278    
279        String PhoneticLastName = "contacts:PhonetiLastName";
280    
281        /**
282         * The Aias.
283         */
284    
285        String Alias = "contacts:Alias";
286    
287        /**
288         * The Notes.
289         */
290    
291        String Notes = "contacts:Notes";
292    
293        /**
294         * The Photo.
295         */
296    
297        String Photo = "contacts:Photo";
298    
299        /**
300         * The UserSMIMECertificate.
301         */
302    
303        String UserSMIMECertificate = "contacts:UserSMIMECertificate";
304    
305        /**
306         * The MSExchangeCertificate.
307         */
308    
309        String MSExchangeCertificate = "contacts:MSExchageCertificate";
310    
311        /**
312         * The DirectoryId.
313         */
314    
315        String DirectoryId = "contacts:DirectoryId";
316    
317        /**
318         * The ManagerMailbox.
319         */
320    
321        String ManagerMailbox = "contacts:ManagerMailbox";
322    
323        /**
324         * The DirectReports.
325         */
326    
327        String DirectReports = "contacts:DirectReports";
328      }
329    
330    
331      /**
332       * Defines the FileAs property.
333       */
334      public static final PropertyDefinition FileAs =
335          new StringPropertyDefinition(
336              XmlElementNames.FileAs, FieldUris.FileAs, EnumSet.of(
337              PropertyDefinitionFlags.CanSet,
338              PropertyDefinitionFlags.CanUpdate,
339              PropertyDefinitionFlags.CanDelete,
340              PropertyDefinitionFlags.CanFind),
341              ExchangeVersion.Exchange2007_SP1);
342    
343      /**
344       * Defines the FileAsMapping property.
345       */
346      public static final PropertyDefinition FileAsMapping =
347          new GenericPropertyDefinition<FileAsMapping>(
348              FileAsMapping.class,
349              XmlElementNames.FileAsMapping, FieldUris.FileAsMapping, EnumSet.of(
350              PropertyDefinitionFlags.CanSet,
351              PropertyDefinitionFlags.CanUpdate,
352              PropertyDefinitionFlags.CanDelete,
353              PropertyDefinitionFlags.CanFind),
354              ExchangeVersion.Exchange2007_SP1);
355    
356      /**
357       * Defines the DisplayName property.
358       */
359      public static final PropertyDefinition DisplayName =
360          new StringPropertyDefinition(
361              XmlElementNames.DisplayName, FieldUris.DisplayName, EnumSet.of(
362              PropertyDefinitionFlags.CanSet,
363              PropertyDefinitionFlags.CanUpdate,
364              PropertyDefinitionFlags.CanDelete,
365              PropertyDefinitionFlags.CanFind),
366              ExchangeVersion.Exchange2007_SP1);
367    
368      /**
369       * Defines the GivenName property.
370       */
371      public static final PropertyDefinition GivenName =
372          new StringPropertyDefinition(
373              XmlElementNames.GivenName, FieldUris.GivenName, EnumSet.of(
374              PropertyDefinitionFlags.CanSet,
375              PropertyDefinitionFlags.CanUpdate,
376              PropertyDefinitionFlags.CanDelete,
377              PropertyDefinitionFlags.CanFind),
378              ExchangeVersion.Exchange2007_SP1);
379    
380      /**
381       * Defines the Initials property.
382       */
383      public static final PropertyDefinition Initials =
384          new StringPropertyDefinition(
385              XmlElementNames.Initials, FieldUris.Initials, EnumSet.of(
386              PropertyDefinitionFlags.CanSet,
387              PropertyDefinitionFlags.CanUpdate,
388              PropertyDefinitionFlags.CanDelete,
389              PropertyDefinitionFlags.CanFind),
390              ExchangeVersion.Exchange2007_SP1);
391    
392      /**
393       * Defines the MiddleName property.
394       */
395      public static final PropertyDefinition MiddleName =
396          new StringPropertyDefinition(
397              XmlElementNames.MiddleName, FieldUris.MiddleName, EnumSet.of(
398              PropertyDefinitionFlags.CanSet,
399              PropertyDefinitionFlags.CanUpdate,
400              PropertyDefinitionFlags.CanDelete,
401              PropertyDefinitionFlags.CanFind),
402              ExchangeVersion.Exchange2007_SP1);
403    
404      /**
405       * Defines the NickName property.
406       */
407      public static final PropertyDefinition NickName =
408          new StringPropertyDefinition(
409              XmlElementNames.NickName, FieldUris.NickName, EnumSet.of(
410              PropertyDefinitionFlags.CanSet,
411              PropertyDefinitionFlags.CanUpdate,
412              PropertyDefinitionFlags.CanDelete,
413              PropertyDefinitionFlags.CanFind),
414              ExchangeVersion.Exchange2007_SP1);
415    
416      /**
417       * Defines the CompleteName property.
418       */
419      public static final PropertyDefinition CompleteName =
420          new ComplexPropertyDefinition<microsoft.exchange.webservices.data.property.complex.CompleteName>(
421              CompleteName.class,
422              XmlElementNames.CompleteName, FieldUris.CompleteName, EnumSet
423              .of(PropertyDefinitionFlags.CanFind),
424              ExchangeVersion.Exchange2007_SP1,
425              new ICreateComplexPropertyDelegate<CompleteName>() {
426                @Override
427                public CompleteName createComplexProperty() {
428                  return new CompleteName();
429                }
430              });
431    
432      /**
433       * Defines the CompanyName property.
434       */
435      public static final PropertyDefinition CompanyName =
436          new StringPropertyDefinition(
437              XmlElementNames.CompanyName, FieldUris.CompanyName, EnumSet.of(
438              PropertyDefinitionFlags.CanSet,
439              PropertyDefinitionFlags.CanUpdate,
440              PropertyDefinitionFlags.CanDelete,
441              PropertyDefinitionFlags.CanFind),
442              ExchangeVersion.Exchange2007_SP1);
443    
444      /**
445       * Defines the EmailAddresses property.
446       */
447      public static final PropertyDefinition EmailAddresses =
448          new ComplexPropertyDefinition<EmailAddressDictionary>(
449              EmailAddressDictionary.class,
450              XmlElementNames.EmailAddresses,
451              FieldUris.EmailAddresses,
452              EnumSet.of(PropertyDefinitionFlags.AutoInstantiateOnRead,
453                  PropertyDefinitionFlags.CanSet,
454                  PropertyDefinitionFlags.CanUpdate),
455              ExchangeVersion.Exchange2007_SP1,
456              new ICreateComplexPropertyDelegate
457                  <EmailAddressDictionary>() {
458                @Override
459                public EmailAddressDictionary createComplexProperty() {
460                  return new EmailAddressDictionary();
461                }
462              });
463    
464      /**
465       * Defines the PhysicalAddresses property.
466       */
467      public static final PropertyDefinition PhysicalAddresses =
468          new ComplexPropertyDefinition<PhysicalAddressDictionary>(
469              PhysicalAddressDictionary.class,
470              XmlElementNames.PhysicalAddresses,
471              FieldUris.PhysicalAddresses,
472              EnumSet.of(PropertyDefinitionFlags.AutoInstantiateOnRead,
473                  PropertyDefinitionFlags.CanSet,
474                  PropertyDefinitionFlags.CanUpdate),
475              ExchangeVersion.Exchange2007_SP1,
476              new ICreateComplexPropertyDelegate
477                  <PhysicalAddressDictionary>() {
478                @Override
479                public PhysicalAddressDictionary createComplexProperty() {
480                  return new PhysicalAddressDictionary();
481                }
482              });
483    
484      /**
485       * Defines the PhoneNumbers property.
486       */
487      public static final PropertyDefinition PhoneNumbers =
488          new ComplexPropertyDefinition<PhoneNumberDictionary>(
489              PhoneNumberDictionary.class,
490              XmlElementNames.PhoneNumbers,
491              FieldUris.PhoneNumbers,
492              EnumSet.of(PropertyDefinitionFlags.AutoInstantiateOnRead,
493                  PropertyDefinitionFlags.CanSet,
494                  PropertyDefinitionFlags.CanUpdate),
495              ExchangeVersion.Exchange2007_SP1,
496              new ICreateComplexPropertyDelegate
497                  <PhoneNumberDictionary>() {
498                @Override
499                public PhoneNumberDictionary createComplexProperty() {
500                  return new PhoneNumberDictionary();
501                }
502              });
503    
504      /**
505       * Defines the AssistantName property.
506       */
507      public static final PropertyDefinition AssistantName =
508          new StringPropertyDefinition(
509              XmlElementNames.AssistantName, FieldUris.AssistantName, EnumSet.of(
510              PropertyDefinitionFlags.CanSet,
511              PropertyDefinitionFlags.CanUpdate,
512              PropertyDefinitionFlags.CanDelete,
513              PropertyDefinitionFlags.CanFind),
514              ExchangeVersion.Exchange2007_SP1);
515    
516      /**
517       * Defines the Birthday property.
518       */
519      public static final PropertyDefinition Birthday =
520          new DateTimePropertyDefinition(
521              XmlElementNames.Birthday, FieldUris.Birthday, EnumSet.of(
522              PropertyDefinitionFlags.CanSet,
523              PropertyDefinitionFlags.CanUpdate,
524              PropertyDefinitionFlags.CanDelete,
525              PropertyDefinitionFlags.CanFind),
526              ExchangeVersion.Exchange2007_SP1);
527    
528      /**
529       * Defines the BusinessHomePage property.
530       * <p/>
531       * Defined as anyURI in the EWS schema. String is fine here.
532       */
533      public static final PropertyDefinition BusinessHomePage =
534          new StringPropertyDefinition(
535              XmlElementNames.BusinessHomePage, FieldUris.BusinessHomePage,
536              EnumSet.of(PropertyDefinitionFlags.CanSet,
537                  PropertyDefinitionFlags.CanUpdate,
538                  PropertyDefinitionFlags.CanDelete,
539                  PropertyDefinitionFlags.CanFind),
540              ExchangeVersion.Exchange2007_SP1);
541    
542      /**
543       * Defines the Children property.
544       */
545      public static final PropertyDefinition Children =
546          new ComplexPropertyDefinition<StringList>(
547              StringList.class,
548              XmlElementNames.Children, FieldUris.Children, EnumSet.of(
549              PropertyDefinitionFlags.AutoInstantiateOnRead,
550              PropertyDefinitionFlags.CanSet,
551              PropertyDefinitionFlags.CanUpdate,
552              PropertyDefinitionFlags.CanDelete,
553              PropertyDefinitionFlags.CanFind),
554              ExchangeVersion.Exchange2007_SP1,
555              new ICreateComplexPropertyDelegate<StringList>() {
556                @Override
557                public StringList createComplexProperty() {
558                  return new StringList();
559                }
560              });
561    
562      /**
563       * Defines the Companies property.
564       */
565      public static final PropertyDefinition Companies =
566          new ComplexPropertyDefinition<StringList>(
567              StringList.class,
568              XmlElementNames.Companies, FieldUris.Companies, EnumSet.of(
569              PropertyDefinitionFlags.AutoInstantiateOnRead,
570              PropertyDefinitionFlags.CanSet,
571              PropertyDefinitionFlags.CanUpdate,
572              PropertyDefinitionFlags.CanDelete,
573              PropertyDefinitionFlags.CanFind),
574              ExchangeVersion.Exchange2007_SP1,
575              new ICreateComplexPropertyDelegate<StringList>() {
576                @Override
577                public StringList createComplexProperty() {
578                  return new StringList();
579                }
580              });
581    
582      /**
583       * Defines the ContactSource property.
584       */
585      public static final PropertyDefinition ContactSource =
586          new GenericPropertyDefinition<ContactSource>(
587              ContactSource.class,
588              XmlElementNames.ContactSource, FieldUris.ContactSource, EnumSet
589              .of(PropertyDefinitionFlags.CanFind),
590              ExchangeVersion.Exchange2007_SP1);
591    
592      /**
593       * Defines the Department property.
594       */
595      public static final PropertyDefinition Department =
596          new StringPropertyDefinition(
597              XmlElementNames.Department, FieldUris.Department, EnumSet.of(
598              PropertyDefinitionFlags.CanSet,
599              PropertyDefinitionFlags.CanUpdate,
600              PropertyDefinitionFlags.CanDelete,
601              PropertyDefinitionFlags.CanFind),
602              ExchangeVersion.Exchange2007_SP1);
603    
604      /**
605       * Defines the Generation property.
606       */
607      public static final PropertyDefinition Generation =
608          new StringPropertyDefinition(
609              XmlElementNames.Generation, FieldUris.Generation, EnumSet.of(
610              PropertyDefinitionFlags.CanSet,
611              PropertyDefinitionFlags.CanUpdate,
612              PropertyDefinitionFlags.CanDelete,
613              PropertyDefinitionFlags.CanFind),
614              ExchangeVersion.Exchange2007_SP1);
615    
616      /**
617       * Defines the ImAddresses property.
618       */
619      public static final PropertyDefinition ImAddresses =
620          new ComplexPropertyDefinition<ImAddressDictionary>(
621              ImAddressDictionary.class,
622              XmlElementNames.ImAddresses, FieldUris.ImAddresses, EnumSet.of(
623              PropertyDefinitionFlags.AutoInstantiateOnRead,
624              PropertyDefinitionFlags.CanSet,
625              PropertyDefinitionFlags.CanUpdate),
626              ExchangeVersion.Exchange2007_SP1,
627              new ICreateComplexPropertyDelegate<ImAddressDictionary>() {
628                @Override
629                public ImAddressDictionary createComplexProperty() {
630                  return new ImAddressDictionary();
631                }
632              });
633    
634      /**
635       * Defines the JobTitle property.
636       */
637      public static final PropertyDefinition JobTitle =
638          new StringPropertyDefinition(
639              XmlElementNames.JobTitle, FieldUris.JobTitle, EnumSet.of(
640              PropertyDefinitionFlags.CanSet,
641              PropertyDefinitionFlags.CanUpdate,
642              PropertyDefinitionFlags.CanDelete,
643              PropertyDefinitionFlags.CanFind),
644              ExchangeVersion.Exchange2007_SP1);
645    
646      /**
647       * Defines the Manager property.
648       */
649      public static final PropertyDefinition Manager =
650          new StringPropertyDefinition(
651              XmlElementNames.Manager, FieldUris.Manager, EnumSet.of(
652              PropertyDefinitionFlags.CanSet,
653              PropertyDefinitionFlags.CanUpdate,
654              PropertyDefinitionFlags.CanDelete,
655              PropertyDefinitionFlags.CanFind),
656              ExchangeVersion.Exchange2007_SP1);
657    
658      /**
659       * Defines the Mileage property.
660       */
661      public static final PropertyDefinition Mileage =
662          new StringPropertyDefinition(
663              XmlElementNames.Mileage, FieldUris.Mileage, EnumSet.of(
664              PropertyDefinitionFlags.CanSet,
665              PropertyDefinitionFlags.CanUpdate,
666              PropertyDefinitionFlags.CanDelete,
667              PropertyDefinitionFlags.CanFind),
668              ExchangeVersion.Exchange2007_SP1);
669    
670      /**
671       * Defines the OfficeLocation property.
672       */
673      public static final PropertyDefinition OfficeLocation =
674          new StringPropertyDefinition(
675              XmlElementNames.OfficeLocation, FieldUris.OfficeLocation, EnumSet
676              .of(PropertyDefinitionFlags.CanSet,
677                  PropertyDefinitionFlags.CanUpdate,
678                  PropertyDefinitionFlags.CanDelete,
679                  PropertyDefinitionFlags.CanFind),
680              ExchangeVersion.Exchange2007_SP1);
681    
682      /**
683       * Defines the PostalAddressIndex property.
684       */
685      public static final PropertyDefinition PostalAddressIndex =
686          new GenericPropertyDefinition<PhysicalAddressIndex>(
687              PhysicalAddressIndex.class,
688              XmlElementNames.PostalAddressIndex, FieldUris.PostalAddressIndex,
689              EnumSet.of(PropertyDefinitionFlags.CanSet,
690                  PropertyDefinitionFlags.CanUpdate,
691                  PropertyDefinitionFlags.CanDelete,
692                  PropertyDefinitionFlags.CanFind),
693              ExchangeVersion.Exchange2007_SP1);
694    
695      /**
696       * Defines the Profession property.
697       */
698      public static final PropertyDefinition Profession =
699          new StringPropertyDefinition(
700              XmlElementNames.Profession, FieldUris.Profession, EnumSet.of(
701              PropertyDefinitionFlags.CanSet,
702              PropertyDefinitionFlags.CanUpdate,
703              PropertyDefinitionFlags.CanDelete,
704              PropertyDefinitionFlags.CanFind),
705              ExchangeVersion.Exchange2007_SP1);
706    
707      /**
708       * Defines the SpouseName property.
709       */
710      public static final PropertyDefinition SpouseName =
711          new StringPropertyDefinition(
712              XmlElementNames.SpouseName, FieldUris.SpouseName, EnumSet.of(
713              PropertyDefinitionFlags.CanSet,
714              PropertyDefinitionFlags.CanUpdate,
715              PropertyDefinitionFlags.CanDelete,
716              PropertyDefinitionFlags.CanFind),
717              ExchangeVersion.Exchange2007_SP1);
718    
719      /**
720       * Defines the Surname property.
721       */
722      public static final PropertyDefinition Surname =
723          new StringPropertyDefinition(
724              XmlElementNames.Surname, FieldUris.Surname, EnumSet.of(
725              PropertyDefinitionFlags.CanSet,
726              PropertyDefinitionFlags.CanUpdate,
727              PropertyDefinitionFlags.CanDelete,
728              PropertyDefinitionFlags.CanFind),
729              ExchangeVersion.Exchange2007_SP1);
730    
731      /**
732       * Defines the WeddingAnniversary property.
733       */
734      public static final PropertyDefinition WeddingAnniversary =
735          new DateTimePropertyDefinition(
736              XmlElementNames.WeddingAnniversary, FieldUris.WeddingAnniversary,
737              EnumSet.of(PropertyDefinitionFlags.CanSet,
738                  PropertyDefinitionFlags.CanUpdate,
739                  PropertyDefinitionFlags.CanDelete,
740                  PropertyDefinitionFlags.CanFind),
741              ExchangeVersion.Exchange2007_SP1);
742    
743      /**
744       * Defines the HasPicture property.
745       */
746      public static final PropertyDefinition HasPicture =
747          new BoolPropertyDefinition(
748              XmlElementNames.HasPicture, FieldUris.HasPicture, EnumSet
749              .of(PropertyDefinitionFlags.CanFind),
750              ExchangeVersion.Exchange2010);
751      /**
752       * Defines PhoeniticFullName property **
753       */
754    
755      public static final PropertyDefinition PhoneticFullName =
756          new StringPropertyDefinition(
757              XmlElementNames.PhoneticFullName,
758              FieldUris.PhoneticFullName,
759              EnumSet.of(PropertyDefinitionFlags.CanFind),
760              ExchangeVersion.Exchange2010_SP1);
761    
762      /**
763       * Defines PhoenticFirstName property **
764       */
765    
766      public static final PropertyDefinition PhoneticFirstName =
767          new StringPropertyDefinition(
768              XmlElementNames.PhoneticFirstName,
769              FieldUris.PhoneticFirstName,
770              EnumSet.of(PropertyDefinitionFlags.CanFind),
771              ExchangeVersion.Exchange2010_SP1);
772    
773      /**
774       * Defines PhoneticLastName Property **
775       */
776    
777      public static final PropertyDefinition PhoneticLastName =
778          new StringPropertyDefinition(
779              XmlElementNames.PhoneticLastName,
780              FieldUris.PhoneticLastName,
781              EnumSet.of(PropertyDefinitionFlags.CanFind),
782              ExchangeVersion.Exchange2010_SP1);
783    
784      /**
785       * Defines the Alias Property  **
786       */
787    
788      public static final PropertyDefinition Alias =
789          new StringPropertyDefinition(
790              XmlElementNames.Alias,
791              FieldUris.Alias,
792              EnumSet.of(PropertyDefinitionFlags.CanFind),
793              ExchangeVersion.Exchange2010_SP1);
794    
795    
796      /**
797       * Defines the Notes Property **
798       */
799    
800      public static final PropertyDefinition Notes =
801          new StringPropertyDefinition(
802              XmlElementNames.Notes,
803              FieldUris.Notes,
804              EnumSet.of(PropertyDefinitionFlags.CanFind),
805              ExchangeVersion.Exchange2010_SP1);
806    
807      /**
808       * Defines Photo Property   **
809       */
810    
811      public static final PropertyDefinition Photo =
812          new ByteArrayPropertyDefinition(
813              XmlElementNames.Photo,
814              FieldUris.Photo,
815              EnumSet.of(PropertyDefinitionFlags.CanFind),
816              ExchangeVersion.Exchange2010_SP1);
817    
818      /**
819       * Defines UserSMIMECertificate Property **
820       */
821    
822      public static final PropertyDefinition UserSMIMECertificate =
823          new ComplexPropertyDefinition<ByteArrayArray>(
824              ByteArrayArray.class,
825              XmlElementNames.UserSMIMECertificate,
826              FieldUris.UserSMIMECertificate,
827              EnumSet.of(PropertyDefinitionFlags.CanFind),
828              ExchangeVersion.Exchange2010_SP1,
829              new ICreateComplexPropertyDelegate<ByteArrayArray>() {
830                @Override
831                public ByteArrayArray createComplexProperty() {
832                  return new ByteArrayArray();
833                }
834              });
835    
836      /**
837       * Defines MSExchangeCertificate Property **
838       */
839    
840      public static final PropertyDefinition MSExchangeCertificate =
841          new ComplexPropertyDefinition<ByteArrayArray>(
842              ByteArrayArray.class,
843              XmlElementNames.MSExchangeCertificate,
844              FieldUris.MSExchangeCertificate,
845              EnumSet.of(PropertyDefinitionFlags.CanFind),
846              ExchangeVersion.Exchange2010_SP1,
847              new ICreateComplexPropertyDelegate<ByteArrayArray>() {
848                @Override
849                public ByteArrayArray createComplexProperty() {
850                  return new ByteArrayArray();
851                }
852              });
853    
854    
855      /**
856       * Defines DirectoryId Property **
857       */
858    
859      public static final  PropertyDefinition DirectoryId =
860          new StringPropertyDefinition(
861              XmlElementNames.DirectoryId,
862              FieldUris.DirectoryId,
863              EnumSet.of(PropertyDefinitionFlags.CanFind),
864              ExchangeVersion.Exchange2010_SP1);
865    
866      /**
867       * Defines ManagerMailbox Property **
868       */
869    
870      public static final PropertyDefinition ManagerMailbox =
871          new ContainedPropertyDefinition<EmailAddress>(
872              EmailAddress.class,
873              XmlElementNames.ManagerMailbox,
874              FieldUris.ManagerMailbox,
875              XmlElementNames.Mailbox,
876              EnumSet.of(PropertyDefinitionFlags.CanFind),
877              ExchangeVersion.Exchange2010_SP1,
878              new ICreateComplexPropertyDelegate<EmailAddress>() {
879                @Override
880                public EmailAddress createComplexProperty() {
881                  return new EmailAddress();
882                }
883              });
884    
885      /**
886       * Defines DirectReports Property **
887       */
888    
889      public static final PropertyDefinition DirectReports =
890          new ComplexPropertyDefinition<EmailAddressCollection>(
891              EmailAddressCollection.class,
892              XmlElementNames.DirectReports,
893              FieldUris.DirectReports,
894              EnumSet.of(PropertyDefinitionFlags.CanFind),
895              ExchangeVersion.Exchange2010_SP1,
896              new ICreateComplexPropertyDelegate<EmailAddressCollection>() {
897                @Override
898                public EmailAddressCollection createComplexProperty()
899    
900                {
901                  return new EmailAddressCollection();
902                }
903              });
904    
905    
906    
907      /**
908       * Defines the EmailAddress1 property.
909       */
910      public static final IndexedPropertyDefinition EmailAddress1 =
911          new IndexedPropertyDefinition(
912              FieldUris.EmailAddress, "EmailAddress1");
913    
914      /**
915       * Defines the EmailAddress2 property.
916       */
917      public static final IndexedPropertyDefinition EmailAddress2 =
918          new IndexedPropertyDefinition(
919              FieldUris.EmailAddress, "EmailAddress2");
920    
921      /**
922       * Defines the EmailAddress3 property.
923       */
924      public static final IndexedPropertyDefinition EmailAddress3 =
925          new IndexedPropertyDefinition(
926              FieldUris.EmailAddress, "EmailAddress3");
927    
928      /**
929       * Defines the ImAddress1 property.
930       */
931      public static final IndexedPropertyDefinition ImAddress1 =
932          new IndexedPropertyDefinition(
933              FieldUris.ImAddress, "ImAddress1");
934    
935      /**
936       * Defines the ImAddress2 property.
937       */
938      public static final IndexedPropertyDefinition ImAddress2 =
939          new IndexedPropertyDefinition(
940              FieldUris.ImAddress, "ImAddress2");
941    
942      /**
943       * Defines the ImAddress3 property.
944       */
945      public static final IndexedPropertyDefinition ImAddress3 =
946          new IndexedPropertyDefinition(
947              FieldUris.ImAddress, "ImAddress3");
948    
949      /**
950       * Defines the AssistentPhone property.
951       */
952      public static final IndexedPropertyDefinition AssistantPhone =
953          new IndexedPropertyDefinition(
954              FieldUris.PhoneNumber, "AssistantPhone");
955    
956      /**
957       * Defines the BusinessFax property.
958       */
959      public static final IndexedPropertyDefinition BusinessFax =
960          new IndexedPropertyDefinition(
961              FieldUris.PhoneNumber, "BusinessFax");
962    
963      /**
964       * Defines the BusinessPhone property.
965       */
966      public static final IndexedPropertyDefinition BusinessPhone =
967          new IndexedPropertyDefinition(
968              FieldUris.PhoneNumber, "BusinessPhone");
969    
970      /**
971       * Defines the BusinessPhone2 property.
972       */
973      public static final IndexedPropertyDefinition BusinessPhone2 =
974          new IndexedPropertyDefinition(
975              FieldUris.PhoneNumber, "BusinessPhone2");
976    
977      /**
978       * Defines the Callback property.
979       */
980      public static final IndexedPropertyDefinition Callback =
981          new IndexedPropertyDefinition(
982              FieldUris.PhoneNumber, "Callback");
983    
984      /**
985       * Defines the CarPhone property.
986       */
987      public static final IndexedPropertyDefinition CarPhone =
988          new IndexedPropertyDefinition(
989              FieldUris.PhoneNumber, "CarPhone");
990    
991      /**
992       * Defines the CompanyMainPhone property.
993       */
994      public static final IndexedPropertyDefinition CompanyMainPhone =
995          new IndexedPropertyDefinition(
996              FieldUris.PhoneNumber, "CompanyMainPhone");
997    
998      /**
999       * Defines the HomeFax property.
1000       */
1001      public static final IndexedPropertyDefinition HomeFax =
1002          new IndexedPropertyDefinition(
1003              FieldUris.PhoneNumber, "HomeFax");
1004    
1005      /**
1006       * Defines the HomePhone property.
1007       */
1008      public static final IndexedPropertyDefinition HomePhone =
1009          new IndexedPropertyDefinition(
1010              FieldUris.PhoneNumber, "HomePhone");
1011    
1012      /**
1013       * Defines the HomePhone2 property.
1014       */
1015      public static final IndexedPropertyDefinition HomePhone2 =
1016          new IndexedPropertyDefinition(
1017              FieldUris.PhoneNumber, "HomePhone2");
1018    
1019      /**
1020       * Defines the Isdn property.
1021       */
1022      public static final IndexedPropertyDefinition Isdn =
1023          new IndexedPropertyDefinition(
1024              FieldUris.PhoneNumber, "Isdn");
1025    
1026      /**
1027       * Defines the MobilePhone property.
1028       */
1029      public static final IndexedPropertyDefinition MobilePhone =
1030          new IndexedPropertyDefinition(
1031              FieldUris.PhoneNumber, "MobilePhone");
1032    
1033      /**
1034       * Defines the OtherFax property.
1035       */
1036      public static final IndexedPropertyDefinition OtherFax =
1037          new IndexedPropertyDefinition(
1038              FieldUris.PhoneNumber, "OtherFax");
1039    
1040      /**
1041       * Defines the OtherTelephone property.
1042       */
1043      public static final IndexedPropertyDefinition OtherTelephone =
1044          new IndexedPropertyDefinition(
1045              FieldUris.PhoneNumber, "OtherTelephone");
1046    
1047      /**
1048       * Defines the Pager property.
1049       */
1050      public static final IndexedPropertyDefinition Pager =
1051          new IndexedPropertyDefinition(
1052              FieldUris.PhoneNumber, "Pager");
1053    
1054      /**
1055       * Defines the PrimaryPhone property.
1056       */
1057      public static final IndexedPropertyDefinition PrimaryPhone =
1058          new IndexedPropertyDefinition(
1059              FieldUris.PhoneNumber, "PrimaryPhone");
1060    
1061      /**
1062       * Defines the RadioPhone property.
1063       */
1064      public static final IndexedPropertyDefinition RadioPhone =
1065          new IndexedPropertyDefinition(
1066              FieldUris.PhoneNumber, "RadioPhone");
1067    
1068      /**
1069       * Defines the Telex property.
1070       */
1071      public static final IndexedPropertyDefinition Telex =
1072          new IndexedPropertyDefinition(
1073              FieldUris.PhoneNumber, "Telex");
1074    
1075      /**
1076       * Defines the TtyTddPhone property.
1077       */
1078      public static final IndexedPropertyDefinition TtyTddPhone =
1079          new IndexedPropertyDefinition(
1080              FieldUris.PhoneNumber, "TtyTddPhone");
1081    
1082      /**
1083       * Defines the BusinessAddressStreet property.
1084       */
1085      public static final IndexedPropertyDefinition BusinessAddressStreet =
1086          new IndexedPropertyDefinition(
1087              FieldUris.PhysicalAddressStreet, "Business");
1088    
1089      /**
1090       * Defines the BusinessAddressCity property.
1091       */
1092      public static final IndexedPropertyDefinition BusinessAddressCity =
1093          new IndexedPropertyDefinition(
1094              FieldUris.PhysicalAddressCity, "Business");
1095    
1096      /**
1097       * Defines the BusinessAddressState property.
1098       */
1099      public static final IndexedPropertyDefinition BusinessAddressState =
1100          new IndexedPropertyDefinition(
1101              FieldUris.PhysicalAddressState, "Business");
1102    
1103      /**
1104       * Defines the BusinessAddressCountryOrRegion property.
1105       */
1106      public static final IndexedPropertyDefinition
1107          BusinessAddressCountryOrRegion =
1108          new IndexedPropertyDefinition(
1109              FieldUris.PhysicalAddressCountryOrRegion, "Business");
1110    
1111      /**
1112       * Defines the BusinessAddressPostalCode property.
1113       */
1114      public static final IndexedPropertyDefinition BusinessAddressPostalCode =
1115          new IndexedPropertyDefinition(
1116              FieldUris.PhysicalAddressPostalCode, "Business");
1117    
1118      /**
1119       * Defines the HomeAddressStreet property.
1120       */
1121      public static final IndexedPropertyDefinition HomeAddressStreet =
1122          new IndexedPropertyDefinition(
1123              FieldUris.PhysicalAddressStreet, "Home");
1124    
1125      /**
1126       * Defines the HomeAddressCity property.
1127       */
1128      public static final IndexedPropertyDefinition HomeAddressCity =
1129          new IndexedPropertyDefinition(
1130              FieldUris.PhysicalAddressCity, "Home");
1131    
1132      /**
1133       * Defines the HomeAddressState property.
1134       */
1135      public static final IndexedPropertyDefinition HomeAddressState =
1136          new IndexedPropertyDefinition(
1137              FieldUris.PhysicalAddressState, "Home");
1138    
1139      /**
1140       * Defines the HomeAddressCountryOrRegion property.
1141       */
1142      public static final IndexedPropertyDefinition HomeAddressCountryOrRegion =
1143          new IndexedPropertyDefinition(
1144              FieldUris.PhysicalAddressCountryOrRegion, "Home");
1145    
1146      /**
1147       * Defines the HomeAddressPostalCode property.
1148       */
1149      public static final IndexedPropertyDefinition HomeAddressPostalCode =
1150          new IndexedPropertyDefinition(
1151              FieldUris.PhysicalAddressPostalCode, "Home");
1152    
1153      /**
1154       * Defines the OtherAddressStreet property.
1155       */
1156      public static final IndexedPropertyDefinition OtherAddressStreet =
1157          new IndexedPropertyDefinition(
1158              FieldUris.PhysicalAddressStreet, "Other");
1159    
1160      /**
1161       * Defines the OtherAddressCity property.
1162       */
1163      public static final IndexedPropertyDefinition OtherAddressCity =
1164          new IndexedPropertyDefinition(
1165              FieldUris.PhysicalAddressCity, "Other");
1166    
1167      /**
1168       * Defines the OtherAddressState property.
1169       */
1170      public static final IndexedPropertyDefinition OtherAddressState =
1171          new IndexedPropertyDefinition(
1172              FieldUris.PhysicalAddressState, "Other");
1173    
1174      /**
1175       * Defines the OtherAddressCountryOrRegion property.
1176       */
1177      public static final IndexedPropertyDefinition OtherAddressCountryOrRegion =
1178          new IndexedPropertyDefinition(
1179              FieldUris.PhysicalAddressCountryOrRegion, "Other");
1180    
1181      /**
1182       * Defines the OtherAddressPostalCode property.
1183       */
1184      public static final IndexedPropertyDefinition OtherAddressPostalCode =
1185          new IndexedPropertyDefinition(
1186              FieldUris.PhysicalAddressPostalCode, "Other");
1187    
1188      // This must be declared after the property definitions
1189      /**
1190       * The Constant Instance.
1191       */
1192      public static final ContactSchema Instance = new ContactSchema();
1193    
1194      /**
1195       * Registers property.
1196       * <p/>
1197       * IMPORTANT NOTE: PROPERTIES MUST BE REGISTERED IN SCHEMA ORDER (i.e. the
1198       * same order as they are defined in types.xsd)
1199       */
1200      @Override
1201      protected void registerProperties() {
1202        super.registerProperties();
1203    
1204        this.registerProperty(FileAs);
1205        this.registerProperty(FileAsMapping);
1206        this.registerProperty(DisplayName);
1207        this.registerProperty(GivenName);
1208        this.registerProperty(Initials);
1209        this.registerProperty(MiddleName);
1210        this.registerProperty(NickName);
1211        this.registerProperty(CompleteName);
1212        this.registerProperty(CompanyName);
1213        this.registerProperty(EmailAddresses);
1214        this.registerProperty(PhysicalAddresses);
1215        this.registerProperty(PhoneNumbers);
1216        this.registerProperty(AssistantName);
1217        this.registerProperty(Birthday);
1218        this.registerProperty(BusinessHomePage);
1219        this.registerProperty(Children);
1220        this.registerProperty(Companies);
1221        this.registerProperty(ContactSource);
1222        this.registerProperty(Department);
1223        this.registerProperty(Generation);
1224        this.registerProperty(ImAddresses);
1225        this.registerProperty(JobTitle);
1226        this.registerProperty(Manager);
1227        this.registerProperty(Mileage);
1228        this.registerProperty(OfficeLocation);
1229        this.registerProperty(PostalAddressIndex);
1230        this.registerProperty(Profession);
1231        this.registerProperty(SpouseName);
1232        this.registerProperty(Surname);
1233        this.registerProperty(WeddingAnniversary);
1234        this.registerProperty(HasPicture);
1235        this.registerProperty(PhoneticFullName);
1236        this.registerProperty(PhoneticFirstName);
1237        this.registerProperty(PhoneticLastName);
1238        this.registerProperty(Alias);
1239        this.registerProperty(Notes);
1240        this.registerProperty(Photo);
1241        this.registerProperty(UserSMIMECertificate);
1242        this.registerProperty(MSExchangeCertificate);
1243        this.registerProperty(DirectoryId);
1244        this.registerProperty(ManagerMailbox);
1245        this.registerProperty(DirectReports);
1246    
1247        this.registerIndexedProperty(EmailAddress1);
1248        this.registerIndexedProperty(EmailAddress2);
1249        this.registerIndexedProperty(EmailAddress3);
1250        this.registerIndexedProperty(ImAddress1);
1251        this.registerIndexedProperty(ImAddress2);
1252        this.registerIndexedProperty(ImAddress3);
1253        this.registerIndexedProperty(AssistantPhone);
1254        this.registerIndexedProperty(BusinessFax);
1255        this.registerIndexedProperty(BusinessPhone);
1256        this.registerIndexedProperty(BusinessPhone2);
1257        this.registerIndexedProperty(Callback);
1258        this.registerIndexedProperty(CarPhone);
1259        this.registerIndexedProperty(CompanyMainPhone);
1260        this.registerIndexedProperty(HomeFax);
1261        this.registerIndexedProperty(HomePhone);
1262        this.registerIndexedProperty(HomePhone2);
1263        this.registerIndexedProperty(Isdn);
1264        this.registerIndexedProperty(MobilePhone);
1265        this.registerIndexedProperty(OtherFax);
1266        this.registerIndexedProperty(OtherTelephone);
1267        this.registerIndexedProperty(Pager);
1268        this.registerIndexedProperty(PrimaryPhone);
1269        this.registerIndexedProperty(RadioPhone);
1270        this.registerIndexedProperty(Telex);
1271        this.registerIndexedProperty(TtyTddPhone);
1272        this.registerIndexedProperty(BusinessAddressStreet);
1273        this.registerIndexedProperty(BusinessAddressCity);
1274        this.registerIndexedProperty(BusinessAddressState);
1275        this.registerIndexedProperty(BusinessAddressCountryOrRegion);
1276        this.registerIndexedProperty(BusinessAddressPostalCode);
1277        this.registerIndexedProperty(HomeAddressStreet);
1278        this.registerIndexedProperty(HomeAddressCity);
1279        this.registerIndexedProperty(HomeAddressState);
1280        this.registerIndexedProperty(HomeAddressCountryOrRegion);
1281        this.registerIndexedProperty(HomeAddressPostalCode);
1282        this.registerIndexedProperty(OtherAddressStreet);
1283        this.registerIndexedProperty(OtherAddressCity);
1284        this.registerIndexedProperty(OtherAddressState);
1285        this.registerIndexedProperty(OtherAddressCountryOrRegion);
1286        this.registerIndexedProperty(OtherAddressPostalCode);
1287    
1288      }
1289    
1290      /**
1291       * Instantiates a new contact schema.
1292       */
1293      ContactSchema() {
1294        super();
1295      }
1296    }