Esempio n. 1
0
        public async Task <CreateStepArtifactResponse> Post(CreateStepArtifactRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            if (await stepRepository.DoesStepArtifactExist(request.BatchId, request.StepName, request.ArtifactName))
            {
                throw Err.StepArtifactAlreadyExists(request.ArtifactName);
            }

            var stepArtifact = request.ConvertTo <StepArtifact>();

            stepArtifact.StepId = step.Id;

            await stepRepository.CreateStepArtifact(stepArtifact);

            return(new CreateStepArtifactResponse());
        }
Esempio n. 2
0
        public async Task <DeleteStepArtifactOptionResponse> Delete(DeleteStepArtifactOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var existingStepArtifact =
                await stepRepository.GetStepArtifact(step.Id, request.ArtifactName);

            if (existingStepArtifact == null)
            {
                throw Err.StepArtifactNotFound(request.ArtifactName);
            }

            var existingStepArtifactOption = await stepRepository.GetStepArtifactOption(existingStepArtifact.Id, request.OptionName);

            if (existingStepArtifactOption == null)
            {
                throw Err.StepArtifactOptionNotFound(request.OptionName);
            }

            await stepRepository.DeleteStepArtifactOption(existingStepArtifactOption.Id);

            return(new DeleteStepArtifactOptionResponse());
        }
Esempio n. 3
0
        public async Task <GetAllStepArtifactOptionResponse> Get(GetAllStepArtifactOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var existingStepArtifact =
                await stepRepository.GetStepArtifact(step.Id, request.ArtifactName);

            if (existingStepArtifact == null)
            {
                throw Err.StepArtifactNotFound(request.ArtifactName);
            }

            var response = new GetAllStepArtifactOptionResponse
            {
                Options = existingStepArtifact.Options.ConvertTo <List <DomainModels.Option> >()
            };

            return(response);
        }
Esempio n. 4
0
        public async Task <DeleteCommandVariableResponse> Delete(DeleteCommandVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var command = await commandRepository.Get(step.Id, request.CommandName);

            if (command == null)
            {
                throw Err.CommandNotFound(request.CommandName);
            }

            var existingCommandVariable =
                await commandRepository.GetCommandVariable(command.Id, request.VariableName);

            if (existingCommandVariable == null)
            {
                throw Err.CommandVariableNotFound(request.VariableName);
            }

            await commandRepository.DeleteCommandVariable(existingCommandVariable.Id);

            return(new DeleteCommandVariableResponse());
        }
Esempio n. 5
0
        public async Task <UpdateStepArtifactResponse> Put(UpdateStepArtifactRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var existingStepArtifact =
                await stepRepository.GetStepArtifact(step.Id, request.ArtifactName);

            if (existingStepArtifact == null)
            {
                throw Err.StepArtifactNotFound(request.ArtifactName);
            }

            var stepArtifact = request.ConvertTo <StepArtifact>();

            stepArtifact.StepId = step.Id;
            stepArtifact.Id     = existingStepArtifact.Id;

            await stepRepository.UpdateStepArtifact(stepArtifact);

            return(new UpdateStepArtifactResponse());
        }
Esempio n. 6
0
        public async Task <UpdateCommandResponse> Put(UpdateCommandRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var command = request.ConvertTo <Core.Entities.Command>();

            command.StepId = step.Id;

            var updated = await commandRepository.Update(command);

            if (!updated)
            {
                throw Err.CommandNotFound(request.CommandName);
            }

            return(new UpdateCommandResponse());
        }
Esempio n. 7
0
        public async Task <UpdateStepVariableResponse> Put(UpdateStepVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var existingStepVariable =
                await stepRepository.GetStepVariable(step.Id, request.VariableName);

            if (existingStepVariable == null)
            {
                throw Err.StepVariableNotFound(request.VariableName);
            }

            var stepVariable = request.ConvertTo <StepVariable>();

            stepVariable.Id     = existingStepVariable.Id;
            stepVariable.StepId = step.Id;

            await stepRepository.CreateOrUpdateStepVariable(stepVariable);

            return(new UpdateStepVariableResponse());
        }
Esempio n. 8
0
        public async Task <CreateCommandVariableResponse> Post(CreateCommandVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var command = await commandRepository.Get(step.Id, request.CommandName);

            if (command == null)
            {
                throw Err.CommandNotFound(request.CommandName);
            }

            if (await commandRepository.DoesCommandVariableExist(request.BatchId, request.StepName, request.CommandName, request.VariableName))
            {
                throw Err.CommandVariableAlreadyExists(request.VariableName);
            }

            var commandVariable = request.ConvertTo <CommandVariable>();

            commandVariable.CommandId = command.Id;

            await commandRepository.CreateOrUpdateCommandVariable(commandVariable);

            return(new CreateCommandVariableResponse());
        }
Esempio n. 9
0
        public async Task <CreateCommandResponse> Post(CreateCommandRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            if (await commandRepository.DoesCommandExist(request.BatchId, request.StepName, request.CommandName))
            {
                throw Err.CommandAlreadyExists(request.CommandName);
            }

            var command = request.ConvertTo <Core.Entities.Command>();

            command.StepId = step.Id;

            await commandRepository.Create(command);

            return(new CreateCommandResponse());
        }
Esempio n. 10
0
        public async Task <UpdateBatchArtifactOptionResponse> Put(UpdateBatchArtifactOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var batchArtifact = await batchRepository.GetBatchArtifact(request.BatchId, request.ArtifactName);

            if (batchArtifact == null)
            {
                throw Err.BatchArtifactNotFound(request.ArtifactName);
            }

            var existingBatchArtifactOption =
                await batchRepository.GetBatchArtifactOption(batchArtifact.Id, request.OptionName);

            if (existingBatchArtifactOption == null)
            {
                throw Err.BatchArtifactOptionNotFound(request.OptionName);
            }

            var batchArtifactOption = request.ConvertTo <BatchArtifactOption>();

            batchArtifactOption.Id = existingBatchArtifactOption.Id;
            batchArtifactOption.BatchArtifactId = batchArtifact.Id;

            await batchRepository.CreateOrUpdateBatchArtifactOption(batchArtifactOption);

            return(new UpdateBatchArtifactOptionResponse());
        }
Esempio n. 11
0
        public async Task <GetCommandVariableResponse> Get(GetCommandVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var command = await commandRepository.Get(step.Id, request.CommandName);

            if (command == null)
            {
                throw Err.CommandNotFound(request.CommandName);
            }

            var commandVariable = await commandRepository.GetCommandVariable(command.Id, request.VariableName);

            if (commandVariable == null)
            {
                throw Err.CommandVariableNotFound(request.VariableName);
            }

            return(commandVariable.ConvertTo <GetCommandVariableResponse>());
        }
Esempio n. 12
0
        public async Task <CreateStepArtifactOptionResponse> Post(CreateStepArtifactOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var existingStepArtifact =
                await stepRepository.GetStepArtifact(step.Id, request.ArtifactName);

            if (existingStepArtifact == null)
            {
                throw Err.StepArtifactNotFound(request.ArtifactName);
            }

            if (await stepRepository.DoesStepArtifactOptionExist(request.BatchId, request.StepName, request.ArtifactName, request.OptionName))
            {
                throw Err.StepArtifactOptionAlreadyExists(request.OptionName);
            }

            var stepArtifactOption = request.ConvertTo <StepArtifactOption>();

            stepArtifactOption.StepArtifactId = existingStepArtifact.Id;

            await stepRepository.CreateOrUpdateStepArtifactOption(stepArtifactOption);

            return(new CreateStepArtifactOptionResponse());
        }
Esempio n. 13
0
        public async Task <GetAllCommandVariableResponse> Get(GetAllCommandVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            var command = await commandRepository.Get(step.Id, request.CommandName);

            if (command == null)
            {
                throw Err.CommandNotFound(request.CommandName);
            }

            var response = new GetAllCommandVariableResponse
            {
                Variables = command.Variables.ConvertTo <List <DomainModels.Variable> >()
            };

            return(response);
        }
Esempio n. 14
0
        public async Task <DeleteBatchResponse> Delete(DeleteBatchRequest request)
        {
            var deleted = await batchRepository.Delete(request.BatchId);

            if (!deleted)
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            return(new DeleteBatchResponse());
        }
Esempio n. 15
0
        public async Task <GetBatchResponse> Get(GetBatchRequest request)
        {
            var batch = await batchRepository.Get(request.BatchId);

            if (batch == null)
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            return(batch.ConvertTo <GetBatchResponse>());
        }
Esempio n. 16
0
        public async Task <UpdateBatchResponse> Put(UpdateBatchRequest request)
        {
            var batch = request.ConvertTo <Batch>();

            var updated = await batchRepository.Update(batch);

            if (!updated)
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            return(new UpdateBatchResponse());
        }
Esempio n. 17
0
        public async Task <GetAllStepsResponse> Get(GetAllStepsRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var steps = await stepRepository.GetAll(request.BatchId);

            return(new GetAllStepsResponse
            {
                Steps = steps.ConvertTo <List <DomainModels.Step> >()
            });
        }
Esempio n. 18
0
        public async Task <GetBatchVariableResponse> Get(GetBatchVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var batchVariable = await batchRepository.GetBatchVariable(request.BatchId, request.VariableName);

            if (batchVariable == null)
            {
                throw Err.BatchVariableNotFound(request.VariableName);
            }

            return(batchVariable.ConvertTo <GetBatchVariableResponse>());
        }
Esempio n. 19
0
        public async Task <GetBatchArtifactResponse> Get(GetBatchArtifactRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var batchArtifact = await batchRepository.GetBatchArtifact(request.BatchId, request.ArtifactName);

            if (batchArtifact == null)
            {
                throw Err.BatchArtifactNotFound(request.ArtifactName);
            }

            return(batchArtifact.ConvertTo <GetBatchArtifactResponse>());
        }
Esempio n. 20
0
        public async Task <GetStepResponse> Get(GetStepRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            return(step.ConvertTo <GetStepResponse>());
        }
Esempio n. 21
0
        public async Task <GetAllBatchOptionResponse> Get(GetAllBatchOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var batchOptions = await batchRepository.GetAllBatchOptions(request.BatchId);

            var response = new GetAllBatchOptionResponse
            {
                Options = batchOptions.ConvertTo <List <DomainModels.Option> >()
            };

            return(response);
        }
Esempio n. 22
0
        public async Task <GetBatchOptionResponse> Get(GetBatchOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var batchOption = await batchRepository.GetBatchOption(request.BatchId, request.OptionName);

            if (batchOption == null)
            {
                throw Err.BatchOptionNotFound(request.OptionName);
            }

            return(batchOption.ConvertTo <GetBatchOptionResponse>());
        }
Esempio n. 23
0
        public async Task <CreateBatchArtifactResponse> Post(CreateBatchArtifactRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            if (await batchRepository.DoesBatchArtifactExist(request.BatchId, request.ArtifactName))
            {
                throw Err.BatchArtifactAlreadyExists(request.ArtifactName);
            }

            var batchArtifact = request.ConvertTo <BatchArtifact>();

            await batchRepository.CreateBatchArtifact(batchArtifact);

            return(new CreateBatchArtifactResponse());
        }
Esempio n. 24
0
        public async Task <CreateStepResponse> Post(CreateStepRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            if (await stepRepository.DoesStepExist(request.BatchId, request.StepName))
            {
                throw Err.StepAlreadyExists(request.StepName);
            }

            var step = request.ConvertTo <Step>();

            await stepRepository.Create(step);

            return(new CreateStepResponse());
        }
Esempio n. 25
0
        public async Task <UpdateStepResponse> Put(UpdateStepRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = request.ConvertTo <Step>();

            var updated = await stepRepository.Update(step);

            if (!updated)
            {
                throw Err.StepNotFound(request.StepName);
            }

            return(new UpdateStepResponse());
        }
Esempio n. 26
0
        public async Task <DeleteStepResponse> Delete(DeleteStepRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var step = await stepRepository.Get(request.BatchId, request.StepName);

            if (step == null)
            {
                throw Err.StepNotFound(request.StepName);
            }

            await stepRepository.Delete(step.Id);

            return(new DeleteStepResponse());
        }
Esempio n. 27
0
        public async Task <CreateBatchVariableResponse> Post(CreateBatchVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            if (await batchRepository.DoesBatchVariableExist(request.BatchId, request.VariableName))
            {
                throw Err.BatchVariableAlreadyExists(request.VariableName);
            }

            var batchVariable = request.ConvertTo <BatchVariable>();

            await batchRepository.CreateOrUpdateBatchVariable(batchVariable);

            return(new CreateBatchVariableResponse());
        }
Esempio n. 28
0
        public async Task <CreateBatchOptionResponse> Post(CreateBatchOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            if (await batchRepository.DoesBatchOptionExist(request.BatchId, request.OptionName))
            {
                throw Err.BatchOptionAlreadyExists(request.OptionName);
            }

            var batchOption = request.ConvertTo <BatchOption>();

            await batchRepository.CreateOrUpdateBatchOption(batchOption);

            return(new CreateBatchOptionResponse());
        }
Esempio n. 29
0
        public async Task <DeleteBatchOptionResponse> Delete(DeleteBatchOptionRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var existingBatchOption =
                await batchRepository.GetBatchOption(request.BatchId, request.OptionName);

            if (existingBatchOption == null)
            {
                throw Err.BatchOptionNotFound(request.OptionName);
            }

            await batchRepository.DeleteBatchOption(existingBatchOption.Id);

            return(new DeleteBatchOptionResponse());
        }
Esempio n. 30
0
        public async Task <DeleteBatchVariableResponse> Delete(DeleteBatchVariableRequest request)
        {
            if (!await batchRepository.DoesBatchExist(request.BatchId))
            {
                throw Err.BatchNotFound(request.BatchId);
            }

            var existingBatchVariable =
                await batchRepository.GetBatchVariable(request.BatchId, request.VariableName);

            if (existingBatchVariable == null)
            {
                throw Err.BatchVariableNotFound(request.VariableName);
            }

            await batchRepository.DeleteBatchVariable(existingBatchVariable.Id);

            return(new DeleteBatchVariableResponse());
        }