protected void RunQuery(MailboxSession session, CalendarVersionStoreGateway cvsGateway, Func <PropertyBag, bool> processRecord) { if (this.TargetState.IsRecurringMasterSpecific) { cvsGateway.QueryByCleanGlobalObjectId(session, this.GlobalObjectId, this.TargetState.SchemaKey, this.TargetState.RequiredProperties, processRecord, true, ClientIntentQuery.CalendarItemClassArray, null, null); return; } cvsGateway.QueryByGlobalObjectId(session, this.GlobalObjectId, this.TargetState.SchemaKey, this.TargetState.RequiredProperties, processRecord, true, ClientIntentQuery.CalendarItemClassArray, null, null); }
private void DirectQueryByGlobalObjectId(MailboxSession session, GlobalObjectId globalObjectId, string schemaKey, StorePropertyDefinition[] propertiesToFetch, Func <PropertyBag, bool> matchFoundAction, bool fetchResultsInReverseChronologicalOrder, bool useCleanGoid, bool useCachedPropertySetIfPresent, string[] itemClassFilter, ExDateTime?startDate = null, ExDateTime?endDate = null) { if (!CalendarVersionStoreGateway.ValidateDateRanges(ref startDate, ref endDate)) { throw new ArgumentException("StartDate cannot be greater than EndDate", "startDate"); } using (SearchFolder searchFolder = this.GetSearchFolder(session)) { CalendarCorrelationMatch.QueryRelatedItems(searchFolder, globalObjectId, schemaKey, propertiesToFetch, useCachedPropertySetIfPresent, matchFoundAction, fetchResultsInReverseChronologicalOrder, !useCleanGoid, itemClassFilter, new ExDateTime?(startDate.Value), new ExDateTime?(endDate.Value)); } }
public void QueryBySubjectContains(MailboxSession session, string subject, string schemaKey, StorePropertyDefinition[] propertiesToFetch, Action <PropertyBag> matchFoundAction, ExDateTime?startDate = null, ExDateTime?endDate = null) { if (!CalendarVersionStoreGateway.ValidateDateRanges(ref startDate, ref endDate)) { throw new ArgumentException("StartDate cannot be greater than EndDate", "startDate"); } using (SearchFolder searchFolder = this.GetSearchFolder(session)) { CalendarCorrelationMatch.QuerySubjectContains(searchFolder, subject, schemaKey, propertiesToFetch, this.useCachedPropertySetIfPresent, matchFoundAction, startDate.Value, endDate.Value); } }
public override ClientIntentQuery.QueryResult Execute(MailboxSession session, CalendarVersionStoreGateway cvsGateway) { ClientIntentFlags targetVersionClientIntent = ClientIntentFlags.None; bool foundShiftToTargetState = false; bool foundVersionInTargetState = false; VersionedId sourceVersionId = null; base.RunQuery(session, cvsGateway, delegate(PropertyBag propertyBag) { CalendarItemState state = new CalendarItemState(); if (this.TargetState.Evaluate(state, propertyBag, session)) { foundVersionInTargetState = true; targetVersionClientIntent = this.GetClientIntentFromPropertyBag(propertyBag); } else if (foundVersionInTargetState) { foundShiftToTargetState = true; sourceVersionId = this.GetIdFromPropertyBag(propertyBag); } return(!foundShiftToTargetState); }); return(new ClientIntentQuery.QueryResult(foundShiftToTargetState ? new ClientIntentFlags?(targetVersionClientIntent) : null, sourceVersionId)); }
public abstract ClientIntentQuery.QueryResult Execute(MailboxSession session, CalendarVersionStoreGateway cvsGateway);
public override ClientIntentQuery.QueryResult Execute(MailboxSession session, CalendarVersionStoreGateway cvsGateway) { bool isChainComplete = false; CalendarItemState previousState = null; bool foundVersionInTargetState = false; VersionedId sourceVersionId = null; ClientIntentFlags accumulatedFlags = ClientIntentFlags.None; ClientIntentFlags intentToAccumulate = ClientIntentFlags.None; base.RunQuery(session, cvsGateway, delegate(PropertyBag propertyBag) { CalendarItemState calendarItemState = new CalendarItemState(); if (!foundVersionInTargetState) { if (this.TargetState.Evaluate(calendarItemState, propertyBag, session)) { foundVersionInTargetState = true; intentToAccumulate = this.GetClientIntentFromPropertyBag(propertyBag); accumulatedFlags = intentToAccumulate; } } else if (this.InitialState.Evaluate(calendarItemState, propertyBag, session)) { isChainComplete = true; accumulatedFlags &= intentToAccumulate; sourceVersionId = this.GetIdFromPropertyBag(propertyBag); } else if (this.TargetState.Evaluate(calendarItemState, propertyBag, session)) { intentToAccumulate = this.GetClientIntentFromPropertyBag(propertyBag); accumulatedFlags = intentToAccumulate; } else if (this.TargetState.Equals(calendarItemState, previousState)) { intentToAccumulate = this.GetClientIntentFromPropertyBag(propertyBag); } else { accumulatedFlags &= intentToAccumulate; intentToAccumulate = this.GetClientIntentFromPropertyBag(propertyBag); } previousState = calendarItemState; return(!isChainComplete); }); return(new ClientIntentQuery.QueryResult(isChainComplete ? new ClientIntentFlags?(accumulatedFlags) : null, sourceVersionId)); }