Esempio n. 1
0
        public EDiscoveryManagerPathModel GetNotSharedYetPath(FolderModel folder)
        {
            // We need to get the staged count, as it will allow us to A. determine if we're going to show the not shared yet folder,
            // and B. a cound on the not shared yet folder.
            var stagedCount         = EDiscoveryUtility.GetStagedCount(folder);
            var notSharedIdentifier = new PathIdentifier(folder.Identifier, EDiscoveryUtility.E_DISCOVERY_NOT_SHARED_PATH_KEY);

            var processor = new PathProcessor(folder.Identifier);

            processor.Read(folder, skipFolderPaths: true, pathReader: f => {
                if (f.ShareState() != EDiscoveryShareState.Staged)
                {
                    return(null);
                }

                var sharePath = f.MetaEDiscoveryPathIdentifierRead();

                if (sharePath != null)
                {
                    return(notSharedIdentifier.CreateChild(sharePath.PathKey));
                }

                return(null);
            });

            return(new EDiscoveryManagerPathModel()
            {
                Identifier = notSharedIdentifier,
                Icons = new string[] { EDiscoveryUtility.EDISCOVERY_FOLDER_COLOR_STYLE },
                Name = $"Not Shared Yet ({stagedCount.ToString()})",
                FullPath = "eDiscovery/Not Shared Yet",
                AllowedOperations = null,
                Paths = processor[notSharedIdentifier]?.Paths
            });
        }
Esempio n. 2
0
        public override void BuildDynamicFolders(PathIdentifier identifier, ItemQueryResponse page, FolderModel folder, bool isRestrictedView)
        {
            if (!page?.PathTree?.Paths?.Any(p => p.Identifier.PathKey == EDiscoveryUtility.E_DISCOVERY_PATH_KEY) ?? false)
            {
                if (page.PathTree.Paths == null)
                {
                    page.PathTree.Paths = new List <ManagerPathModel>();
                }

                var managerPathModels = new List <ManagerPathModel>();

                // we have to build up the children first.
                // First we get all the dated package dynamic paths.
                var datedPackagePaths = BuildDatedPackagesDynamicFolder(folder);

                var eDiscoveryIdentifier = new PathIdentifier(identifier)
                {
                    PathKey = EDiscoveryUtility.E_DISCOVERY_PATH_KEY
                };

                // Last the parent / root node of 'eDiscovery'
                var eDiscoveryPath = new ManagerPathModel
                {
                    Identifier        = eDiscoveryIdentifier,
                    Icons             = new string[] { EDiscoveryUtility.EDISCOVERY_FOLDER_COLOR_STYLE },
                    Name              = EDiscoveryUtility.E_DISCOVERY_PATH_NAME,
                    FullPath          = EDiscoveryUtility.E_DISCOVERY_PATH_KEY,
                    AllowedOperations = null,
                    Paths             = new List <ManagerPathModel>(),
                    IsExpanded        = datedPackagePaths.Count > 0 || EDiscoveryUtility.GetStagedCount(folder) > 0,
                };

                if (datedPackagePaths.Any())
                {
                    var allPackagesIdentifier = new PathIdentifier(identifier as FolderIdentifier, EDiscoveryUtility.E_DISCOVERY_ALL_PACKAGE_PATH_KEY);

                    var packageName = "All";

                    var processor = new PathProcessor(folder.Identifier);
                    processor.Read(folder, skipFolderPaths: true, pathReader: f => {
                        var sharePath = f.MetaEDiscoveryPathIdentifierRead();

                        if (sharePath != null)
                        {
                            return(allPackagesIdentifier.CreateChild(sharePath.PathKey));
                        }
                        else
                        {
                            return(sharePath);
                        }
                    });


                    datedPackagePaths.Insert(0, new EDiscoveryManagerPathModel()
                    {
                        Identifier = allPackagesIdentifier,
                        Icons      = new string[] { EDiscoveryUtility.EDISCOVERY_FOLDER_COLOR_STYLE },
                        Name       = packageName,
                        FullPath   = allPackagesIdentifier.FullName,
                        Paths      = processor[allPackagesIdentifier]?.Paths
                    });
                }

                eDiscoveryPath.Paths = eDiscoveryPath.Paths.Concat(datedPackagePaths).ToList();

                if (!isRestrictedView)
                {
                    eDiscoveryPath.Paths.Add(GetNotSharedYetPath(folder));
                }

                page.PathTree.Paths.Add(eDiscoveryPath);
            }
        }