public PersonSchemaProperties(PropertyDefinition[] extendedProperties, params IEnumerable <PropertyDefinition>[] otherPropertySets)
 {
     if (extendedProperties != null)
     {
         StorePropertyDefinition[] array = new StorePropertyDefinition[extendedProperties.Length];
         for (int i = 0; i < extendedProperties.Length; i++)
         {
             array[i] = (StorePropertyDefinition)extendedProperties[i];
         }
         ApplicationAggregatedProperty item    = new ApplicationAggregatedProperty(PersonSchema.ExtendedProperties, PersonPropertyAggregationStrategy.CreateExtendedPropertiesAggregation(array));
         HashSet <PropertyDefinition>  hashSet = new HashSet <PropertyDefinition>();
         hashSet.Add(item);
         if (otherPropertySets != null)
         {
             foreach (ICollection <PropertyDefinition> collection in otherPropertySets)
             {
                 if (collection != null)
                 {
                     foreach (PropertyDefinition propertyDefinition in collection)
                     {
                         if (!object.Equals(propertyDefinition, PersonSchema.ExtendedProperties))
                         {
                             hashSet.Add(propertyDefinition);
                         }
                     }
                 }
             }
         }
         this.All = new PropertyDefinition[hashSet.Count];
         hashSet.CopyTo(this.All);
         return;
     }
     this.All = PropertyDefinitionCollection.Merge <PropertyDefinition>(otherPropertySets);
 }
 public RecursiveContactsEnumerator(IMailboxSession session, IXSOFactory xsoFactory, DefaultFolderType folderType, params PropertyDefinition[] properties)
 {
     Util.ThrowOnNullArgument(session, "session");
     Util.ThrowOnNullArgument(properties, "properties");
     this.session    = session;
     this.xsoFactory = xsoFactory;
     this.folderType = folderType;
     this.properties = PropertyDefinitionCollection.Merge <PropertyDefinition>(RecursiveContactsEnumerator.RequiredProperties, properties);
 }
Exemplo n.º 3
0
 public IEnumerator <IStorePropertyBag> GetEnumerator()
 {
     PropertyDefinition[] additionalProperties = new PropertyDefinition[]
     {
         this.property
     };
     PropertyDefinition[] allProperties   = PropertyDefinitionCollection.Merge <PropertyDefinition>(additionalProperties, this.requestedProperties);
     SortBy[]             ascendingSortBy = new SortBy[]
     {
         new SortBy(this.property, SortOrder.Ascending)
     };
     using (IQueryResult queryResult = this.folder.IItemQuery(ItemQueryType.None, null, ascendingSortBy, allProperties))
     {
         foreach (string propertyValue in this.propertyValues)
         {
             ContactsByPropertyValueEnumerator.Tracer.TraceDebug <string, PropertyDefinition>((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: Finding matches for {0} in property {1}.", propertyValue, this.property);
             QueryFilter filter = new TextFilter(this.property, propertyValue, MatchOptions.FullString, MatchFlags.IgnoreCase);
             if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, filter, SeekToConditionFlags.AllowExtendedFilters))
             {
                 ContactsByPropertyValueEnumerator.Tracer.TraceDebug <string>((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: no matching contacts found.", propertyValue);
             }
             else
             {
                 bool more = true;
                 while (more)
                 {
                     IStorePropertyBag[] contacts = queryResult.GetPropertyBags(10);
                     if (contacts == null || contacts.Length == 0)
                     {
                         ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: no more rows to fecth.");
                         break;
                     }
                     foreach (IStorePropertyBag contact in contacts)
                     {
                         string retrievedPropertyValue = contact.GetValueOrDefault <string>(this.property, null);
                         if (string.IsNullOrEmpty(retrievedPropertyValue))
                         {
                             ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: stop looking for matches, found a null/empty property value.");
                             more = false;
                             break;
                         }
                         if (!StringComparer.OrdinalIgnoreCase.Equals(retrievedPropertyValue, propertyValue))
                         {
                             ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: stop looking for matches, found a mismatch.");
                             more = false;
                             break;
                         }
                         ContactsByPropertyValueEnumerator.Tracer.TraceDebug((long)this.GetHashCode(), "ContactsByPropertyValueEnumerator: Found a match, returning the contact.");
                         yield return(contact);
                     }
                 }
             }
         }
     }
     yield break;
 }
Exemplo n.º 4
0
 internal FacebookContactsUploader(IContactsUploaderPerformanceTracker performanceTracker, IFacebookClient client, IPeopleConnectApplicationConfig configuration, Func <PropertyDefinition[], IEnumerable <IStorePropertyBag> > contactsEnumeratorBuilder)
 {
     ArgumentValidator.ThrowIfNull("performanceTracker", performanceTracker);
     ArgumentValidator.ThrowIfNull("client", client);
     ArgumentValidator.ThrowIfNull("configuration", configuration);
     ArgumentValidator.ThrowIfNull("contactsEnumerator", contactsEnumeratorBuilder);
     this.performanceTracker = performanceTracker;
     this.client             = client;
     this.configuration      = configuration;
     PropertyDefinition[] arg = PropertyDefinitionCollection.Merge <PropertyDefinition>(FacebookContactsUploader.ContactPropertiesToExport, FacebookContactsUploader.AdditionalContactPropertiesToLoad);
     this.contactsEnumerator = contactsEnumeratorBuilder(arg);
 }
Exemplo n.º 5
0
 public AllContactsCursor(MailboxSession session, PropertyDefinition[] properties, SortBy[] sortByProperties)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         Util.ThrowOnNullArgument(session, "session");
         Util.ThrowOnNullArgument(properties, "properties");
         StorageGlobals.TraceConstructIDisposable(this);
         this.disposeTracker   = this.GetDisposeTracker();
         this.session          = session;
         this.properties       = PropertyDefinitionCollection.Merge <PropertyDefinition>(AllContactsCursor.requiredProperties, properties);
         this.sortByProperties = sortByProperties;
         this.PrepareQuery();
         disposeGuard.Success();
     }
 }
        public IEnumerator <IStorePropertyBag> GetEnumerator()
        {
            ContactsByGALLinkIdEnumerator.Tracer.TraceDebug <Guid>((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: this.galLinkId = {0}", this.galLinkId);
            ComparisonFilter filter = new ComparisonFilter(ComparisonOperator.Equal, InternalSchema.GALLinkID, this.galLinkId);

            PropertyDefinition[] allProperties = PropertyDefinitionCollection.Merge <PropertyDefinition>(new IEnumerable <PropertyDefinition>[]
            {
                ContactsByGALLinkIdEnumerator.RequiredProperties,
                this.requestedProperties
            });
            Folder      folder      = Folder.Bind(this.session, this.defaultFolderType, Array <PropertyDefinition> .Empty);
            QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, null, ContactsByGALLinkIdEnumerator.SortByGalLinkId, allProperties);

            if (!queryResult.SeekToCondition(SeekReference.OriginBeginning, filter))
            {
                ContactsByGALLinkIdEnumerator.Tracer.TraceDebug <Guid>((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: SeekToCondition = false.  No contacts with GALLinkID={0}.", this.galLinkId);
                yield break;
            }
            for (;;)
            {
                ContactsByGALLinkIdEnumerator.Tracer.TraceDebug <int>((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: querying for {0} more property bags", 100);
                IStorePropertyBag[] contacts = queryResult.GetPropertyBags(100);
                if (contacts == null || contacts.Length == 0)
                {
                    break;
                }
                foreach (IStorePropertyBag contact in contacts)
                {
                    Guid contactGalLinkId = contact.GetValueOrDefault <Guid>(InternalSchema.GALLinkID, Guid.Empty);
                    if (contactGalLinkId != this.galLinkId)
                    {
                        goto Block_3;
                    }
                    ContactsByGALLinkIdEnumerator.Tracer.TraceDebug((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: found property bag");
                    yield return(contact);
                }
            }
            ContactsByGALLinkIdEnumerator.Tracer.TraceDebug((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: no more property bags");
            yield break;
Block_3:
            ContactsByGALLinkIdEnumerator.Tracer.TraceDebug((long)this.galLinkId.GetHashCode(), "ContactsByGALLinkIdEnumerator.GetEnumerator: no more property bags");
            yield break;
            yield break;
        }
        private IEnumerable <IPropertyBag> QueryAssociationFolder(string context, QueryFilter filter, int?maxItems, params PropertyDefinition[] properties)
        {
            if (maxItems != null)
            {
                ArgumentValidator.ThrowIfZeroOrNegative("maxItems", maxItems.Value);
            }
            IFolder folder = this.mailboxAssociationFolder.Value;

            properties = PropertyDefinitionCollection.Merge <PropertyDefinition>(properties, new PropertyDefinition[]
            {
                ItemSchema.Id
            });
            using (IQueryResult queryResult = folder.IItemQuery(ItemQueryType.None, filter, null, properties))
            {
                int  itemsNumber   = 0;
                bool fetchAllItems = maxItems == null;
                while (fetchAllItems || itemsNumber < maxItems.Value)
                {
                    LocalAssociationStore.Tracer.TraceDebug <Guid>((long)this.GetHashCode(), "LocalAssociationStore.QueryAssociationFolder: Retrieving mailbox associations in mailbox {0}.", this.session.MailboxGuid);
                    int fetchRowCount         = fetchAllItems ? 100 : Math.Min(maxItems.Value - itemsNumber, 100);
                    IStorePropertyBag[] items = queryResult.GetPropertyBags(fetchRowCount);
                    if (items == null || items.Length == 0)
                    {
                        LocalAssociationStore.Tracer.TraceDebug((long)this.GetHashCode(), "LocalAssociationStore.QueryAssociationFolder: No more property bags found.");
                        yield break;
                    }
                    foreach (IStorePropertyBag item in items)
                    {
                        LocalAssociationStore.Tracer.TraceDebug((long)this.GetHashCode(), "LocalAssociationStore.QueryAssociationFolder: Returning property bag with Id {0}.", new object[]
                        {
                            item[ItemSchema.Id]
                        });
                        this.performanceTracker.IncrementAssociationsRead();
                        if (this.ValidateItem(context, item))
                        {
                            yield return(item);
                        }
                    }
                    itemsNumber += items.Length;
                }
            }
            yield break;
        }
Exemplo n.º 8
0
 internal ConversationMembersQueryResult(MapiTable mapiTable, ICollection <PropertyDefinition> propertyDefinitions, IList <PropTag> alteredProperties, StoreSession session, bool isTableOwned, SortOrder sortOrder, AggregationExtension aggregationExtension) : base(mapiTable, PropertyDefinitionCollection.Merge <PropertyDefinition>(propertyDefinitions, ConversationMembersQueryResult.RequiredProperties), alteredProperties, session, isTableOwned, sortOrder)
 {
     this.originalProperties   = propertyDefinitions;
     this.aggregationExtension = aggregationExtension;
 }
 public override StorePropertyDefinition[] RequiredProperties()
 {
     return(PropertyDefinitionCollection.Merge <StorePropertyDefinition>(base.RequiredProperties(), ContactSelectionStrategy.PhotoContactIdSelection.RequiredPropertiesArray));
 }
Exemplo n.º 10
0
 protected SelectionStrategy(params StorePropertyDefinition[] dependencies)
 {
     this.dependencies = PropertyDefinitionCollection.Merge <StorePropertyDefinition>(dependencies, this.RequiredProperties());
 }
Exemplo n.º 11
0
 protected SingleSourcePropertySelection(StorePropertyDefinition sourceProperty, params StorePropertyDefinition[] additionalDependencies) : base(PropertyDefinitionCollection.Merge <StorePropertyDefinition>(additionalDependencies, new StorePropertyDefinition[]
 {
     sourceProperty
 }))
 {
     this.sourceProperty = sourceProperty;
 }