public void PrepareForSolution(IClaimsInfoProvider claimsInfoProvider, string solutionId)
        {
            GetInternal(() =>
            {
                if (_env.IsDevelopment() && _isFakeSharePoint)
                {
                    LogInformation($"PrepareForSolution disabled in 'test' Development environment");
                    return(0);
                }

                LogInformation($"PrepareForSolution: solutionId: {solutionId}");
                var soln = _solutionsDatastore.ById(solutionId);
                if (soln == null)
                {
                    throw new KeyNotFoundException($"Could not find solution: {solutionId}");
                }
                var org             = _organisationsDatastore.ById(soln.OrganisationId);
                var claimedCapNames = _capabilitiesImplementedDatastore
                                      .BySolution(solutionId)
                                      .Select(x => CleanupFileName(_capabilitiesDatastore.ById(x.CapabilityId).Name));
                var claimedNameStds = _standardsApplicableDatastore
                                      .BySolution(solutionId)
                                      .Select(x => CleanupFileName(_standardsDatastore.ById(x.StandardId).Name));

                var capsTask = Task.Factory.StartNew(() => CreateClaimSubFolders(CreateClientContext(), SharePoint_OrganisationsRelativeUrl, CleanupFileName(org.Name), CleanupFileName(soln.Name), CleanupFileName(soln.Version), CleanupFileName(claimsInfoProvider.GetCapabilityFolderName()), claimedCapNames));
                var stdsTask = Task.Factory.StartNew(() => CreateClaimSubFolders(CreateClientContext(), SharePoint_OrganisationsRelativeUrl, CleanupFileName(org.Name), CleanupFileName(soln.Name), CleanupFileName(soln.Version), CleanupFileName(claimsInfoProvider.GetStandardsFolderName()), claimedNameStds));
                Task.WaitAll(capsTask, stdsTask);

                return(0);
            });
        }
Esempio n. 2
0
 public Capabilities ById(string id)
 {
     return(_filter.Filter(new[] { _datastore.ById(id) }).SingleOrDefault());
 }