Commit fd8c306d authored by Jyrgen Hannus's avatar Jyrgen Hannus
Browse files

TEIS-2019: added new objects to GET proceedings/{id}/inspection-documents REST endpoint

parent b1924cc5
package ee.sm.ti.teis.officegateway.proceedings.proceeding.dto;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.commongateway.file.FileReferenceDto;
import ee.sm.ti.teis.commongateway.weblink.WebLinkDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.dto.InspectionDocumentFileReferenceDto;
import ee.sm.ti.teis.officegateway.weblink.WebLinkOfficeDto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -22,8 +22,8 @@ public class ProceedingInspectionDocumentDto {
private UUID proceedingId;
private ClassifierItemLightDto inspectionDocument;
private String comment;
private List<WebLinkDto> webLinks;
private List<FileReferenceDto> files;
private List<WebLinkOfficeDto> webLinks;
private List<InspectionDocumentFileReferenceDto> files;
private ObjectStatus objectStatus;
private ClassifierItemLightDto source;
}
package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.dto;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.types.enums.FileScanStatusType;
import ee.sm.ti.teis.types.enums.FileStatusType;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Map;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InspectionDocumentFileReferenceDto {
private UUID id;
@NotNull
private UUID fileId;
@NotNull
private UUID objectId;
@NotNull
private ClassifierItemLightDto objectType;
private ClassifierItemLightDto contextType;
private Map<String, Object> context;
private ClassifierItemLightDto creatorType;
private String fileName;
private FileStatusType fileStatus;
private FileScanStatusType scanStatus;
private LocalDateTime createdAt;
private ReadProceedingInspectionDocumentDto readProceedingInspectionDocument;
private ObjectStatus objectStatus;
}
......@@ -2,14 +2,30 @@ package ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.r
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.UUID;
public class ProceedingInspectionDocumentsRequest extends AbstractDTO<UUID, ErrorDTO> {
import static ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.request.ProceedingInspectionDocumentsRequest.Parameters;
public class ProceedingInspectionDocumentsRequest extends AbstractDTO<Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.ProceedingInspectionDocumentsRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
@NotNull
private UUID proceedingId;
private Boolean includeReadProceedingDocuments;
}
}
package ee.sm.ti.teis.officegateway.weblink;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.officegateway.proceedings.proceeding.inspection.document.dto.ReadProceedingInspectionDocumentDto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WebLinkOfficeDto {
private UUID id;
private UUID objectId;
private ClassifierItemLightDto objectType;
private String url;
private ClassifierItemLightDto creatorType;
private String createdAt;
private ReadProceedingInspectionDocumentDto readProceedingInspectionDocument;
private ObjectStatus objectStatus;
}
......@@ -23,7 +23,7 @@ class ProceedingInspectionDocumentControllerTest extends OfficeApiGatewayTestBas
@Test
void getDocuments() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getDocuments(
randomUUID(), new RequestMetaDTO()));
randomUUID(), null, new RequestMetaDTO()));
}
@Test
......
......@@ -25,9 +25,10 @@ public class ProceedingInspectionDocumentController extends TeisBaseController {
@ApiOperation(value = "${teis.api.messages.proceeding.get-proceeding-inspection-documents}",
response = ProceedingInspectionDocumentDto.class)
@GetMapping("proceedings/{id}/inspection-documents")
public List<ProceedingInspectionDocumentDto> getDocuments(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
public List<ProceedingInspectionDocumentDto> getDocuments(@PathVariable UUID id,
@RequestParam(required = false) Boolean includeReadProceedingDocuments, RequestMetaDTO requestMetaDTO) {
ProceedingInspectionDocumentsRequest request = new ProceedingInspectionDocumentsRequest();
request.setPayload(id, requestMetaDTO);
request.setPayload(new ProceedingInspectionDocumentsRequest.Parameters(id, includeReadProceedingDocuments), requestMetaDTO);
return (List<ProceedingInspectionDocumentDto>) service.sendAndReceive(request);
}
......
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