Commit 32d97980 authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Enriko Käsper

See merge request teis/common-api-gateway!138
parents 6952c66f c5758301
......@@ -9,7 +9,8 @@ public enum FileObjectType {
PROCEDURAL_ACT("procedural-acts"),
VIOLATION_ACT("violation-acts"),
RISK_FACTOR("risk-factors"),
RISK_ASSESSMENT("risk-assessments");
RISK_ASSESSMENT("risk-assessments"),
RISK_STATEMENT_ASSESSMENT("risk-statement-assessments");
private final String displayName;
......
package ee.sm.ti.teis.commongateway.representative.authoritypermission;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.AuthorityPermissionExistsDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.ValidatedAuthorityDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.ValidateAuthorityPermissionRequest;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.response.ValidateAuthorityPermissionResponse;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
......@@ -14,7 +14,7 @@ public class AuthorityPermissionProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public AuthorityPermissionExistsDto validate(ValidateAuthorityPermissionRequest request) {
public ValidatedAuthorityDto validate(ValidateAuthorityPermissionRequest request) {
ValidateAuthorityPermissionResponse response =
(ValidateAuthorityPermissionResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
......
package ee.sm.ti.teis.commongateway.representative.authoritypermission;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.AuthorityPermissionExistsDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.ValidateAuthorityPermissionDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.ValidatedAuthorityDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.ValidateAuthorityPermissionRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
......@@ -27,14 +27,14 @@ public class AuthorityPermissionTestController extends TeisBaseController {
private final AuthorityPermissionProcessingService service;
@ApiOperation(value = "${teis.api.representatives.authority-permissions.validate}", response = AuthorityPermissionExistsDto.class)
@ApiOperation(value = "${teis.api.representatives.authority-permissions.validate}", response = ValidatedAuthorityDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele")})
@GetMapping("validate")
public AuthorityPermissionExistsDto validate(@RequestParam(name = "personId", required = true) UUID personId,
@RequestParam(name = "grantorId", required = true) UUID grantorId,
@RequestParam(name = "authorityType", required = true) AuthorityType authorityType,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
public ValidatedAuthorityDto validate(@RequestParam(name = "personId", required = true) UUID personId,
@RequestParam(name = "grantorId", required = true) UUID grantorId,
@RequestParam(name = "authorityType", required = true) AuthorityType authorityType,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
ValidateAuthorityPermissionRequest request = new ValidateAuthorityPermissionRequest();
ValidateAuthorityPermissionDto dto = ValidateAuthorityPermissionDto.builder()
.personId(personId)
......
package ee.sm.ti.teis.commongateway.riskassessments.riskfactordetailsassessment;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto.AssessRiskFactorDetailAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto.AssessedRiskFactorDetailsAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.request.AssessRiskFactorDetailAssessmentPublicRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
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 springfox.documentation.annotations.ApiIgnore;
import java.util.UUID;
@RestController
@RequestMapping("risk-assessments/risk-factor-details-assessment")
@RequiredArgsConstructor
public class RiskFactorDetailsAssessmentController extends TeisBaseController {
private final RiskFactorDetailsAssessmentProcessingService service;
@ApiOperation(value = "${teis.api.risk-assessments.risk-factor-details.assess}", response = AssessedRiskFactorDetailsAssessmentPublicDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal puudub nõutav privileeg."),
@ApiResponse(code = 404, message = "Sisendis viidatud objekti ei eksisteeri.")})
@PatchMapping("{id}/assessment")
public AssessedRiskFactorDetailsAssessmentPublicDto assess(@PathVariable UUID id,
@RequestBody AssessRiskFactorDetailAssessmentPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
AssessRiskFactorDetailAssessmentPublicRequest request = new AssessRiskFactorDetailAssessmentPublicRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
return service.assess(request);
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskfactordetailsassessment;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.dto.AssessedRiskFactorDetailsAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.request.AssessRiskFactorDetailAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactordetails.response.AssessRiskFactorDetailAssessmentPublicResponse;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class RiskFactorDetailsAssessmentProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public AssessedRiskFactorDetailsAssessmentPublicDto assess(AssessRiskFactorDetailAssessmentPublicRequest request) {
AssessRiskFactorDetailAssessmentPublicResponse response =
(AssessRiskFactorDetailAssessmentPublicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request.CreateRiskIndicatorValuePublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request.DeleteRiskIndicatorValuePublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request.UpdateRiskIndicatorValuePublicRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
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 springfox.documentation.annotations.ApiIgnore;
import java.util.UUID;
@RestController
@RequestMapping("risk-assessments/risk-indicator-values")
@RequiredArgsConstructor
public class RiskIndicatorValueController extends TeisBaseController {
private final RiskIndicatorValueProcessingService service;
@ApiOperation(value = "${teis.api.risk-assessments.risk-indicator-value.create}", response = RiskIndicatorValuePublicDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal puudub nõutav privileeg."),
@ApiResponse(code = 404, message = "Sisendis viidatud objekti ei eksisteeri")})
@PostMapping
public RiskIndicatorValuePublicDto create(@RequestBody RiskIndicatorValuePublicDto dto, @ApiIgnore RequestMetaDTO requestMetaDTO) {
CreateRiskIndicatorValuePublicRequest request = new CreateRiskIndicatorValuePublicRequest();
request.setPayload(dto, requestMetaDTO);
return service.create(request);
}
@ApiOperation(value = "${teis.api.risk-assessments.risk-indicator-value.update}", response = RiskIndicatorValuePublicDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal puudub nõutav privileeg."),
@ApiResponse(code = 404, message = "Sisendis viidatud objekti ei eksisteeri")})
@PutMapping("{id}")
public RiskIndicatorValuePublicDto update(@PathVariable UUID id, @RequestBody RiskIndicatorValuePublicDto dto, @ApiIgnore RequestMetaDTO requestMetaDTO) {
UpdateRiskIndicatorValuePublicRequest request = new UpdateRiskIndicatorValuePublicRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
return service.update(request);
}
@ApiOperation(value = "${teis.api.risk-assessments.risk-indicator-value.delete}")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal puudub nõutav privileeg või ei ole õigust muuta seda riskianalüüsi."),
@ApiResponse(code = 404, message = "Mõõdetava näitaja väärtuse andmeobjekti ei leitud.")})
@DeleteMapping("{id}")
public void delete(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
DeleteRiskIndicatorValuePublicRequest request = new DeleteRiskIndicatorValuePublicRequest();
request.setPayload(id, requestMetaDTO);
service.delete(request);
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.dto.RiskIndicatorValuePublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request.CreateRiskIndicatorValuePublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request.DeleteRiskIndicatorValuePublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.request.UpdateRiskIndicatorValuePublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.response.CreateRiskIndicatorValuePublicResponse;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.response.DeleteRiskIndicatorValuePublicResponse;
import ee.sm.ti.teis.commongateway.riskassessments.riskindicatorvalue.response.UpdateRiskIndicatorValuePublicResponse;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class RiskIndicatorValueProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public RiskIndicatorValuePublicDto create(CreateRiskIndicatorValuePublicRequest request) {
CreateRiskIndicatorValuePublicResponse response =
(CreateRiskIndicatorValuePublicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public RiskIndicatorValuePublicDto update(UpdateRiskIndicatorValuePublicRequest request) {
UpdateRiskIndicatorValuePublicResponse response =
(UpdateRiskIndicatorValuePublicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public void delete(DeleteRiskIndicatorValuePublicRequest request) {
DeleteRiskIndicatorValuePublicResponse response =
(DeleteRiskIndicatorValuePublicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
response.processResponse();
return;
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
......@@ -25,7 +25,6 @@ public class RiskStatementAssessmentController extends TeisBaseController {
private final RiskStatementAssessmentProcessingService service;
@ApiOperation(value = "${teis.api.risk-assessments.risk-statement-assessment.patch}",
response = RiskStatementAssessmentPublicDto.class)
@ApiResponses(value = {
......@@ -33,9 +32,9 @@ public class RiskStatementAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@PatchMapping("{id}/assessment")
public RiskStatementAssessmentPublicDto updateAssessment(@PathVariable UUID id,
@RequestBody RiskStatementAssessmentPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
public RiskStatementAssessmentPublicDto update(@PathVariable UUID id,
@RequestBody RiskStatementAssessmentPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
PatchRiskStatementAssessmentPublicRequest request = new PatchRiskStatementAssessmentPublicRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
......@@ -50,8 +49,8 @@ public class RiskStatementAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@PostMapping
public RiskStatementAssessmentPublicDto createAssessment(@RequestBody CreateRiskStatementAssessmentPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
public RiskStatementAssessmentPublicDto create(@RequestBody CreateRiskStatementAssessmentPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
CreateRiskStatementAssessmentPublicRequest request = new CreateRiskStatementAssessmentPublicRequest();
request.setPayload(dto, requestMetaDTO);
......@@ -64,7 +63,7 @@ public class RiskStatementAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@DeleteMapping("{id}")
public void deleteAssessment(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void delete(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
DeleteRiskStatementAssessmentPublicRequest request = new DeleteRiskStatementAssessmentPublicRequest();
request.setPayload(id, requestMetaDTO);
......
......@@ -143,4 +143,10 @@ teis.api.risk-assessments.risk-statement-assessment.patch-description: Teenus sa
teis.api.risk-assessments.risk-statement-assessment.create: Teenus salvestab täiendava abinõu rakendamise andmed. Teenust kasutab iseteenindus, et salvestada kasutaja sisestatud täiendava abinõu rakendamise andmed.
teis.api.risk-assessments.risk-statement-assessment.delete: Teenus kustutab abinõu rakendamise väite kohta antud vastuse. Teenust kasutab iseteenindus, et kasutaja saaks kustutada ekslikult lisatud andmeobjekti.
teis.api.representatives.authority-permissions.validate: Test-teenus võimaldab kontrollida, kas ettevõttel on ligipääsu õigus teatud ettevõtte andmetele (nt kas töötervishoiu arst omab ligipääsu teatud ettevõtte andmetele).
teis.api.representatives.authority-permissions.validate: Test-teenus võimaldab kontrollida, kas ettevõttel on ligipääsu õigus teatud ettevõtte andmetele (nt kas töötervishoiu arst omab ligipääsu teatud ettevõtte andmetele).
teis.api.risk-assessments.risk-indicator-value.create: Teenus salvestab mõõdetava näitaja väärtuse.
teis.api.risk-assessments.risk-indicator-value.update: Teenus salvestab mõõdetava näitaja väärtuse muudatuse.
teis.api.risk-assessments.risk-indicator-value.delete: Teenus kustutab mõõdetava näitaja väärtuse.
teis.api.risk-assessments.risk-factor-details.assess: Teenus salvestab ohu täpsustuse vastuse. Kui on kirjeldatud ohtude seos ja vastus on jaatav, siis lisatakse uus oht.
theGroup=ee.sm.ti.teis
//commonApiGatewayVersion=forSearch ^commonApiGatewayVersion=.*?-SNAPSHOT
theVersion=1.11.0
commonsVersion=1.11.0
theVersion=1.12.0
commonsVersion=1.12.0
pluginVersion=1.1.1
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