Commit 2f61e7c6 authored by Siiri Tann's avatar Siiri Tann
Browse files

TEIS-2082: added emailRecipient field to RoleDefinitionDto. Deleted deprecated...

TEIS-2082: added emailRecipient field to RoleDefinitionDto. Deleted deprecated class RoleDefinitionProcessingService.java.
parents 10264b1c 999dad90
...@@ -41,6 +41,7 @@ public class RoleDefinitionDto { ...@@ -41,6 +41,7 @@ public class RoleDefinitionDto {
private String excludedRoleOverlap; private String excludedRoleOverlap;
private Long defaultValidityPeriod; private Long defaultValidityPeriod;
private Boolean locationLink; private Boolean locationLink;
private Boolean emailRecipient;
private ObjectStatus objectStatus; private ObjectStatus objectStatus;
} }
package ee.sm.ti.teis.officegateway.role.definition; package ee.sm.ti.teis.officegateway.role.definition;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.officegateway.role.definition.privilege.dto.AdminRolePrivilegeDto; import ee.sm.ti.teis.officegateway.role.definition.privilege.dto.AdminRolePrivilegeDto;
import ee.sm.ti.teis.officegateway.role.definition.privilege.request.AdminPrivilegesRequest; import ee.sm.ti.teis.officegateway.role.definition.privilege.request.AdminPrivilegesRequest;
import ee.sm.ti.teis.officegateway.role.definition.request.CreateRoleDefinitionRequest; import ee.sm.ti.teis.officegateway.role.definition.request.CreateRoleDefinitionRequest;
...@@ -20,7 +21,7 @@ import java.util.UUID; ...@@ -20,7 +21,7 @@ import java.util.UUID;
@RequiredArgsConstructor @RequiredArgsConstructor
public class RoleDefinitionController extends TeisBaseController { public class RoleDefinitionController extends TeisBaseController {
private final RoleDefinitionProcessingService service; private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.roles.definition.post}", response = RoleDefinitionDto.class) @ApiOperation(value = "${teis.api.roles.definition.post}", response = RoleDefinitionDto.class)
@PostMapping @PostMapping
...@@ -28,7 +29,7 @@ public class RoleDefinitionController extends TeisBaseController { ...@@ -28,7 +29,7 @@ public class RoleDefinitionController extends TeisBaseController {
CreateRoleDefinitionRequest request = new CreateRoleDefinitionRequest(); CreateRoleDefinitionRequest request = new CreateRoleDefinitionRequest();
request.setPayload(dto, requestMetaDTO); request.setPayload(dto, requestMetaDTO);
return service.create(request); return (RoleDefinitionDto) service.sendAndReceive(request);
} }
@ApiOperation(value = "${teis.api.roles.definition.put}", response = RoleDefinitionDto.class) @ApiOperation(value = "${teis.api.roles.definition.put}", response = RoleDefinitionDto.class)
...@@ -39,16 +40,16 @@ public class RoleDefinitionController extends TeisBaseController { ...@@ -39,16 +40,16 @@ public class RoleDefinitionController extends TeisBaseController {
dto.setId(id); dto.setId(id);
request.setPayload(dto, requestMetaDTO); request.setPayload(dto, requestMetaDTO);
return service.update(request); return (RoleDefinitionDto) service.sendAndReceive(request);
} }
@ApiOperation(value = "${teis.api.roles.definition.delete}", response = RoleDefinitionDto.class) @ApiOperation(value = "${teis.api.roles.definition.delete}")
@DeleteMapping("{id}") @DeleteMapping("{id}")
public void delete(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) { public void delete(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
DeleteRoleDefinitionRequest request = new DeleteRoleDefinitionRequest(); DeleteRoleDefinitionRequest request = new DeleteRoleDefinitionRequest();
request.setPayload(id, requestMetaDTO); request.setPayload(id, requestMetaDTO);
service.delete(request); service.sendAndReceive(request);
} }
@ApiOperation(value = "${teis.api.roles.definition.privileges-for-admin}", response = PrivilegeDto.class) @ApiOperation(value = "${teis.api.roles.definition.privileges-for-admin}", response = PrivilegeDto.class)
...@@ -57,6 +58,6 @@ public class RoleDefinitionController extends TeisBaseController { ...@@ -57,6 +58,6 @@ public class RoleDefinitionController extends TeisBaseController {
AdminPrivilegesRequest request = new AdminPrivilegesRequest(); AdminPrivilegesRequest request = new AdminPrivilegesRequest();
request.setPayload(id, requestMetaDTO); request.setPayload(id, requestMetaDTO);
return service.getAdminPrivileges(request); return (List<AdminRolePrivilegeDto>) service.sendAndReceive(request);
} }
} }
package ee.sm.ti.teis.officegateway.role.definition;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.officegateway.role.definition.privilege.dto.AdminRolePrivilegeDto;
import ee.sm.ti.teis.officegateway.role.definition.privilege.request.AdminPrivilegesRequest;
import ee.sm.ti.teis.officegateway.role.definition.privilege.response.AdminPrivilegesResponse;
import ee.sm.ti.teis.officegateway.role.definition.request.CreateRoleDefinitionRequest;
import ee.sm.ti.teis.officegateway.role.definition.request.DeleteRoleDefinitionRequest;
import ee.sm.ti.teis.officegateway.role.definition.request.UpdateRoleDefinitionRequest;
import ee.sm.ti.teis.officegateway.role.definition.response.CreateRoleDefinitionResponse;
import ee.sm.ti.teis.officegateway.role.definition.response.DeleteRoleDefinitionResponse;
import ee.sm.ti.teis.officegateway.role.definition.response.UpdateRoleDefinitionResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Deprecated(since = "1.19.0-SNAPSHOT", forRemoval = true)
@RequiredArgsConstructor
public class RoleDefinitionProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public RoleDefinitionDto create(CreateRoleDefinitionRequest request) {
CreateRoleDefinitionResponse response =
(CreateRoleDefinitionResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public RoleDefinitionDto update(UpdateRoleDefinitionRequest request) {
UpdateRoleDefinitionResponse response =
(UpdateRoleDefinitionResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public void delete(DeleteRoleDefinitionRequest request) {
DeleteRoleDefinitionResponse response =
(DeleteRoleDefinitionResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
response.processResponse();
return;
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public List<AdminRolePrivilegeDto> getAdminPrivileges(AdminPrivilegesRequest request) {
AdminPrivilegesResponse result = (AdminPrivilegesResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (result != null) {
return result.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
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