Пример #1
0
        public async Task <InvokeResult <Solution> > LoadFullSolutionAsync(string id, EntityHeader org, EntityHeader user)
        {
            var result = new InvokeResult <Solution>();

            var solution = await _deploymentRepo.GetSolutionAsync(id);

            foreach (var config in solution.DeviceConfigurations)
            {
                var loadResult = await _deviceConfigManager.LoadFullDeviceConfigurationAsync(config.Id, org, user);

                if (result.Successful)
                {
                    config.Value = loadResult.Result;
                }
                else
                {
                    result.Concat(loadResult);
                }
            }

            if (solution.Planner.IsEmpty())
            {
                result.Errors.Add(DeploymentErrorCodes.NoPlannerSpecified.ToErrorMessage());
            }
            else
            {
                var loadResult = await _pipelineModuleManager.LoadFullPlannerConfigurationAsync(solution.Planner.Id);

                if (loadResult.Successful)
                {
                    solution.Planner.Value = loadResult.Result;
                }
                else
                {
                    result.Concat(loadResult);
                }
            }

            foreach (var listenerConfig in solution.Listeners)
            {
                var loadResult = await _pipelineModuleManager.LoadFullListenerConfigurationAsync(listenerConfig.Id);

                if (loadResult.Successful)
                {
                    listenerConfig.Value = loadResult.Result;
                }
                else
                {
                    result.Concat(loadResult);
                }
            }

            return(InvokeResult <Solution> .Create(solution));
        }