Commit 1179c8c3 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!153
parents 92c7b2f6 babd1c34
package ee.sm.ti.teis.commongateway.file;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.errors.CommonErrorCode;
import ee.sm.ti.teis.exceptions.TeisResourceNotFoundException;
import ee.sm.ti.teis.exceptions.TeisRestException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.minio.MinioClient;
import io.minio.ObjectStat;
import io.minio.errors.ErrorResponseException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.UUID;
import static org.springframework.http.HttpStatus.NO_CONTENT;
@Service
@RequiredArgsConstructor
@Slf4j
public class ThumbnailService {
private static final String THUMBNAIL_SIZE_100 = "100";
private final FileProcessingService fileProcessingService;
private final MinioClient minioClient;
@Value("${minio.bucket-thumbnail}")
private String bucketNameThumbnail;
void getThumbnailFileFromStorage(String objectId, String fileId, HttpServletResponse response,
String objectType, RequestMetaDTO requestMetaDTO) throws Exception {
log.info("Thumbnail retrieval from storage initiated for file ID: {}", fileId);
FileMetadataDto dto = fileProcessingService.getFile(UUID.fromString(objectId), UUID.fromString(fileId),
objectType, requestMetaDTO);
validateThumbnail(dto);
String thumbnailFileId = dto.getThumbnails().get(THUMBNAIL_SIZE_100);
try {
final ObjectStat objectStat = minioClient.statObject(bucketNameThumbnail, thumbnailFileId);
response.addHeader("Content-disposition", "attachment;filename=" + thumbnailFileId + ".jpg");
response.setContentType(objectStat.contentType());
} catch (ErrorResponseException e) {
log.error("Thumbnail file not found with ID: {}", thumbnailFileId, e);
throw new TeisResourceNotFoundException("Thumbnail file not found from storage");
}
IOUtils.copy(minioClient.getObject(bucketNameThumbnail, thumbnailFileId), response.getOutputStream());
response.flushBuffer();
}
private void validateThumbnail(FileMetadataDto dto) {
boolean hasThumbnail = dto.getThumbnails() != null && dto.getThumbnails().containsKey(THUMBNAIL_SIZE_100);
if (!hasThumbnail) {
ErrorDTO contentNotFound = new ErrorDTO();
contentNotFound.setMessage("Thumbnail file not found.");
contentNotFound.setCode(CommonErrorCode.NO_CONTENT.getCode());
contentNotFound.setHttpResponse(NO_CONTENT);
throw new TeisRestException(contentNotFound);
}
}
}
......@@ -5,7 +5,6 @@ import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.UUID;
......@@ -23,7 +22,7 @@ public class LocationController extends TeisBaseController {
@ApiImplicitParams(
@ApiImplicitParam(name = "id", value = "${teis.api.messages.get-location-id}"))
@GetMapping("{id}")
public LocationDto getLocation(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public LocationDto getLocation(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
LocationRequest request = new LocationRequest();
request.setPayload(id, requestMetaDTO);
......@@ -36,7 +35,7 @@ public class LocationController extends TeisBaseController {
@ApiImplicitParams(
@ApiImplicitParam(name = "employerId", value = "${teis.api.messages.get-location-employerId}"))
@GetMapping
public List<LocationDto> getLocations(@RequestParam(name = "employerId") UUID employerId, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<LocationDto> getLocations(@RequestParam(name = "employerId") UUID employerId, RequestMetaDTO requestMetaDTO) {
LocationsRequest request = new LocationsRequest();
request.setPayload(employerId, requestMetaDTO);
......@@ -48,7 +47,7 @@ public class LocationController extends TeisBaseController {
@ApiResponse(code = 404, message = "Sisendis viidatud isikut ei eksisteeri."),
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele (puuduvad kohustuslikud väärtused).")})
@PostMapping
public LocationDto create(@RequestBody LocationDto location, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public LocationDto create(@RequestBody LocationDto location, RequestMetaDTO requestMetaDTO) {
CreateLocationRequest request = new CreateLocationRequest();
request.setPayload(new CreateLocationRequest.Parameters(location), requestMetaDTO);
......@@ -62,7 +61,7 @@ public class LocationController extends TeisBaseController {
@ApiImplicitParams(
@ApiImplicitParam(name = "id", value = "${teis.api.messages.put-location-id}", required = true))
@PutMapping("{id}")
public LocationDto update(@PathVariable UUID id, @RequestBody LocationDto location, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public LocationDto update(@PathVariable UUID id, @RequestBody LocationDto location, RequestMetaDTO requestMetaDTO) {
UpdateLocationRequest request = new UpdateLocationRequest();
location.setId(id);
request.setPayload(new UpdateLocationRequest.Parameters(location), requestMetaDTO);
......@@ -76,7 +75,7 @@ public class LocationController extends TeisBaseController {
@ApiImplicitParams(
@ApiImplicitParam(name = "id", value = "${teis.api.messages.delete-location-id}"))
@DeleteMapping("{id}")
public void delete(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void delete(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
DeleteLocationRequest request = new DeleteLocationRequest();
request.setPayload(id, requestMetaDTO);
......@@ -90,7 +89,7 @@ public class LocationController extends TeisBaseController {
@ApiImplicitParams(
@ApiImplicitParam(name = "employerId", value = "${teis.api.messages.post-locations-employerId}"))
@PostMapping(path = "fromTor/{employerId}")
public void createLocationsFromTor(@PathVariable(name = "employerId") UUID employerId, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void createLocationsFromTor(@PathVariable(name = "employerId") UUID employerId, RequestMetaDTO requestMetaDTO) {
CreateLocationsRequest request = new CreateLocationsRequest();
request.setPayload(employerId, requestMetaDTO);
......
......@@ -5,6 +5,7 @@ import ee.sm.ti.teis.commongateway.messages.message.dto.MessageDto;
import ee.sm.ti.teis.commongateway.messages.message.dto.MessageWithEmployerDto;
import ee.sm.ti.teis.commongateway.messages.message.dto.PatchMessageDto;
import ee.sm.ti.teis.commongateway.messages.message.request.*;
import ee.sm.ti.teis.commongateway.messages.message.request.MessagesRequest.Parameters;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
......@@ -12,7 +13,6 @@ 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.List;
import java.util.UUID;
......@@ -28,9 +28,10 @@ public class MessageController extends TeisBaseController {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele")})
@GetMapping(value = "{dataObjectId}")
public List<MessageDto> getMessages(@PathVariable UUID dataObjectId, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<MessageDto> getMessages(@PathVariable UUID dataObjectId, @RequestParam(required = false) String contextType,
RequestMetaDTO requestMetaDTO) {
MessagesRequest request = new MessagesRequest();
request.setPayload(dataObjectId, requestMetaDTO);
request.setPayload(new Parameters(dataObjectId, contextType), requestMetaDTO);
return service.getMessages(request);
}
......@@ -41,7 +42,7 @@ public class MessageController 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}")
public MessageDto patch(@PathVariable UUID id, @RequestBody PatchMessageDto dto, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public MessageDto patch(@PathVariable UUID id, @RequestBody PatchMessageDto dto, RequestMetaDTO requestMetaDTO) {
PatchMessageRequest request = new PatchMessageRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
......@@ -55,7 +56,7 @@ public class MessageController 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 MessageDto create(@RequestBody CreateMessageDto dto, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public MessageDto create(@RequestBody CreateMessageDto dto, RequestMetaDTO requestMetaDTO) {
CreateMessageRequest request = new CreateMessageRequest();
request.setPayload(dto, requestMetaDTO);
......@@ -68,7 +69,7 @@ public class MessageController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@DeleteMapping(value = "{id}")
public void delete(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void delete(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
DeleteMessageRequest request = new DeleteMessageRequest();
request.setPayload(id, requestMetaDTO);
......@@ -82,9 +83,10 @@ public class MessageController extends TeisBaseController {
public List<MessageWithEmployerDto> getMessagesByAddressee(
@RequestParam(value = "employerId", required = false) UUID employerId,
@RequestParam(value = "officialUserId", required = false) UUID officialUserId,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
@RequestParam(required = false) String contextType,
RequestMetaDTO requestMetaDTO) {
MessagesByAddresseeRequest request = new MessagesByAddresseeRequest();
request.setPayload(new MessagesByAddresseeRequest.Parameters(employerId, officialUserId), requestMetaDTO);
request.setPayload(new MessagesByAddresseeRequest.Parameters(employerId, officialUserId, contextType), requestMetaDTO);
return service.getMessagesByAddressee(request);
}
......
......@@ -85,4 +85,14 @@ public class MessageProcessingService {
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public MessageDto getMessage(MessageRequest request) {
MessageResponse response =
(MessageResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.messages.message;
import ee.sm.ti.teis.commongateway.messages.message.dto.MessageDto;
import ee.sm.ti.teis.commongateway.messages.message.request.MessageRequest;
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.context.annotation.Profile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@RestController
@RequestMapping("messages/test")
@Profile({"dev", "test", "local", "integtest"})
@RequiredArgsConstructor
public class MessageTestController extends TeisBaseController {
private final MessageProcessingService service;
@ApiOperation(value = "${teis.api.messages.message.get-message}", response = MessageDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@GetMapping(value = "{id}")
public MessageDto getMessage(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
MessageRequest request = new MessageRequest();
request.setPayload(id, requestMetaDTO);
return service.getMessage(request);
}
}
......@@ -7,7 +7,6 @@ import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Set;
......@@ -22,7 +21,7 @@ public class ParameterController extends TeisBaseController {
@ApiOperation(value = "${teis.api.parameters.get}", response = ParameterDto.class)
@GetMapping
public Set<ParameterDto> getParameters(@ApiIgnore RequestMetaDTO requestMetaDTO) {
public Set<ParameterDto> getParameters( RequestMetaDTO requestMetaDTO) {
ParametersRequest request = new ParametersRequest();
request.setPayload(COMMON, requestMetaDTO);
......
package ee.sm.ti.teis.commongateway.parameter;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.types.enums.ScopeType;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@Service
@RequiredArgsConstructor
public class ParameterProcessingService {
private final RabbitTemplate gwRabbitTemplate;
private final ConcurrentHashMap<ScopeType, Set<ParameterDto>> cache = new ConcurrentHashMap<>();
public Set<ParameterDto> getParameters(ParametersRequest request) {
if (cache.containsKey(request.getPayload())) {
return cache.get(request.getPayload());
}
ParametersResponse response =
(ParametersResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
Set<ParameterDto> parameters = response.processResponse();
cache.put(request.getPayload(), parameters);
return parameters;
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
@Scheduled(fixedRateString = "${teis.parameter.cache-duration:PT30S}")
public void clearCache() {
cache.clear();
}
}
......@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.UUID;
......@@ -32,7 +31,7 @@ public class ClaimController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@GetMapping
public ClaimsDto getClaims(ClaimSearchFilterDto searchFilterDto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
ClaimsRequest request = new ClaimsRequest();
request.setPayload(new ClaimsRequest.Parameters(searchFilterDto), requestMetaDTO);
......@@ -45,7 +44,7 @@ public class ClaimController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@GetMapping(value = "{id}")
public ClaimDto getClaim(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public ClaimDto getClaim(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
ClaimRequest request = new ClaimRequest();
request.setPayload(id, requestMetaDTO);
......
......@@ -13,7 +13,6 @@ import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.UUID;
......@@ -30,7 +29,7 @@ public class ClaimTestController extends TeisBaseController {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@PostMapping
public ClaimDto create(@RequestBody ClaimDto dto, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public ClaimDto create(@RequestBody ClaimDto dto, RequestMetaDTO requestMetaDTO) {
CreateClaimRequest request = new CreateClaimRequest();
request.setPayload(dto, requestMetaDTO);
......@@ -40,7 +39,7 @@ public class ClaimTestController extends TeisBaseController {
@ApiOperation(value = "${teis.api.payments.patch-claim}")
@ApiResponses(value = {@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele")})
@PatchMapping
public void patch(@RequestBody PatchClaimDto dto, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void patch(@RequestBody PatchClaimDto dto, RequestMetaDTO requestMetaDTO) {
PatchClaimRequest request = new PatchClaimRequest();
request.setPayload(dto, requestMetaDTO);
......@@ -50,7 +49,7 @@ public class ClaimTestController extends TeisBaseController {
@ApiOperation(value = "${teis.api.payments.delete-claim}")
@ApiResponses(value = {@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele")})
@DeleteMapping
public void delete(@RequestParam(required = false) UUID claimId, @RequestParam(required = false) UUID dataObjectId, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void delete(@RequestParam(required = false) UUID claimId, @RequestParam(required = false) UUID dataObjectId, RequestMetaDTO requestMetaDTO) {
DeleteClaimRequest request = new DeleteClaimRequest();
request.setPayload(new DeleteClaimRequest.Parameters(claimId, dataObjectId), requestMetaDTO);
......
......@@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.GetMapping;
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 javax.validation.constraints.Max;
import javax.validation.constraints.Min;
......@@ -29,7 +28,7 @@ public class LegalPersonController extends TeisBaseController {
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public PersonDto getLegalPerson(@RequestParam(name = "regCode") @Min(1) @Max(999999999) BigInteger regCode,
@RequestParam(name = "name", required = false) @Size(min = 2) String name,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
GetOrCreatePersonRequest request = new GetOrCreatePersonRequest();
request.setPayload(new GetOrCreatePersonRequest.Parameters(String.valueOf(regCode), name), requestMetaDTO);
return personProcessingService.getLegalPerson(request);
......
......@@ -7,7 +7,6 @@ import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
......@@ -22,7 +21,7 @@ public class PersonController extends TeisBaseController {
@ApiResponses(value = { @ApiResponse(code = 404, message = "Sisendis esitatud andmetega isikut ei eksisteeri") })
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.get-person-default-id}", required = true))
@GetMapping(value = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public PersonDto getPerson(@PathVariable(name = "id") String id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public PersonDto getPerson(@PathVariable(name = "id") String id, RequestMetaDTO requestMetaDTO) {
PersonRequest request = new PersonRequest();
request.setPayload(new PersonRequest.Parameters(id), requestMetaDTO);
......@@ -37,7 +36,7 @@ public class PersonController extends TeisBaseController {
@ApiImplicitParam(name = "individualPerson.idCode", value = "${teis.api.messages.get-persons-default-individual-person-idcode}")
})
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public List<PersonDto> getPersons(PersonSearchFilterDto personFilter, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<PersonDto> getPersons(PersonSearchFilterDto personFilter, RequestMetaDTO requestMetaDTO) {
PersonsRequest request = new PersonsRequest();
request.setPayload(new PersonsRequest.Parameters(personFilter), requestMetaDTO);
......@@ -46,7 +45,7 @@ public class PersonController extends TeisBaseController {
@ApiOperation(value = "${teis.api.messages.post-person}", response = PersonDto.class)
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public PersonDto createPerson(@RequestBody PersonDto person, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public PersonDto createPerson(@RequestBody PersonDto person, RequestMetaDTO requestMetaDTO) {
CreatePersonRequest request = new CreatePersonRequest();
request.setPayload(new CreatePersonRequest.Parameters(person), requestMetaDTO);
......
......@@ -7,7 +7,6 @@ import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.UUID;
......@@ -25,7 +24,7 @@ public class PersonTestController extends TeisBaseController {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele")})
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.put-person-id}", required = true))
@PutMapping(value = "{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public PersonDto updatePerson(@PathVariable(name = "id") String id, @RequestBody PersonDto person, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public PersonDto updatePerson(@PathVariable(name = "id") String id, @RequestBody PersonDto person, RequestMetaDTO requestMetaDTO) {
UpdatePersonRequest request = new UpdatePersonRequest();
person.setId(UUID.fromString(id));
request.setPayload(new UpdatePersonRequest.Parameters(person), requestMetaDTO);
......
......@@ -7,7 +7,6 @@ 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.List;
......@@ -24,7 +23,7 @@ public class ProceduralActController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega andmeobjekti ei eksisteeri")})
@GetMapping
public List<ProceduralActPublicDto> getProceduralActs(@RequestParam(value = "proceedingId") String id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<ProceduralActPublicDto> getProceduralActs(@RequestParam(value = "proceedingId") String id, RequestMetaDTO requestMetaDTO) {
ProceduralActsPublicRequest request = new ProceduralActsPublicRequest();
request.setPayload(new ProceduralActsPublicRequest.Parameters(id), requestMetaDTO);
......@@ -37,7 +36,7 @@ public class ProceduralActController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega andmeobjekti ei eksisteeri")})
@GetMapping(value = "{proceduralActId}")
public ProceduralActPublicDto getProceduralAct(@PathVariable(value = "proceduralActId") String id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public ProceduralActPublicDto getProceduralAct(@PathVariable(value = "proceduralActId") String id, RequestMetaDTO requestMetaDTO) {
ProceduralActPublicRequest request = new ProceduralActPublicRequest();
request.setPayload(new ProceduralActPublicRequest.Parameters(id), requestMetaDTO);
......
......@@ -10,7 +10,6 @@ import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
......@@ -29,7 +28,7 @@ public class ProceedingController extends TeisBaseController {
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.get-proceeding-id}"))
@GetMapping(value = "{id}", produces = APPLICATION_JSON_VALUE)
public ProceedingPublicDto getProceeding(@PathVariable String id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public ProceedingPublicDto getProceeding(@PathVariable String id, RequestMetaDTO requestMetaDTO) {
ProceedingPublicRequest request = new ProceedingPublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -41,7 +40,7 @@ public class ProceedingController extends TeisBaseController {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@GetMapping(produces = APPLICATION_JSON_VALUE)
public List<ProceedingPublicDto> getProceedings(@RequestParam String legalPersonId, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<ProceedingPublicDto> getProceedings(@RequestParam String legalPersonId, RequestMetaDTO requestMetaDTO) {
ProceedingsPublicRequest request = new ProceedingsPublicRequest();
request.setPayload(legalPersonId, requestMetaDTO);
......@@ -55,7 +54,7 @@ public class ProceedingController extends TeisBaseController {
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.get-proceeding-id}"))
@GetMapping(value = "{id}/message-permissions")
public List<MessagePermissionDto> getMessagePermission(@PathVariable String id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<MessagePermissionDto> getMessagePermission(@PathVariable String id, RequestMetaDTO requestMetaDTO) {
MessagePermissionRequest request = new MessagePermissionRequest();
request.setPayload(id, requestMetaDTO);
......
......@@ -12,7 +12,6 @@ import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.UUID;
......@@ -32,7 +31,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega andmeobjekti ei eksisteeri")})
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.get-proceeding-inspection-item-id}"))
@GetMapping(value = "proceedings/{id}/inspection-documents", produces = APPLICATION_JSON_VALUE)
public List<ProceedingInspectionDocumentPublicDto> getDocuments(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<ProceedingInspectionDocumentPublicDto> getDocuments(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
ProceedingInspectionDocumentsPublicRequest request = new ProceedingInspectionDocumentsPublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -45,7 +44,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega andmeobjekti ei eksisteeri")})
@PostMapping(value = "proceedings/{id}/inspection-documents", produces = APPLICATION_JSON_VALUE)
public ProceedingInspectionDocumentPublicDto createDocument(@PathVariable UUID id, @RequestBody ClassifierItemLightDto document, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public ProceedingInspectionDocumentPublicDto createDocument(@PathVariable UUID id, @RequestBody ClassifierItemLightDto document, RequestMetaDTO requestMetaDTO) {
CreateProceedingInspectionDocumentPublicRequest request = new CreateProceedingInspectionDocumentPublicRequest();
CreateProceedingInspectionDocumentPublicRequest.Parameters payload = new CreateProceedingInspectionDocumentPublicRequest.Parameters();
payload.setDocumentId(document.getCode());
......@@ -62,7 +61,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega andmeobjekti ei eksisteeri")})
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.inspection-document-id}"))
@PostMapping(value = "proceeding-inspection-documents/{id}/weblink", produces = APPLICATION_JSON_VALUE)
public List<WebLinkDto> createWebLinks(@PathVariable UUID id, @RequestBody List<String> url, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public List<WebLinkDto> createWebLinks(@PathVariable UUID id, @RequestBody List<String> url, RequestMetaDTO requestMetaDTO) {
CreateWebLinkRequest request = new CreateWebLinkRequest();
request.setPayload(new CreateWebLinkRequest.Parameters(url, id), requestMetaDTO);
......@@ -74,7 +73,7 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega andmeobjekti ei eksisteeri")})
@DeleteMapping(value = "proceeding-inspection-documents/{documentId}/weblink/{webLinkId}", produces = APPLICATION_JSON_VALUE)
public void deleteWebLink(@PathVariable UUID documentId, @PathVariable UUID webLinkId, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void deleteWebLink(@PathVariable UUID documentId, @PathVariable UUID webLinkId, RequestMetaDTO requestMetaDTO) {
DeleteWebLinkRequest request = new DeleteWebLinkRequest();
request.setPayload(new DeleteWebLinkRequest.Parameters(documentId, webLinkId), requestMetaDTO);
processingService.deleteWebLink(request);
......
......@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.UUID;
......@@ -32,7 +31,7 @@ public class ProceedingInspectionDocumentTestController extends TeisBaseControll