示例#1
0
        private void raiseBranchParentNotFoundConflictForBranch(ChangeGroup group, Change conflictChange)
        {
            MigrationConflict      branchParentNotFoundConflict = VCBranchParentNotFoundConflictType.CreateConflict(conflictChange.Path);
            List <MigrationAction> retActions;

            ConflictResolutionResult resolutionResult = m_provider.ConflictManager.TryResolveNewConflict(group.SourceId, branchParentNotFoundConflict, out retActions);

            if ((resolutionResult.Resolved) && (resolutionResult.ResolutionType == ConflictResolutionType.UpdatedConflictedChangeAction))
            {
                InitializeDeleteLookupTables(CurrentChangeset);
                if (conflictChange.ItemType == WellKnownContentType.VersionControlledFolder)
                {
                    resolveParentNotFoundConflictForFolder(group, conflictChange);
                }
                else if (conflictChange.ItemType == WellKnownContentType.VersionControlledFile)
                {
                    resolveParentNotFoundConflictForFile(group, conflictChange);
                }
                else
                {
                    var message = string.Format(SubversionVCAdapterResource.ChangeTypeNotFoundExceptionMessage, conflictChange.ItemType);
                    Debug.Fail(message);
                    throw new NotSupportedException(message);
                }
            }
            else
            {
                throw new MigrationUnresolvedConflictException(branchParentNotFoundConflict);
            }
        }
        private ConflictResolutionResult DropValueSetting(
            MigrationConflict conflict,
            ConflictResolutionRule rule,
            out List <MigrationAction> actions)
        {
            actions = null;
            ConflictResolutionResult result = new ConflictResolutionResult(false, ConflictResolutionType.Other);

            // deserialize conflict details
            var conflictDetails = ((ClearQuestSetFieldValueConflictType)conflict.ConflictType).GetConflictDetails(conflict);

            // extract the field name specified in the rule
            string dropFieldName = rule.DataFieldDictionary[ClearQuestConflictResolutionDropValueSetting.DATAKEY_DROP_FIELD];

            if (!CQStringComparer.FieldName.Equals(conflictDetails.FieldName, dropFieldName))
            {
                // field name of the rule does not match that in the conflict
                return(result);
            }

            // look up the field in the update document
            XmlNode column = UtilityMethods.ExtractSingleFieldNodeFromMigrationDescription(
                conflict.ConflictedChangeAction.MigrationActionDescription, conflictDetails.FieldName);

            if (null == column)
            {
                // field no longer exists in the update document
                return(result);
            }

            result.Resolved       = true;
            result.ResolutionType = ConflictResolutionType.UpdatedConflictedChangeAction;

            return(result);
        }
示例#3
0
        public override void BasicActionHandler(MigrationAction action, ChangeGroup group)
        {
            try
            {
                VersionControlPath.GetFullPath(action.Path, true);
                if (!string.IsNullOrEmpty(action.FromPath))
                {
                    VersionControlPath.GetFullPath(action.FromPath, true);
                }
            }
            catch (Exception e)
            {
                MigrationConflict pathTooLongConflict = VCInvalidPathConflictType.CreateConflict(action, e.Message, action.Path);

                List <MigrationAction>   returnActions;
                ConflictResolutionResult resolutionResult = ((TfsVCAnalysisProvider)AnalysisProvider).ConflictManager.TryResolveNewConflict(
                    group.SourceId, pathTooLongConflict, out returnActions);
                if (resolutionResult.Resolved)
                {
                    switch (resolutionResult.ResolutionType)
                    {
                    case ConflictResolutionType.SkipConflictedChangeAction:
                        return;

                    default:
                        Debug.Fail("Unknown resolution result");
                        return;
                    }
                }
                return;
            }
            base.BasicActionHandler(action, group);
        }
 public ConflictResolutionResult Resolve(IServiceContainer serviceContainer, MigrationConflict conflict, ConflictResolutionRule rule, out List <MigrationAction> actions)
 {
     actions = null;
     if (rule.ActionRefNameGuid.Equals(new UnhandledChangeTypeMapAction().ReferenceName))
     {
         string mapFrom = rule.ApplicabilityScope;
         string mapTo   = rule.DataField[0].FieldValue;
         ConflictResolutionResult result;
         if (ValidateRuleData(mapTo, mapFrom))
         {
             result         = new ConflictResolutionResult(true, ConflictResolutionType.Other);
             result.Comment = mapTo;
         }
         else
         {
             result         = new ConflictResolutionResult(false, ConflictResolutionType.Other);
             result.Comment = "MapTo field is invalid.";
         }
         return(result);
     }
     else if (rule.ActionRefNameGuid.Equals(new UnhandledChangeTypeSkipAction().ReferenceName))
     {
         return(new ConflictResolutionResult(true, ConflictResolutionType.Other)); // do not set comment as MapTo
     }
     else
     {
         return(new ConflictResolutionResult(false, ConflictResolutionType.UnknownResolutionAction));
     }
 }
示例#5
0
 public ConflictResolutionResult Resolve(IServiceContainer serviceContainer, MigrationConflict conflict, ConflictResolutionRule rule, out List <MigrationAction> actions)
 {
     actions = null;
     if (rule.ActionRefNameGuid.Equals(new TFSHistoryNotFoundSuppressAction().ReferenceName))
     {
         if (rule.DataFieldDictionary.ContainsKey(TFSHistoryNotFoundSuppressAction.SupressChangeSetId))
         {
             ConflictResolutionResult result = new ConflictResolutionResult(true, ConflictResolutionType.SuppressedConflictedChangeGroup);
             result.Comment = rule.DataFieldDictionary[TFSHistoryNotFoundSuppressAction.SupressChangeSetId];
             return(result);
         }
         else
         {
             return(new ConflictResolutionResult(false, ConflictResolutionType.SuppressedConflictedChangeGroup));
         }
     }
     else if (rule.ActionRefNameGuid.Equals(new TFSHistoryNotFoundSkipAction().ReferenceName))
     {
         return(new ConflictResolutionResult(true, ConflictResolutionType.SkipConflictedChangeAction));
     }
     else
     {
         return(new ConflictResolutionResult(false, ConflictResolutionType.UnknownResolutionAction));
     }
 }
示例#6
0
 private void AddContacts(ICollection <IStorePropertyBag> addCollection)
 {
     if (addCollection.Count == 0)
     {
         this.Trace.TraceDebug((long)this.GetHashCode(), "RefreshGalContactsFolderCommand.AddContacts - addList.Count is 0, nothing to add.");
         return;
     }
     foreach (IStorePropertyBag storePropertyBag in addCollection)
     {
         try
         {
             ConflictResolutionResult conflictResolutionResult = this.recipientCacheContactsDataProvider.AddContact(storePropertyBag);
             if (conflictResolutionResult.SaveStatus != SaveResult.Success)
             {
                 this.Trace.TraceError <IStorePropertyBag, ConflictResolutionResult>((long)this.GetHashCode(), "Adding contact failed for contact {0}. ConflictResolutionResult = {1}.", storePropertyBag, conflictResolutionResult);
                 this.AddToExceptionList(new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(storePropertyBag), conflictResolutionResult));
             }
         }
         catch (TransientException ex)
         {
             this.Trace.TraceError <IStorePropertyBag, TransientException>((long)this.GetHashCode(), "Adding contact failed for contact {0}. Exception = {1}.", storePropertyBag, ex);
             this.AddToExceptionList(ex);
         }
         catch (StoragePermanentException ex2)
         {
             this.Trace.TraceError <IStorePropertyBag, StoragePermanentException>((long)this.GetHashCode(), "Adding contact failed for contact {0}. Exception = {1}.", storePropertyBag, ex2);
             this.AddToExceptionList(ex2);
         }
     }
 }
示例#7
0
        public static void DeleteLevelOneAttachments(Item newItem, UserContext userContext)
        {
            if (newItem == null)
            {
                throw new ArgumentNullException("newItem");
            }
            List <AttachmentId> list = new List <AttachmentId>();

            foreach (AttachmentHandle handle in newItem.AttachmentCollection)
            {
                using (Attachment attachment = newItem.AttachmentCollection.Open(handle))
                {
                    AttachmentPolicy.Level attachmentLevel = AttachmentLevelLookup.GetAttachmentLevel(attachment, userContext);
                    if (attachmentLevel == AttachmentPolicy.Level.Block)
                    {
                        list.Add(attachment.Id);
                    }
                }
            }
            if (list.Count != 0)
            {
                foreach (AttachmentId attachmentId in list)
                {
                    newItem.AttachmentCollection.Remove(attachmentId);
                }
                ConflictResolutionResult conflictResolutionResult = newItem.Save(SaveMode.ResolveConflicts);
                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                {
                    newItem.Dispose();
                    newItem = null;
                    throw new OwaSaveConflictException(LocalizedStrings.GetNonEncoded(-482397486), conflictResolutionResult);
                }
            }
            newItem.Load();
        }
示例#8
0
 // Token: 0x0600079F RID: 1951 RVA: 0x000366F0 File Offset: 0x000348F0
 private void ProcessMeetingForwardNotification(MailboxSession itemStore, MeetingForwardNotification mfnMessage, ref CalendarItemBase originalCalItem, string internetMessageId)
 {
     try
     {
         if (!mfnMessage.CalendarProcessed)
         {
             if (!mfnMessage.TryUpdateCalendarItem(ref originalCalItem, false))
             {
                 throw new SkipException(Strings.descSkipExceptionFailedUpdateFromMfn);
             }
             ConflictResolutionResult conflictResolutionResult = originalCalItem.Save(SaveMode.ResolveConflicts);
             originalCalItem.Load();
             if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
             {
                 throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(originalCalItem.Id), conflictResolutionResult);
             }
         }
         mfnMessage.SendRumUpdate(ref originalCalItem);
         originalCalItem.Load();
     }
     catch (ObjectNotFoundException innerException)
     {
         throw new TransientException(Strings.descTransientErrorInMfn, innerException);
     }
 }
示例#9
0
        public void CleanupUnlinkedAttachments()
        {
            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "AttachmentEventHandler.CleanupUnlinkedAttachments");
            OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("Id");
            string           changeKey        = (string)base.GetParameter("CK");
            string           bodyMarkup       = (string)base.GetParameter("BodyMarkup");

            using (Item item = Utilities.GetItem <Item>(base.UserContext, owaStoreObjectId, changeKey, new PropertyDefinition[0]))
            {
                if (base.UserContext.IsIrmEnabled)
                {
                    Utilities.IrmDecryptIfRestricted(item, base.UserContext, true);
                }
                item.OpenAsReadWrite();
                AttachmentUtility.RemoveUnlinkedInlineAttachments(item, bodyMarkup);
                ConflictResolutionResult conflictResolutionResult = item.Save(SaveMode.ResolveConflicts);
                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                {
                    throw new OwaEventHandlerException("Could not save item due to conflict resolution failure", LocalizedStrings.GetNonEncoded(-482397486), OwaEventHandlerErrorCode.ConflictResolution);
                }
                item.Load();
                this.RenderTotalAttachmentSize(item);
                base.WriteChangeKey(item);
            }
        }
示例#10
0
 public static LocalizedString IrresolvableConflict(ConflictResolutionResult conflictResolutionResult)
 {
     return(new LocalizedString("IrresolvableConflict", Strings.ResourceManager, new object[]
     {
         conflictResolutionResult
     }));
 }
示例#11
0
        public SaveResult SaveContact()
        {
            foreach (ContactPropertyInfo contactPropertyInfo in ContactUtilities.AllContactProperties)
            {
                if (contactPropertyInfo == ContactUtilities.FileAsId || contactPropertyInfo == ContactUtilities.PostalAddressId || contactPropertyInfo == ContactUtilities.DefaultPhoneNumber)
                {
                    this.SetInt(contactPropertyInfo);
                }
                else if (contactPropertyInfo == ContactUtilities.WorkAddressStreet || contactPropertyInfo == ContactUtilities.HomeStreet || contactPropertyInfo == ContactUtilities.OtherStreet)
                {
                    this.SetText(contactPropertyInfo, 256);
                }
                else
                {
                    this.SetText(contactPropertyInfo);
                }
            }
            this.SetEmail(ContactUtilities.Email1EmailAddress);
            this.SetEmail(ContactUtilities.Email2EmailAddress);
            this.SetEmail(ContactUtilities.Email3EmailAddress);
            this.SetNotes();
            AttachmentUtility.PromoteInlineAttachments(this.contact);
            ConflictResolutionResult conflictResolutionResult = this.Contact.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus != SaveResult.IrresolvableConflict && this.IsExistingItem && Globals.ArePerfCountersEnabled)
            {
                OwaSingleCounters.ItemsUpdated.Increment();
            }
            return(conflictResolutionResult.SaveStatus);
        }
 internal static void ThrowOnIrresolvableConflict(this ConflictResolutionResult result)
 {
     if (result.SaveStatus == SaveResult.IrresolvableConflict)
     {
         throw new IrresolvableConflictException(result);
     }
 }
        private ConflictResolutionResult ResolveByUpdateConversionHisotry(MigrationConflict conflict, ConflictResolutionRule rule, out List <MigrationAction> actions)
        {
            actions = null;
            var unresolvedRslt = new ConflictResolutionResult(false, ConflictResolutionType.Other);

            string tgtItemId    = rule.DataFieldDictionary[HistoryNotFoundUpdateConversionHistoryAction.DATAKEY_TARGET_ITEM_ID];
            string srcRevRanges = rule.DataFieldDictionary[HistoryNotFoundUpdateConversionHistoryAction.DATAKEY_SOURCE_REVISION_RANGES];
            string tgtRevRanges = rule.DataFieldDictionary[HistoryNotFoundUpdateConversionHistoryAction.DATAKEY_TARGET_REVISION_RANGES];

            int[] srcRevs;
            int[] tgtRevs;
            if (string.IsNullOrEmpty(tgtItemId) ||
                !IntegerRange.TryParseRangeString(srcRevRanges, out srcRevs) ||
                !IntegerRange.TryParseRangeString(srcRevRanges, out tgtRevs) ||
                srcRevs == null || srcRevs.Length == 0 || tgtRevs == null || tgtRevs.Length == 0 || srcRevs.Length != tgtRevs.Length)
            {
                return(unresolvedRslt);
            }

            WorkItemHistoryNotFoundConflictType conflictType = conflict.ConflictType as WorkItemHistoryNotFoundConflictType;

            Debug.Assert(null != conflictType, "conflictType is null");

            WorkItemHistoryNotFoundConflictTypeDetails dtls = conflictType.GetConflictDetails(conflict);

            ConversionResult convRslt = new ConversionResult(dtls.SourceMigrationSourceId, dtls.TargetMigrationSourceId);

            convRslt.ChangeId           = HistoryNotFoundResolutionChangeId;
            convRslt.ContinueProcessing = true;

            for (int i = 0; i < srcRevs.Length; ++i)
            {
                convRslt.ItemConversionHistory.Add(new ItemConversionHistory(dtls.SourceWorkItemID, srcRevs[i].ToString(), tgtItemId, tgtRevs[i].ToString()));
            }

            int  sessionRunId            = 0;
            Guid sourceMigrationSourceId = Guid.Empty;

            using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance())
            {
                long actionInternalId = conflict.ConflictedChangeAction.ActionId;
                var  actionQuery      = context.RTChangeActionSet.Where(a => a.ChangeActionId == actionInternalId);
                if (actionQuery.Count() == 0)
                {
                    return(unresolvedRslt);
                }

                RTChangeAction action = actionQuery.First();
                action.ChangeGroupReference.Load();
                action.ChangeGroup.SessionRunReference.Load();
                sessionRunId = action.ChangeGroup.SessionRun.Id;

                sourceMigrationSourceId = action.ChangeGroup.SourceUniqueId;
            }

            convRslt.Save(sessionRunId, sourceMigrationSourceId);

            return(new ConflictResolutionResult(true, ConflictResolutionType.Other));
        }
示例#14
0
 public ACRTraceString(ConflictResolutionResult saveResults)
 {
     if (saveResults == null)
     {
         throw new ArgumentNullException("saveResults");
     }
     this.saveResults = saveResults;
 }
示例#15
0
        public void SaveParentItem(IItem parentItem, CommandContext commandContext)
        {
            this.BeforeParentItemSave(parentItem);
            SaveMode saveMode = base.GetSaveMode(null, commandContext);
            ConflictResolutionResult result = parentItem.Save(saveMode);

            result.ThrowOnIrresolvableConflict();
        }
示例#16
0
        public void SaveChanges()
        {
            ConflictResolutionResult conflictResolutionResult = this.messageItem.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(this.messageItem.Id), conflictResolutionResult);
            }
            this.messageItem.Load();
        }
示例#17
0
        /// <summary>
        /// Create a generic conflict.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="group"></param>
        /// <returns></returns>
        private ConflictResolutionResult createGenericConflict(Exception e, ChangeGroup group)
        {
            Debug.Assert(e != null, "Exception e for creating generic conflict is NULL");
            Debug.Assert(group != null, "Conflicted change group is NULL");
            Debug.Assert(m_conflictManagementService != null, "ConflictManager is not properly initialized");

            MigrationConflict genericConflict = GenericConflictType.CreateConflict(e);

            List <MigrationAction>   retActions;
            ConflictResolutionResult resolutionResult =
                m_conflictManagementService.TryResolveNewConflict(group.SourceId, genericConflict, out retActions);

            return(resolutionResult);
        }
示例#18
0
        public static void SaveItem(Item item, params PropertyDefinition[] properties)
        {
            ConflictResolutionResult conflictResolutionResult = item.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                ExTraceGlobals.CalendarTracer.TraceDebug(0L, "Saving item failed due to conflict resolution.");
                throw new OwaSaveConflictException(LocalizedStrings.GetNonEncoded(-482397486), conflictResolutionResult);
            }
            item.Load(properties);
            if (Globals.ArePerfCountersEnabled)
            {
                OwaSingleCounters.ItemsUpdated.Increment();
            }
        }
示例#19
0
        // Token: 0x06000B9D RID: 2973 RVA: 0x0005158C File Offset: 0x0004F78C
        public static void SetLinkEnabled(Item item, params PropertyDefinition[] prefetchProperties)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            item.OpenAsReadWrite();
            item[ItemSchema.LinkEnabled] = true;
            ConflictResolutionResult conflictResolutionResult = item.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                throw new OwaSaveConflictException(LocalizedStrings.GetNonEncoded(-482397486), conflictResolutionResult);
            }
            item.Load(prefetchProperties);
        }
示例#20
0
        private ConflictResolutionResult TryResolveSingleRevConflict(
            string sourceSideItemId,
            IMigrationAction sourceAction,
            string targetWiId,
            List <MigrationAction> targetActions)
        {
            foreach (var targetAction in targetActions)
            {
                ConflictResolutionResult resolutionResult = TryResolveConflict(sourceSideItemId, sourceAction, targetWiId, targetAction);
                if (!resolutionResult.Resolved)
                {
                    return(resolutionResult);
                }
            }

            return(new ConflictResolutionResult(true, ConflictResolutionType.Other));
        }
示例#21
0
        private void SafeUpdateBindingItem(Action <Item> stampBindingItem)
        {
            stampBindingItem(this.binding);
            ConflictResolutionResult conflictResolutionResult = this.binding.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                LocalFolder.Tracer.TraceDebug <LocalFolder>((long)this.GetHashCode(), "{0}: Conflict occurs when saving the binding message. Reload and try saving again.", this);
                StoreObjectId objectId = this.binding.Id.ObjectId;
                this.binding.Dispose();
                this.binding = LocalFolder.BindToBindingMessage(this.mailboxSession, objectId);
                this.binding.OpenAsReadWrite();
                stampBindingItem(this.binding);
                this.binding.Save(SaveMode.NoConflictResolution);
            }
            this.binding.Load();
        }
        private ConflictResolutionResult UseValueMap(
            MigrationConflict conflict,
            ConflictResolutionRule rule,
            out List <MigrationAction> actions)
        {
            actions = null;
            ConflictResolutionResult result = new ConflictResolutionResult(false, ConflictResolutionType.Other);

            // deserialize conflict details
            var conflictDetails = ((ClearQuestSetFieldValueConflictType)conflict.ConflictType).GetConflictDetails(conflict);

            // extract data in the rule
            string mapFromValue = rule.DataFieldDictionary[ClearQuestConflictResolutionUseValueMap.DATAKEY_MAP_FROM];
            string mapToValue   = rule.DataFieldDictionary[ClearQuestConflictResolutionUseValueMap.DATAKEY_MAP_TO];
            string fieldName    = rule.DataFieldDictionary[ClearQuestConflictResolutionUseValueMap.DATAKEY_FIELD_NAME];

            if (!CQStringComparer.FieldName.Equals(conflictDetails.FieldName, fieldName))
            {
                // field name of the rule does not match that in the conflict
                return(result);
            }

            // look up the field in the update document
            XmlNode column = UtilityMethods.ExtractSingleFieldNodeFromMigrationDescription(
                conflict.ConflictedChangeAction.MigrationActionDescription, conflictDetails.FieldName);

            if (null == column)
            {
                // field no longer exists in the update document
                return(result);
            }

            string currValue = column.FirstChild.InnerText ?? ClearQuestSetFieldValueConflictTypeDetails.NullValueString;

            if (!string.Equals(currValue, mapFromValue))
            {
                return(result);
            }

            column.FirstChild.InnerText = mapToValue;

            result.Resolved       = true;
            result.ResolutionType = ConflictResolutionType.UpdatedConflictedChangeAction;

            return(result);
        }
示例#23
0
        private void StampReplyTemplateGuid(MessageItem template)
        {
            this.replyTemplateGuid = Guid.NewGuid();
            template.OpenAsReadWrite();
            template.SafeSetProperty(ItemSchema.ReplyTemplateId, this.replyTemplateGuid.ToByteArray());
            ConflictResolutionResult conflictResolutionResult = template.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult != ConflictResolutionResult.Success)
            {
                base.Context.TraceDebug <string, string>("Failed to stamp the Guid on the reply template message for the rule {0} on the folder {1}. Skipping updating the rule action with the Guid.", base.Context.CurrentRule.Name, base.Context.CurrentFolderDisplayName);
            }
            else
            {
                base.Context.TraceDebug("Successfully stamped the Guid on the template message, now updating the rule action with the guid.");
                this.UpdateRuleAction(RuleActionConverter.GetReplyTemplateStoreObjectId(this.messageTemplateEntryId));
            }
            template.Load(StoreObjectSchema.ContentConversionProperties);
        }
示例#24
0
 // Token: 0x0600079B RID: 1947 RVA: 0x00036360 File Offset: 0x00034560
 private void ProcessMeetingRequest(MailboxSession itemStore, MeetingRequest mtgMessage, ref CalendarItemBase originalCalItem, string internetMessageId, int defaultReminderInMinutes)
 {
     try
     {
         if (mtgMessage.TryUpdateCalendarItem(ref originalCalItem, false))
         {
             MeetingMessageType meetingRequestType = mtgMessage.MeetingRequestType;
             if (originalCalItem != null)
             {
                 if (originalCalItem.Id == null && MeetingMessageType.NewMeetingRequest == meetingRequestType)
                 {
                     int num = (int)Utils.SafeGetProperty(mtgMessage, ItemSchema.ReminderMinutesBeforeStart, defaultReminderInMinutes);
                     if (num == 1525252321)
                     {
                         num = defaultReminderInMinutes;
                         originalCalItem[ItemSchema.ReminderMinutesBeforeStart] = num;
                     }
                     if (num < 0 || num > 2629800)
                     {
                         originalCalItem[ItemSchema.ReminderMinutesBeforeStart] = defaultReminderInMinutes;
                     }
                     if (!originalCalItem.Reminder.IsSet)
                     {
                         originalCalItem.Reminder.MinutesBeforeStart = defaultReminderInMinutes;
                         originalCalItem.Reminder.IsSet = true;
                     }
                 }
                 originalCalItem.Validate();
                 ConflictResolutionResult conflictResolutionResult = originalCalItem.Save(SaveMode.ResolveConflicts);
                 originalCalItem.Load();
                 if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                 {
                     throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(originalCalItem.Id), conflictResolutionResult);
                 }
             }
         }
         CalendarAssistantPerformanceCounters.MeetingRequests.Increment();
         CalendarProcessing.TracerPfd.TracePfd <int, object, string>((long)mtgMessage.GetHashCode(), "PFD IWC {0} {1}:completed Processing Meeting Request for {2}", 24727, TraceContext.Get(), internetMessageId);
     }
     catch (ObjectNotFoundException innerException)
     {
         throw new TransientException(Strings.descTransientErrorInRequest, innerException);
     }
 }
        private ConflictResolutionResult UseRegexValueReplacement(
            MigrationConflict conflict,
            ConflictResolutionRule rule,
            out List <MigrationAction> actions)
        {
            actions = null;
            ConflictResolutionResult result = new ConflictResolutionResult(false, ConflictResolutionType.Other);

            // deserialize conflict details
            var conflictDetails = ((ClearQuestSetFieldValueConflictType)conflict.ConflictType).GetConflictDetails(conflict);

            // extract the field name and regex specified in the rule
            string regexPattern = rule.DataFieldDictionary[ClearQuestConflictResolutionUseRegexValueReplacement.DATAKEY_REGEX_PATTERN];
            string fieldName    = rule.DataFieldDictionary[ClearQuestConflictResolutionUseRegexValueReplacement.DATAKEY_FIELD_NAME];
            string replacement  = rule.DataFieldDictionary[ClearQuestConflictResolutionUseRegexValueReplacement.DATAKEY_REPLACEMENT];

            if (!CQStringComparer.FieldName.Equals(conflictDetails.FieldName, fieldName))
            {
                // field name of the rule does not match that in the conflict
                return(result);
            }

            // look up the field in the update document
            XmlNode column = UtilityMethods.ExtractSingleFieldNodeFromMigrationDescription(
                conflict.ConflictedChangeAction.MigrationActionDescription, conflictDetails.FieldName);

            if (null == column)
            {
                // field no longer exists in the update document
                return(result);
            }

            // apply Regex.Replace
            string currFieldValue = column.FirstChild.InnerText ?? ClearQuestSetFieldValueConflictTypeDetails.NullValueString;

            column.FirstChild.InnerText = Regex.Replace(currFieldValue, regexPattern, replacement, RegexOptions.Multiline);

            result.Resolved       = true;
            result.ResolutionType = ConflictResolutionType.UpdatedConflictedChangeAction;

            return(result);
        }
        public override void Apply(CoreFolder folder)
        {
            using (UserConfiguration mailboxConfiguration = this.GetMailboxConfiguration(folder))
            {
                IDictionary dictionary = mailboxConfiguration.GetDictionary();
                dictionary["OlcIsVisible"]                     = this.IsVisible;
                dictionary["OlcIsHidden"]                      = this.IsHidden;
                dictionary["OlcColorIndex"]                    = this.ColorIndex;
                dictionary["OlcIsDailySummaryEnabled"]         = this.IsDailySummaryEnabled;
                dictionary["ConsumerTaskPermissionLevel"]      = this.ConsumerTaskPermissionLevel;
                dictionary["OlcConsecutiveErrorCount"]         = this.ConsecutiveErrorCount;
                dictionary["OlcTotalErrorCount"]               = this.TotalErrorCount;
                dictionary["OlcPollingInterval"]               = this.PollingInterval;
                dictionary["OlcEntityTag"]                     = (this.EntityTag ?? string.Empty);
                dictionary["OlcImportedEventCount"]            = this.ImportedEventCount;
                dictionary["OlcTotalEventCount"]               = this.TotalEventCount;
                dictionary["OlcUpdateStatus"]                  = this.UpdateStatus;
                dictionary["OlcMissingUidCount"]               = this.MissingUidCount;
                dictionary["OlcConsecutiveCriticalErrorCount"] = this.ConsecutiveCriticalErrorCount;
                dictionary["OlcPersonIdMigrated"]              = this.PersonIdMigrated;
                ConflictResolutionResult conflictResolutionResult = mailboxConfiguration.Save(SaveMode.ResolveConflicts);
                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                {
                    throw new ConversionFailedException(ConversionFailureReason.ConverterInternalFailure, MrsStrings.ReportCalendarFolderFaiSaveFailed, null);
                }
                MrsTracer.Provider.Debug("Calendar folder user configuration has been updated.", new object[0]);
            }
            folder.PropertyBag.Load(CalendarFolderSchema.Instance.AutoloadProperties);
            if (this.OlcCalendarType != OlcCalendarType.RegularEvents)
            {
                folder.PropertyBag[FolderSchema.DisplayName] = (this.Name ?? string.Empty);
            }
            folder.PropertyBag[CalendarFolderSchema.CharmId] = (this.CharmId ?? string.Empty);
            FolderSaveResult folderSaveResult = folder.Save(SaveMode.NoConflictResolution);

            if (folderSaveResult.OperationResult == OperationResult.Failed)
            {
                throw new ConversionFailedException(ConversionFailureReason.ConverterInternalFailure, MrsStrings.ReportCalendarFolderSaveFailed, null);
            }
            MrsTracer.Provider.Debug("Calendar folder has been updated with settings.", new object[0]);
            folder.PropertyBag.Load(CalendarFolderSchema.Instance.AutoloadProperties);
        }
示例#27
0
 // Token: 0x0600079E RID: 1950 RVA: 0x00036658 File Offset: 0x00034858
 private void ProcessMeetingCancellation(MailboxSession itemStore, MeetingCancellation mtgMessage, ref CalendarItemBase originalCalItem, string internetMessageId)
 {
     try
     {
         if (mtgMessage.TryUpdateCalendarItem(ref originalCalItem, false))
         {
             mtgMessage.Load();
             ConflictResolutionResult conflictResolutionResult = originalCalItem.Save(SaveMode.ResolveConflicts);
             originalCalItem.Load();
             if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
             {
                 throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(originalCalItem.Id), conflictResolutionResult);
             }
         }
         CalendarAssistantPerformanceCounters.MeetingCancellations.Increment();
         CalendarProcessing.TracerPfd.TracePfd <int, object, string>((long)mtgMessage.GetHashCode(), "PFD IWC {0} {1}:completed Processing Meeting Cancellation for {2}", 28823, TraceContext.Get(), internetMessageId);
     }
     catch (ObjectNotFoundException innerException)
     {
         throw new TransientException(Strings.descTransientErrorInCancellation, innerException);
     }
 }
示例#28
0
        // Token: 0x06000792 RID: 1938 RVA: 0x00035B00 File Offset: 0x00033D00
        internal static bool CheckSaveResults(MessageItem message, ConflictResolutionResult saveResults, string internetMessageId)
        {
            if (saveResults.SaveStatus == SaveResult.Success)
            {
                return(true);
            }
            ACRTraceString acrtraceString = new ACRTraceString(saveResults);

            if (saveResults.SaveStatus == SaveResult.SuccessWithConflictResolution)
            {
                CalendarProcessing.ProcessingTracer.TraceDebug <object, string, ACRTraceString>((long)message.GetHashCode(), "{0}: Success saving message, but conflict resolution was triggered. Message:{1} Properties in error: {2}", TraceContext.Get(), internetMessageId, acrtraceString);
                return(true);
            }
            CalendarProcessing.ProcessingTracer.TraceDebug((long)message.GetHashCode(), "{0}: Error trying to save meeting message after final processing. Message:{1} SaveResults:{2} Properties in error: {3}", new object[]
            {
                TraceContext.Get(),
                internetMessageId,
                saveResults.SaveStatus,
                acrtraceString
            });
            return(false);
        }
示例#29
0
 internal void Save(bool reload)
 {
     lock (this.mailboxSession.Value)
     {
         try
         {
             ConflictResolutionResult conflictResolutionResult = this.MessageItem.Save(SaveMode.NoConflictResolutionForceSave);
             if (conflictResolutionResult.SaveStatus != SaveResult.Success)
             {
                 StreamLogItem.Tracer.TraceError <SaveResult>((long)this.GetHashCode(), "Log item is saved with status {0}", conflictResolutionResult.SaveStatus);
             }
         }
         catch (MessageSubmissionExceededException)
         {
             StreamLogItem.Tracer.TraceError((long)this.GetHashCode(), "Log item is too large");
         }
         if (reload)
         {
             this.MessageItem.Load();
         }
     }
 }
示例#30
0
        private ConflictResolutionResult ResolveByDroppingField(MigrationConflict conflict, ConflictResolutionRule rule, out List <MigrationAction> actions)
        {
            actions = null;

            ClearQuestInvalidFieldValueConflictType conflictType = conflict.ConflictType as ClearQuestInvalidFieldValueConflictType;

            if (null == conflictType)
            {
                throw new InvalidOperationException();
            }

            string invalidFieldName = rule.DataFieldDictionary[DropFieldConflictResolutionAction.ActionDataKey_FieldName];

            if (string.IsNullOrEmpty(invalidFieldName))
            {
                var result = new ConflictResolutionResult(false, ConflictResolutionType.Other);
                result.Comment = string.Format(ClearQuestResource.ClearQuest_Conflict_MissingResolutionData,
                                               DropFieldConflictResolutionAction.ActionDataKey_FieldName);
                return(result);
            }
            //
            // apply field map to the Action's Description document
            //
            XmlDocument desc   = conflict.ConflictedChangeAction.MigrationActionDescription;
            XmlNode     column = desc.SelectSingleNode(string.Format(
                                                           @"/WorkItemChanges/Columns/Column[@ReferenceName=""{0}""]", invalidFieldName));

            if (column == null || invalidFieldName != column.Attributes["ReferenceName"].Value)
            {
                return(new ConflictResolutionResult(false, ConflictResolutionType.Other));
            }
            XmlNode columnsNode = column.ParentNode;

            columnsNode.RemoveChild(column);

            //note: changes to "MigrationConflict conflict" is saved by the conflict manager automatically
            return(new ConflictResolutionResult(true, ConflictResolutionType.UpdatedConflictedChangeAction));
        }