Exemple #1
0
        public void GroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId destinationFolderId, StoreObjectId[] itemIds, GroupOperationResult result, bool onBeforeNotification, CallbackContext callbackContext)
        {
            EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation");
            EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags");
            int num = 0;

            if (itemIds != null)
            {
                foreach (StoreObjectId storeObjectId in itemIds)
                {
                    if (!(storeObjectId is OccurrenceStoreObjectId))
                    {
                        num++;
                    }
                }
            }
            if (itemIds == null || num == itemIds.Length)
            {
                dumpster.MoveItemsToDumpster(callbackContext.SessionWithBestAccess, dumpster.RecoverableItemsDeletionsFolderId, itemIds);
                return;
            }
            if (num > 0)
            {
                StoreObjectId[] array = new StoreObjectId[num];
                num = 0;
                foreach (StoreObjectId storeObjectId2 in itemIds)
                {
                    if (!(storeObjectId2 is OccurrenceStoreObjectId))
                    {
                        array[num] = storeObjectId2;
                        num++;
                    }
                }
                dumpster.MoveItemsToDumpster(callbackContext.SessionWithBestAccess, dumpster.RecoverableItemsDeletionsFolderId, array);
            }
        }
 public void GroupOperation(COWSettings settings, IDumpsterItemOperations dumpster, COWTriggerAction operation, FolderChangeOperationFlags flags, StoreSession sourceSession, StoreSession destinationSession, StoreObjectId destinationFolderId, StoreObjectId[] itemIds, GroupOperationResult result, bool onBeforeNotification, CallbackContext callbackContext)
 {
     EnumValidator.ThrowIfInvalid <COWTriggerAction>(operation, "operation");
     EnumValidator.ThrowIfInvalid <FolderChangeOperationFlags>(flags, "flags");
     if (settings.CurrentFolderId.Equals(dumpster.RecoverableItemsPurgesFolderId))
     {
         ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "Attempt to hard delete items in the dumpster purges folder");
         throw new RecoverableItemsAccessDeniedException("Purges");
     }
     if (settings.CurrentFolderId.Equals(dumpster.RecoverableItemsDiscoveryHoldsFolderId))
     {
         ExTraceGlobals.SessionTracer.TraceDebug((long)dumpster.StoreSession.GetHashCode(), "Attempt to hard delete items in the dumpster discoveryholds folder");
         throw new RecoverableItemsAccessDeniedException("DiscoveryHolds");
     }
     if (COWTriggerAction.HardDelete == operation)
     {
         try
         {
             StoreObjectId storeObjectId;
             if (settings.IsOnlyInPlaceHoldEnabled())
             {
                 settings.Session.CowSession.CheckAndCreateDiscoveryHoldsFolder(callbackContext.SessionWithBestAccess);
                 storeObjectId = dumpster.RecoverableItemsDiscoveryHoldsFolderId;
             }
             else
             {
                 storeObjectId = dumpster.RecoverableItemsPurgesFolderId;
             }
             if (!settings.CurrentFolderId.Equals(storeObjectId))
             {
                 dumpster.MoveItemsToDumpster(callbackContext.SessionWithBestAccess, storeObjectId, itemIds);
             }
             return;
         }
         catch (DumpsterOperationException)
         {
             if (dumpster.Results.AnyPartialResultFailure())
             {
                 throw;
             }
             List <GroupOperationResult> partialResults = dumpster.Results.GetPartialResults();
             ExTraceGlobals.SessionTracer.TraceWarning <GroupOperationResult>((long)dumpster.StoreSession.GetHashCode(), "DumpsterOperationException during HardDelete and Partial success: leave the current results {0}", partialResults[partialResults.Count - 1]);
             return;
         }
     }
     dumpster.CopyItemsToDumpster(callbackContext.SessionWithBestAccess, dumpster.RecoverableItemsPurgesFolderId, itemIds, COWTriggerAction.DoneWithMessageDelete == operation);
 }