private bool ShouldSendRum(CalendarValidationContext context, Inconsistency inconsistency) { if (context.BaseRole == RoleType.Attendee && CalendarItemBase.IsTenantToBeFixed(context.BaseItem.Session as MailboxSession)) { return(false); } if (inconsistency.Owner == context.BaseRole) { return(false); } if (!this.Policy.ContainsRepairFlag(inconsistency.Flag)) { return(false); } if (context.AttendeeItem != null && context.OrganizerItem != null && context.AttendeeItem.CalendarItemType == CalendarItemType.Occurrence && context.OrganizerItem.CalendarItemType == CalendarItemType.Occurrence) { return(false); } if (context.RemoteUser.ExchangePrincipal == null) { return(false); } if (this.CheckServerVersion(context, inconsistency)) { CalendarProcessingFlags?calendarConfig = context.CalendarInstance.GetCalendarConfig(); return(calendarConfig != null && (inconsistency.Flag != CalendarInconsistencyFlag.MissingItem || !context.HasSentUpdateForItemOrMaster) && calendarConfig.Value == CalendarProcessingFlags.AutoUpdate); } return(false); }
private Inconsistency GetAttendeeMissingItemInconsistency(CalendarValidationContext context, string fullDescription, ClientIntentFlags?inconsistencyIntent, ClientIntentFlags declineIntent, ClientIntentFlags deleteIntent) { Inconsistency inconsistency = null; if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent, new ClientIntentFlags[] { declineIntent })) { inconsistency = ResponseInconsistency.CreateInstance(fullDescription, ResponseType.Decline, context.Attendee.ResponseType, ExDateTime.MinValue, context.Attendee.ReplyTime, context); inconsistency.Intent = inconsistencyIntent; } else if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent, new ClientIntentFlags[] { deleteIntent })) { inconsistency = null; } else if (this.calendarIntent != null && this.calendarIntent.ItemVersion > 0) { inconsistency = MissingItemInconsistency.CreateAttendeeMissingItemInstance(fullDescription, inconsistencyIntent, new int?(this.calendarIntent.ItemVersion), context); inconsistency.Intent = inconsistencyIntent; } return(inconsistency); }
internal virtual RumInfo CreateRumInfo(CalendarValidationContext context, IList <Attendee> attendees) { switch (this.Flag) { case CalendarInconsistencyFlag.None: case CalendarInconsistencyFlag.StoreObjectValidation: case CalendarInconsistencyFlag.StorageException: case CalendarInconsistencyFlag.UserNotFound: case CalendarInconsistencyFlag.LegacyUser: case CalendarInconsistencyFlag.LargeDL: case CalendarInconsistencyFlag.RecurrenceAnomaly: case CalendarInconsistencyFlag.RecurringException: case CalendarInconsistencyFlag.ModifiedOccurrenceMatch: case CalendarInconsistencyFlag.DuplicatedItem: case CalendarInconsistencyFlag.MissingCvs: return(NullOpRumInfo.CreateInstance()); case CalendarInconsistencyFlag.VersionInfo: case CalendarInconsistencyFlag.TimeOverlap: case CalendarInconsistencyFlag.StartTime: case CalendarInconsistencyFlag.EndTime: case CalendarInconsistencyFlag.StartTimeZone: case CalendarInconsistencyFlag.RecurringTimeZone: case CalendarInconsistencyFlag.Location: case CalendarInconsistencyFlag.RecurrenceBlob: case CalendarInconsistencyFlag.MissingOccurrenceDeletion: return(UpdateRumInfo.CreateMasterInstance(attendees, this.Flag)); } throw new NotImplementedException(string.Format("Unrecognized inconsistency: {0}", this.Flag)); }
internal override Inconsistency GetInconsistency(CalendarValidationContext context, string fullDescription) { if (base.LoadInconsistency != null) { return(base.LoadInconsistency); } if (this.CalendarFolderId == null) { return(null); } bool isCleanGlobalObjectId = context.BaseItem.GlobalObjectId.IsCleanGlobalObjectId; Inconsistency inconsistency; if (context.OppositeRole == RoleType.Attendee) { ClientIntentQuery.QueryResult missingItemIntent = this.GetMissingItemIntent(context, isCleanGlobalObjectId); inconsistency = (isCleanGlobalObjectId ? this.GetAttendeeMissingItemInconsistency(context, fullDescription, missingItemIntent, ClientIntentFlags.RespondedDecline, ClientIntentFlags.DeletedWithNoResponse) : this.GetAttendeeMissingItemInconsistency(context, fullDescription, missingItemIntent, ClientIntentFlags.RespondedExceptionDecline, ClientIntentFlags.DeletedExceptionWithNoResponse)); } else { inconsistency = MissingItemInconsistency.CreateOrganizerMissingItemInstance(fullDescription, context); if (RumFactory.Instance.Policy.RepairMode == CalendarRepairType.ValidateOnly) { inconsistency.Intent = this.GetMissingItemIntent(context, isCleanGlobalObjectId).Intent; } } return(inconsistency); }
private Inconsistency GetAttendeeMissingItemInconsistency(CalendarValidationContext context, string fullDescription, ClientIntentQuery.QueryResult inconsistencyIntent, ClientIntentFlags declineIntent, ClientIntentFlags deleteIntent) { Inconsistency inconsistency = null; if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent.Intent, new ClientIntentFlags[] { declineIntent })) { inconsistency = ResponseInconsistency.CreateInstance(fullDescription, ResponseType.Decline, context.Attendee.ResponseType, ExDateTime.MinValue, context.Attendee.ReplyTime, context); inconsistency.Intent = inconsistencyIntent.Intent; } else if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent.Intent, new ClientIntentFlags[] { deleteIntent })) { inconsistency = null; } else if (inconsistencyIntent.SourceVersionId != null) { int?deletedItemVersion = null; using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(this.session, inconsistencyIntent.SourceVersionId)) { deletedItemVersion = calendarItemBase.GetValueAsNullable <int>(CalendarItemBaseSchema.ItemVersion); } if (deletedItemVersion != null) { inconsistency = MissingItemInconsistency.CreateAttendeeMissingItemInstance(fullDescription, inconsistencyIntent.Intent, deletedItemVersion, context); inconsistency.Intent = inconsistencyIntent.Intent; } } return(inconsistency); }
internal RumInfo CreateRumInfo(CalendarValidationContext context, Inconsistency inconsistency) { this.CheckInitialized(); if (context == null) { throw new ArgumentNullException("context"); } if (inconsistency == null) { throw new ArgumentNullException("inconsistency"); } if (this.ShouldSendRum(context, inconsistency)) { IList <Attendee> list = new List <Attendee>(1); if (context.BaseRole == RoleType.Organizer && context.Attendee != null) { if (context.Attendee.Attendee == null) { context.Attendee.Attendee = context.OrganizerItem.AttendeeCollection.Add(context.Attendee.Participant, AttendeeType.Required, null, null, false); } list.Add(context.Attendee.Attendee); } RumInfo rumInfo = inconsistency.CreateRumInfo(context, list); if (!rumInfo.IsNullOp && rumInfo is OrganizerRumInfo && context.AttendeeItem != null) { ((OrganizerRumInfo)rumInfo).AttendeeRequiredSequenceNumber = context.AttendeeItem.AppointmentSequenceNumber; } return(rumInfo); } return(NullOpRumInfo.CreateInstance()); }
private ClientIntentFlags?GetMissingItemIntent(CalendarValidationContext context, bool isNotOccurrence) { GetClientIntentType getClientIntentType = new GetClientIntentType(); getClientIntentType.GlobalObjectId = Convert.ToBase64String(context.BaseItem.GlobalObjectId.Bytes); if (isNotOccurrence) { getClientIntentType.StateDefinition = new NonEmptyStateDefinitionType { Item = new DeleteFromFolderStateDefinitionType() }; } else { getClientIntentType.StateDefinition = new NonEmptyStateDefinitionType { Item = new DeletedOccurrenceStateDefinitionType { OccurrenceDate = context.BaseItem.GlobalObjectId.Date.UniversalTime, IsOccurrencePresent = false } }; } GetClientIntentResponseMessageType clientIntent = this.binding.GetClientIntent(getClientIntentType); this.calendarIntent = this.HandleGetClientIntentResponse(clientIntent); if (this.calendarIntent == null) { Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "GetClientIntent returned NULL."); return(null); } return(new ClientIntentFlags?((ClientIntentFlags)this.calendarIntent.Intent)); }
internal static CalendarValidationContext CreateInstance(CalendarItemBase calendarItem, bool isOrganizer, UserObject localUser, UserObject remoteUser, CalendarVersionStoreGateway cvsGateway, AttendeeExtractor attendeeExtractor) { CalendarValidationContext calendarValidationContext = new CalendarValidationContext(); calendarValidationContext.LocalUser = localUser; calendarValidationContext.RemoteUser = remoteUser; if (isOrganizer) { calendarValidationContext.BaseRole = RoleType.Organizer; calendarValidationContext.OppositeRole = RoleType.Attendee; calendarValidationContext.Organizer = localUser; calendarValidationContext.Attendee = remoteUser; } else { calendarValidationContext.BaseRole = RoleType.Attendee; calendarValidationContext.OppositeRole = RoleType.Organizer; calendarValidationContext.Organizer = remoteUser; calendarValidationContext.Attendee = localUser; } calendarValidationContext.calendarItems = new Dictionary <RoleType, CalendarItemBase>(2); calendarValidationContext.calendarItems.Add(calendarValidationContext.BaseRole, calendarItem); calendarValidationContext.calendarItems.Add(calendarValidationContext.OppositeRole, null); calendarValidationContext.OrganizerRecurrence = null; calendarValidationContext.OrganizerExceptions = null; calendarValidationContext.OrganizerDeletions = null; calendarValidationContext.AttendeeRecurrence = null; calendarValidationContext.AttendeeExceptions = null; calendarValidationContext.AttendeeDeletions = null; calendarValidationContext.OppositeRoleOrganizerIsValid = false; calendarValidationContext.CvsGateway = cvsGateway; calendarValidationContext.AttendeeExtractor = attendeeExtractor; return(calendarValidationContext); }
public void Dispose() { if (this.ValidationContext != null) { this.ValidationContext.Dispose(); this.ValidationContext = null; } }
internal PrimaryConsistencyCheckChain CreatePrimaryConsistencyCheckChain(CalendarValidationContext context, MeetingComparisonResult comparisonResult) { PrimaryConsistencyCheckChain primaryConsistencyCheckChain = new PrimaryConsistencyCheckChain(2, comparisonResult); primaryConsistencyCheckChain.AddCheck(new CanValidateOwnerCheck(context)); primaryConsistencyCheckChain.AddCheck(new ValidateStoreObjectCheck(context)); return(primaryConsistencyCheckChain); }
internal override ClientIntentFlags?GetLocationIntent(CalendarValidationContext context, GlobalObjectId globalObjectId, string organizerLocation, string attendeeLocation) { ICalendarItemStateDefinition initialState = new LocationBasedCalendarItemStateDefinition(organizerLocation); ICalendarItemStateDefinition targetState = new LocationBasedCalendarItemStateDefinition(attendeeLocation); ClientIntentQuery clientIntentQuery = new TransitionalClientIntentQuery(globalObjectId, initialState, targetState); return(clientIntentQuery.Execute(this.session, context.CvsGateway).Intent); }
internal void PerformChecks(CalendarValidationContext context) { base.PerformChecks(); if (!this.ShouldTerminate) { MeetingExistenceCheck check = new MeetingExistenceCheck(context); base.PerformCheck <MeetingExistenceConsistencyCheckResult>(check); } }
internal MeetingCancellationCheck(CalendarValidationContext context) { IEnumerable <ConsistencyCheckType> dependsOnCheckPassList = null; if (context.BaseRole == RoleType.Attendee && context.AttendeeItem.IsCancelled) { dependsOnCheckPassList = MeetingCancellationCheck.cancelledAttendeeDependsOnCheckPassList; } this.Initialize(ConsistencyCheckType.MeetingCancellationCheck, "Checkes to make sure that the meeting cancellations statuses match.", SeverityType.Error, context, dependsOnCheckPassList); }
internal override RumInfo CreateRumInfo(CalendarValidationContext context, IList <Attendee> attendees) { CalendarInconsistencyFlag flag = base.Flag; if (flag == CalendarInconsistencyFlag.ExtraOccurrenceDeletion) { return(MissingAttendeeItemRumInfo.CreateOccurrenceInstance(this.OriginalStartDate, attendees, base.Flag)); } return(base.CreateRumInfo(context, attendees)); }
internal override bool WouldTryToRepairIfMissing(CalendarValidationContext context, out MeetingInquiryAction predictedAction) { predictedAction = MeetingInquiryAction.DeletedVersionNotFound; if (this.calendarIntent != null) { predictedAction = this.calendarConverter.ConvertToMeetingInquiryAction(this.calendarIntent.PredictedAction); return(this.calendarIntent.WouldRepair); } return(false); }
internal void AddInconsistency(CalendarValidationContext context, Inconsistency inconsistency) { this.Inconsistencies.Add(inconsistency); RumInfo rumInfo = RumFactory.Instance.CreateRumInfo(context, inconsistency); if (!rumInfo.IsNullOp) { inconsistency.ShouldFix = true; this.RepairInfo.AddStep(rumInfo); } }
internal CalendarInstanceContext(MeetingValidationResult validationResult, CalendarValidationContext validationContext) { if (validationResult == null) { throw new ArgumentNullException("validationResult"); } if (validationContext == null) { throw new ArgumentNullException("validationContext"); } this.ValidationResult = validationResult; this.ValidationContext = validationContext; }
private bool CheckServerVersion(CalendarValidationContext context, Inconsistency inconsistency) { ServerVersion serverVersion = new ServerVersion(context.RemoteUser.ExchangePrincipal.MailboxInfo.Location.ServerVersion); if (serverVersion.Major <= 8) { return(false); } if (inconsistency.Flag == CalendarInconsistencyFlag.OrphanedMeeting) { return(ServerVersion.Compare(serverVersion, this.supportsMeetingInquiryAfter) > 0); } return(ServerVersion.Compare(serverVersion, this.supportsRumsAfter) > 0); }
internal CanValidateOwnerCheck(CalendarValidationContext context) { SeverityType severity = SeverityType.FatalError; if (context.BaseItem == null || context.BaseItem.IsCancelled) { severity = SeverityType.Information; } else if (context.BaseRole == RoleType.Organizer && (context.Attendee.ResponseType == ResponseType.NotResponded || context.Attendee.ResponseType == ResponseType.None)) { severity = SeverityType.Warning; } this.Initialize(ConsistencyCheckType.CanValidateOwnerCheck, "Checks whether the counterpart user can be validated or not.", severity, context, null); }
private ClientIntentQuery.QueryResult GetMissingItemIntent(CalendarValidationContext context, bool isNotOccurrence) { ClientIntentQuery clientIntentQuery; if (isNotOccurrence) { ICalendarItemStateDefinition deletedFromFolderStateDefinition = CompositeCalendarItemStateDefinition.GetDeletedFromFolderStateDefinition(this.CalendarFolderId); clientIntentQuery = new ItemDeletionClientIntentQuery(context.BaseItem.GlobalObjectId, deletedFromFolderStateDefinition); } else { ICalendarItemStateDefinition targetState = new DeletedOccurrenceCalendarItemStateDefinition(context.BaseItem.GlobalObjectId.Date, false); clientIntentQuery = new NonTransitionalClientIntentQuery(context.BaseItem.GlobalObjectId, targetState); } return(clientIntentQuery.Execute(this.session, context.CvsGateway)); }
internal override RumInfo CreateRumInfo(CalendarValidationContext context, IList <Attendee> attendees) { if (this.AttendeeReplyTime.Equals(ExDateTime.MinValue)) { return(NullOpRumInfo.CreateInstance()); } switch (this.ExpectedResponse) { default: return(NullOpRumInfo.CreateInstance()); case ResponseType.Tentative: case ResponseType.Accept: case ResponseType.Decline: return(ResponseRumInfo.CreateMasterInstance()); } }
internal override RumInfo CreateRumInfo(CalendarValidationContext context, IList <Attendee> attendees) { CalendarInconsistencyFlag flag = base.Flag; if (flag != CalendarInconsistencyFlag.OrphanedMeeting) { return(MissingAttendeeItemRumInfo.CreateMasterInstance(attendees, base.Flag, this.DeletedItemVersion)); } if (context.OppositeRole == RoleType.Organizer && !context.OppositeRoleOrganizerIsValid) { return(NullOpRumInfo.CreateInstance()); } MeetingInquiryAction predictedRepairAction; bool wouldRepair = context.CalendarInstance.WouldTryToRepairIfMissing(context, out predictedRepairAction); return(AttendeeInquiryRumInfo.CreateMasterInstance(wouldRepair, predictedRepairAction)); }
internal override RumInfo CreateRumInfo(CalendarValidationContext context, IList <Attendee> attendees) { CalendarInconsistencyFlag flag = base.Flag; if (flag != CalendarInconsistencyFlag.Cancellation) { return(base.CreateRumInfo(context, attendees)); } bool flag2; if (!bool.TryParse(this.ExpectedValue, out flag2)) { throw new ArgumentException("Expected value for cancellation inconsistency should be Boolean.", "inconsistency.ExpectedValue"); } if (flag2) { return(CancellationRumInfo.CreateMasterInstance(attendees)); } return(UpdateRumInfo.CreateMasterInstance(attendees, base.Flag)); }
internal override ClientIntentFlags?GetLocationIntent(CalendarValidationContext context, GlobalObjectId globalObjectId, string organizerLocation, string attendeeLocation) { GetClientIntentType getClientIntentType = new GetClientIntentType(); getClientIntentType.GlobalObjectId = Convert.ToBase64String(globalObjectId.Bytes); getClientIntentType.StateDefinition = new NonEmptyStateDefinitionType { Item = new LocationBasedStateDefinitionType { OrganizerLocation = organizerLocation, AttendeeLocation = attendeeLocation } }; GetClientIntentResponseMessageType clientIntent = this.binding.GetClientIntent(getClientIntentType); this.calendarIntent = this.HandleGetClientIntentResponse(clientIntent); if (this.calendarIntent == null) { Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "GetClientIntent returned NULL."); return(null); } return(new ClientIntentFlags?((ClientIntentFlags)this.calendarIntent.Intent)); }
private RecurrenceInconsistency(RoleType owner, string description, CalendarInconsistencyFlag flag, RecurrenceInconsistencyType recurrenceInconsistencyType, ExDateTime origstartDate, CalendarValidationContext context) : base(owner, description, flag, context) { this.InconsistencyType = recurrenceInconsistencyType; this.OriginalStartDate = origstartDate; }
protected virtual void Initialize(ConsistencyCheckType type, string description, SeverityType severity, CalendarValidationContext context, IEnumerable <ConsistencyCheckType> dependsOnCheckPassList) { this.Type = type; this.Description = description; this.Severity = severity; this.Context = context; this.dependsOnCheckPassList = dependsOnCheckPassList; }
internal override Inconsistency GetInconsistency(CalendarValidationContext context, string fullDescription) { Inconsistency inconsistency = null; if (base.LoadInconsistency != null) { return(base.LoadInconsistency); } bool isCleanGlobalObjectId = context.BaseItem.GlobalObjectId.IsCleanGlobalObjectId; try { ClientIntentFlags?missingItemIntent = this.GetMissingItemIntent(context, isCleanGlobalObjectId); if (context.OppositeRole == RoleType.Attendee) { inconsistency = (isCleanGlobalObjectId ? this.GetAttendeeMissingItemInconsistency(context, fullDescription, missingItemIntent, ClientIntentFlags.RespondedDecline, ClientIntentFlags.DeletedWithNoResponse) : this.GetAttendeeMissingItemInconsistency(context, fullDescription, missingItemIntent, ClientIntentFlags.RespondedExceptionDecline, ClientIntentFlags.DeletedExceptionWithNoResponse)); } else { inconsistency = MissingItemInconsistency.CreateOrganizerMissingItemInstance(fullDescription, context); if (RumFactory.Instance.Policy.RepairMode == CalendarRepairType.ValidateOnly) { inconsistency.Intent = missingItemIntent; } } } catch (ProtocolViolationException exception) { this.HandleRemoteException(exception); } catch (SecurityException exception2) { this.HandleRemoteException(exception2); } catch (ArgumentException exception3) { this.HandleRemoteException(exception3); } catch (InvalidOperationException exception4) { this.HandleRemoteException(exception4); } catch (NotSupportedException exception5) { this.HandleRemoteException(exception5); } catch (XmlException exception6) { this.HandleRemoteException(exception6); } catch (XPathException exception7) { this.HandleRemoteException(exception7); } catch (SoapException exception8) { this.HandleRemoteException(exception8); } catch (IOException exception9) { this.HandleRemoteException(exception9); } return(inconsistency); }
internal CorrectResponseCheck(CalendarValidationContext context) { SeverityType severity = context.AreItemsOccurrences ? SeverityType.Warning : SeverityType.Error; this.Initialize(ConsistencyCheckType.CorrectResponseCheck, "Checkes to make sure that the organizaer has the correct response recorded for the attendee.", severity, context, (context.BaseRole == RoleType.Attendee) ? CorrectResponseCheck.attendeeDependsOnCheckPassList : null); }
internal RecurrenceBlobsConsistentCheck(CalendarValidationContext context) { this.Initialize(ConsistencyCheckType.RecurrenceBlobsConsistentCheck, "Checks to make sure that the recurrence blobs are internally consistent.", SeverityType.Error, context, null); }
internal static RecurrenceInconsistency CreateInstance(RoleType owner, string description, CalendarInconsistencyFlag flag, RecurrenceInconsistencyType recurrenceInconsistencyType, ExDateTime origstartDate, CalendarValidationContext context) { return(new RecurrenceInconsistency(owner, description, flag, recurrenceInconsistencyType, origstartDate, context)); }