コード例 #1
0
ファイル: EDiscovery.cs プロジェクト: julien-cheng/DEMS
        public async Task <EDiscoveryStatisticsResponse> GetEDiscoveryStatistics(FolderIdentifier folderIdentifier)
        {
            var stats = new EDiscoveryStatisticsResponse();

            // Setup our state so we have everything we need.
            var folder = await connection.Folder.GetAsync(folderIdentifier, new List <PopulationDirective>
            {
                new PopulationDirective
                {
                    Name = nameof(FolderModel.Files)
                }
            });

            foreach (var file in folder.Files.Rows.ToList())
            {
                switch (EDiscoveryUtility.GetCurrentShareState(file))
                {
                case EDiscoveryShareState.NotShared:
                    // No Op here
                    break;

                case EDiscoveryShareState.Staged:
                    stats.FilesStaged++;
                    break;

                case EDiscoveryShareState.Published:
                    stats.FilesPublished++;
                    break;

                default:
                    break;
                }
            }

            stats.RecipientCount = folder.MetaEDiscoveryRecipientListRead().Count();

            stats.IsEDiscoveryActive = this.IsModuleActive(folder);

            return(stats);
        }
コード例 #2
0
        public async Task <PCMSAPIResponse <bool> > EDiscoveryStatisticsAsync([FromBody] APIRequest request)
        {
            CheckAuthentication(request);
            var connection = await ConnectionCreate(request);

            var config = CountyState.Read(request.Context.CountyState);

            var folderKey        = $"Defendant:{request.Context.DefendantID}";
            var folderIdentifier = new FolderIdentifier(config.UserIdentifier.OrganizationKey, folderKey);

            var stats = new EDiscoveryStatisticsResponse();

            // Setup our state so we have everything we need.
            var folder = await connection.Folder.GetAsync(folderIdentifier, new List <PopulationDirective>
            {
                new PopulationDirective
                {
                    Name = nameof(FolderModel.Files)
                }
            });

            if (folder?.Files?.Rows != null)
            {
                foreach (var file in folder.Files.Rows.ToList())
                {
                    switch (GetCurrentShareState(file))
                    {
                    case EDiscoveryShareState.NotShared:
                        // No Op here
                        break;

                    case EDiscoveryShareState.Staged:
                        stats.FilesStaged++;
                        break;

                    case EDiscoveryShareState.Published:
                        stats.FilesPublished++;
                        break;

                    default:
                        break;
                    }
                }
            }

            if (folder != null)
            {
                // Really the thing stored at this metadata key is a EdiscoveryRecipient, but I'm hoping we can get away with just bringing it back out as an object, because we
                // only need the count off of it.
                stats.RecipientCount = folder.Read <List <object> >(MetadataKeyConstants.E_DISCOVERY_RECIPIENT_LIST, defaultValue: new List <object>()).Count();

                stats.IsEDiscoveryActive = folder.Read <bool>(MetadataKeyConstants.E_DISCOVERY_ACTIVE_METAKEY);
            }

            bool allowed = stats.FilesPublished == 0;

            return(new PCMSAPIResponse <bool>
            {
                Response = allowed
            });
        }