Commit 4bc54cbf authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge remote-tracking branch 'origin/develop' into develop

parents dd582723 27d939fb
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto;
import ee.sm.ti.teis.commongateway.riskassessments.businesstype.dto.AssessedBusinessTypePublicDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CopyRiskAssessmentDto {
private RiskAssessmentPublicDto riskAssessment;
private List<AssessedBusinessTypePublicDto> assessedBusinessType;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.CopyRiskAssessmentDto;
public class CopyRiskAssessmentPublicRequest extends AbstractDTO<CopyRiskAssessmentDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CopyRiskAssessmentPublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.RiskAssessmentPublicDto;
public class CopyRiskAssessmentPublicResponse extends AbstractDTO<RiskAssessmentPublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CopyRiskAssessmentPublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.*;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.CopyRiskAssessmentDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.CreateRiskAssessmentDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.RiskAssessmentConclusionDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.RiskAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.UpdateRiskAssessmentStatusDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.UpdateRiskAssessmentTitleDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.request.*;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
......@@ -8,7 +13,15 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
......@@ -33,6 +46,19 @@ public class RiskAssessmentController extends TeisBaseController {
return service.create(request);
}
@ApiOperation(value = "${teis.api.risk-assessments.risk-assessment.copy}", response = RiskAssessmentPublicDto.class)
@ApiResponses(value = {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@PostMapping("{id}/copy")
public RiskAssessmentPublicDto copy(@PathVariable UUID id, @RequestBody CopyRiskAssessmentDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
CopyRiskAssessmentPublicRequest request = new CopyRiskAssessmentPublicRequest();
dto.getRiskAssessment().setId(id);
request.setPayload(dto, requestMetaDTO);
return service.copy(request);
}
@ApiOperation(value = "${teis.api.risk-assessments.risk-assessment.get}", response = RiskAssessmentPublicDto.class)
@ApiResponses(value = {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
......
......@@ -107,4 +107,13 @@ public class RiskAssessmentProcessingService {
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
}
public RiskAssessmentPublicDto copy(CopyRiskAssessmentPublicRequest request) {
CopyRiskAssessmentPublicResponse response =
(CopyRiskAssessmentPublicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
......@@ -135,6 +135,7 @@ teis.api.risk-assessments.risk-assessment.update-status: Teenus muudab riskianal
teis.api.risk-assessments.risk-assessment.get-by-id: Teenus väljastab riskianalüüsi andmeobjekti.
teis.api.risk-assessments.risk-assessment.get-risk-factor-assessments: Teenus väljastab riskianalüüsi raames antud ohu hinnangute andmed oos hinnatavate ohtude kirjeldustega.
teis.api.risk-assessments.risk-assessment.delete: Teenus kustutab riskianalüüsi. Teenust kasutab iseteenindus, et kustutada ekslikult loodud riskianalüüs. Kustutada ei saa kinnitatud riskianalüüsi.
teis.api.risk-assessments.risk-assessment.copy: Teenus loob uue riskianalüüsi olemasoleva riskianalüüsi kopeerimise teel.
teis.api.risk-assessments.risk-statement-assessment.patch: Teenus salvestab abinõu rakendamise vastuse (kas abinõu on rakendatud). Teenust kasutab iseteenindus, et salvestada kasutaja tehtud valikud.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment