RED-7578: Implemented first endpoints of external-api-v2

This commit is contained in:
deiflaender 2023-09-13 09:25:59 +02:00
parent d5af5a2132
commit 0e04331285
29 changed files with 3566 additions and 24 deletions

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-external-api-impl-v2</artifactId>
<properties>
<slf4j.version>1.7.30</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-processor-v1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-v2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-impl-v1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
package com.iqser.red.persistence.service.v2.external.api.impl;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
public class PersistenceServiceExternalApiConfigurationV2 {
}

View File

@ -0,0 +1,35 @@
package com.iqser.red.persistence.service.v2.external.api.impl.controller;
import com.iqser.red.service.persistence.service.v2.api.external.model.FileComponents;
import com.iqser.red.service.persistence.service.v2.api.external.resource.ComponentResource;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierResource.DOSSIER_ID_PARAM;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.DOSSIER_TEMPLATE_ID_PARAM;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.FileResource.FILE_ID_PARAM;
@RestController
@Tag(name = "components", description = "Provides operation related to components")
public class ComponentControllerV2 implements ComponentResource {
@Override
public FileComponents getComponents(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@PathVariable(FILE_ID_PARAM) String fileId,
@RequestParam(name = INCLUDE_DETAILS_PARAM, defaultValue = "false", required = false) boolean includeDetails) {
return null;
}
@Override
public FileComponents getComponentsOfDossier(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@RequestParam(name = INCLUDE_DETAILS_PARAM, defaultValue = "false", required = false) boolean includeDetails) {
return null;
}
}

View File

@ -0,0 +1,81 @@
package com.iqser.red.persistence.service.v2.external.api.impl.controller;
import com.iqser.red.persistence.service.v1.external.api.impl.controller.DossierController;
import com.iqser.red.persistence.service.v1.external.api.impl.controller.DossierTemplateController;
import com.iqser.red.service.persistence.management.v1.processor.exception.DossierNotFoundException;
import com.iqser.red.service.persistence.service.v1.api.shared.model.DossierRequest;
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
import com.iqser.red.service.persistence.service.v2.api.external.model.DossierList;
import com.iqser.red.service.persistence.service.v2.api.external.resource.DossierResource;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import static com.iqser.red.service.persistence.management.v1.processor.exception.DossierNotFoundException.DOSSIER_NOT_FOUND_MESSAGE;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.DOSSIER_TEMPLATE_ID_PARAM;
@RestController
@RequiredArgsConstructor
@Tag(name = "dossiers", description = "Provides operation related to dossiers")
public class DossierControllerV2 implements DossierResource {
private final DossierTemplateController dossierTemplateController;
private final DossierController dossierController;
public DossierList getDossiers(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
var dossiers = dossierController.getDossiers(includeArchived, includeSoftDeleted);
if (!includeActive) {
return new DossierList(dossiers.stream().filter(dossier -> dossier.getSoftDeletedTime() != null || dossier.getArchivedTime() != null).toList());
}
return new DossierList(dossiers);
}
public Dossier getDossier(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
var dossier = dossierController.getDossier(dossierId, includeArchived, includeSoftDeleted);
if (!includeActive && dossier.getArchivedTime() == null && dossier.getSoftDeletedTime() == null) {
throw new DossierNotFoundException(String.format(DOSSIER_NOT_FOUND_MESSAGE, dossierId));
}
return dossier;
}
public ResponseEntity<Dossier> createDossierOrUpdateDossier(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@RequestBody DossierRequest dossier) {
return dossierController.createDossierOrUpdateDossier(dossier);
}
public void deleteDossier(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier to retrieve.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
dossierController.deleteDossier(dossierId);
}
}

View File

@ -0,0 +1,30 @@
package com.iqser.red.persistence.service.v2.external.api.impl.controller;
import com.iqser.red.persistence.service.v1.external.api.impl.controller.DossierTemplateController;
import com.iqser.red.service.persistence.service.v1.api.shared.model.DossierTemplateModel;
import com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequiredArgsConstructor
@Tag(name = "dossier-templates", description = "Provides operation related to dossier templates")
public class DossierTemplateControllerV2 implements DossierTemplateResource {
private final DossierTemplateController dossierTemplateController;
public List<DossierTemplateModel> getAllDossierTemplates() {
return dossierTemplateController.getAllDossierTemplates();
}
public DossierTemplateModel getDossierTemplate(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId) {
return dossierTemplateController.getDossierTemplate(dossierTemplateId);
}
}

View File

@ -0,0 +1,142 @@
package com.iqser.red.persistence.service.v2.external.api.impl.controller;
import com.iqser.red.persistence.service.v1.external.api.impl.controller.*;
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileAttributes;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatus;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileUploadResult;
import com.iqser.red.service.persistence.service.v2.api.external.model.FileDeleteRequest;
import com.iqser.red.service.persistence.service.v2.api.external.model.FileStatusList;
import com.iqser.red.service.persistence.service.v2.api.external.resource.FileResource;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierResource.*;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.DOSSIER_TEMPLATE_ID_PARAM;
@RestController
@RequiredArgsConstructor
@Tag(name = "files", description = "Provides operation related to files")
public class FileControllerV2 implements FileResource {
private final UploadController uploadController;
private final StatusController statusController;
private final DossierController dossierController;
private final FileManagementController fileManagementController;
private final FileAttributesController fileAttributesController;
private final DossierTemplateController dossierTemplateController;
public FileUploadResult upload(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@RequestPart(name = FILE_PARAM) MultipartFile file,
@RequestParam(value = KEEP_MANUAL_CHANGES_PARAM, required = false, defaultValue = "false") boolean keepManualChanges) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
return uploadController.upload(file, dossierId, keepManualChanges);
}
public FileStatusList getDossierStatus(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
List<FileStatus> fileStatusList = new ArrayList<>();
if (!includeArchived && dossierController.getDossier(dossierId, includeArchived, includeSoftDeleted).getArchivedTime() != null) {
return new FileStatusList(fileStatusList);
}
if (includeActive) {
fileStatusList.addAll(statusController.getDossierStatus(dossierId));
}
if (includeSoftDeleted) {
fileStatusList.addAll(statusController.getSoftDeletedDossierStatus(dossierId));
}
return new FileStatusList(fileStatusList);
}
public FileStatus getFileStatus(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@PathVariable(FILE_ID_PARAM) String fileId,
@RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
boolean dossierIsArchived = dossierController.getDossier(dossierId, includeArchived, includeSoftDeleted).getArchivedTime() != null;
if (!includeArchived && dossierIsArchived) {
throw new NotFoundException("The requested file does not exist.");
}
var status = statusController.getFileStatus(dossierId, fileId);
if (!includeActive && !dossierIsArchived && status.getSoftDeletedTime() == null) {
throw new NotFoundException("The requested file does not exist.");
}
if (!includeSoftDeleted && status.getSoftDeletedTime() != null) {
throw new NotFoundException("The requested file does not exist.");
}
return status;
}
public void deleteFile(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@PathVariable(FILE_ID_PARAM) String fileId,
@RequestParam(name = DELETE_PERMANENTLY_PARAM, defaultValue = "false", required = false) boolean deletePermanently) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
if (deletePermanently) {
fileManagementController.hardDeleteFiles(dossierId, Set.of(fileId));
} else {
fileManagementController.deleteFile(dossierId, fileId);
}
}
public void deleteFiles(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@RequestBody FileDeleteRequest fileDeleteRequest,
@RequestParam(name = DELETE_PERMANENTLY_PARAM, defaultValue = "false", required = false) boolean deletePermanently) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
if (deletePermanently) {
fileManagementController.hardDeleteFiles(dossierId, new HashSet<>(fileDeleteRequest.getFileIds()));
} else {
fileManagementController.deleteFiles(dossierId, fileDeleteRequest.getFileIds());
}
}
public void setFileAttributes(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
@PathVariable(FILE_ID_PARAM) String fileId,
@RequestBody FileAttributes fileAttributes) {
dossierTemplateController.getDossierTemplate(dossierTemplateId);
fileAttributesController.setFileAttributes(dossierId, fileId, fileAttributes);
}
}

View File

@ -0,0 +1,23 @@
package com.iqser.red.persistence.service.v2.external.api.impl.controller;
import com.iqser.red.persistence.service.v1.external.api.impl.controller.LicenseReportController;
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReport;
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReportRequest;
import com.iqser.red.service.persistence.service.v2.api.external.resource.LicenseResource;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Tag(name = "license", description = "Provides operation related to the license")
public class LicenseControllerV2 implements LicenseResource {
private final LicenseReportController licenseReportController;
public LicenseReport getReport(@RequestBody LicenseReportRequest reportRequest) {
return licenseReportController.getReport(reportRequest);
}
}

View File

@ -0,0 +1,16 @@
package com.iqser.red.persistence.service.v2.external.api.impl;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class IdentityTest {
@Test
public void mockTest() {
int i = 1;
assertThat(i).isEqualTo(1);
}
}

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>persistence-service-v1</artifactId>
<groupId>com.iqser.red.service</groupId>
<version>2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>persistence-service-external-api-v2</artifactId>
<dependencies>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-v1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-v1</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>redaction-report-service-api-v1</artifactId>
<exclusions>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>search-service-api-v1</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- spring -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>jackson-commons</artifactId>
</dependency>
<!-- test -->
<dependency>
<groupId>com.iqser.red.commons</groupId>
<artifactId>test-commons</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-shared-api-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,25 @@
package com.iqser.red.service.persistence.service.v2.api.external.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Component {
private String name;
private List<String> values;
private List<String> originalValues;
private String componentRule;
@Builder.Default
private List<Entity> entityReferences = new ArrayList<>();
}

View File

@ -0,0 +1,20 @@
package com.iqser.red.service.persistence.service.v2.api.external.model;
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DossierList {
@Builder.Default
private List<Dossier> dossiers = new ArrayList<>();
}

View File

@ -0,0 +1,27 @@
package com.iqser.red.service.persistence.service.v2.api.external.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.*;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Entity {
private String id;
private String type;
private String value;
private String entityRule;
@Builder.Default
private Set<Integer> pages = new HashSet<>();
@Builder.Default
private Map<String, List<String>> components = new HashMap<>();
}

View File

@ -0,0 +1,28 @@
package com.iqser.red.service.persistence.service.v2.api.external.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FileComponents {
private String dossierTemplateId;
private String dossierId;
private String fileId;
private String filename;
@Builder.Default
private Map<String, List<String>> components = new HashMap<>();
private Component componentDetails;
}

View File

@ -0,0 +1,19 @@
package com.iqser.red.service.persistence.service.v2.api.external.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FileComponentsList {
@Builder.Default
private List<FileComponents> fileComponents = new ArrayList<>();
}

View File

@ -0,0 +1,19 @@
package com.iqser.red.service.persistence.service.v2.api.external.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FileDeleteRequest {
@Builder.Default
private List<String> fileIds = new ArrayList<>();
}

View File

@ -0,0 +1,20 @@
package com.iqser.red.service.persistence.service.v2.api.external.model;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FileStatusList {
@Builder.Default
private List<FileStatus> files = new ArrayList<>();
}

View File

@ -0,0 +1 @@
lombok.anyConstructor.addConstructorProperties=true

View File

@ -0,0 +1,48 @@
package com.iqser.red.service.persistence.service.v2.api.external.resource;
import com.iqser.red.service.persistence.service.v2.api.external.model.FileComponents;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierResource.*;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.*;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.FileResource.*;
@ResponseStatus(value = HttpStatus.OK)
public interface ComponentResource {
String PATH = ExternalApiConstants.BASE_PATH + DOSSIER_TEMPLATE_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + DOSSIER_PATH + DOSSIER_ID_PATH_PARAM + FILE_PATH;
String COMPONENTS_PATH = "/components";
String BULK_COMPONENTS_PATH = "/bulk/get-components";
String INCLUDE_DETAILS_PARAM = "includeDetails";
@GetMapping(value = PATH + FILE_ID_PATH_VARIABLE + COMPONENTS_PATH, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@Operation(summary = "Returns the components for a file", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
FileComponents getComponents(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier that contains the file.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = FILE_ID_PARAM, description = "The identifier of the file that the components are requested for.", required = true) @PathVariable(FILE_ID_PARAM) String fileId,
@Parameter(name = INCLUDE_DETAILS_PARAM, description = "TODO") @RequestParam(name = INCLUDE_DETAILS_PARAM, defaultValue = "false", required = false) boolean includeDetails);
@GetMapping(value = PATH + BULK_COMPONENTS_PATH, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@Operation(summary = "Returns the components for all files of a dossier", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
FileComponents getComponentsOfDossier(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier that contains the file.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = INCLUDE_DETAILS_PARAM, description = "TODO") @RequestParam(name = INCLUDE_DETAILS_PARAM, defaultValue = "false", required = false) boolean includeDetails);
}

View File

@ -0,0 +1,68 @@
package com.iqser.red.service.persistence.service.v2.api.external.resource;
import com.iqser.red.service.persistence.service.v1.api.shared.model.DossierRequest;
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.Dossier;
import com.iqser.red.service.persistence.service.v2.api.external.model.DossierList;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.*;
public interface DossierResource {
String DOSSIER_PATH = "/dossiers";
String PATH = ExternalApiConstants.BASE_PATH + DOSSIER_TEMPLATE_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + DOSSIER_PATH;
String DOSSIER_ID_PARAM = "dossierId";
String DOSSIER_ID_PATH_PARAM = "/{" + DOSSIER_ID_PARAM + "}";
String INCLUDE_ACTIVE_PARAM = "includeActive";
String INCLUDE_ARCHIVED_PARAM = "includeArchived";
String INCLUDE_SOFT_DELETED_PARAM = "includeSoftDeleted";
@ResponseStatus(value = HttpStatus.OK)
@ResponseBody
@GetMapping(value = PATH, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Gets all existing dossiers for a specific dossier template.", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
DossierList getDossiers(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = INCLUDE_ACTIVE_PARAM, description = "A Toggle to include active dossiers: If `true` (default) the response contains dossiers that are active, i.e. the dossier is neither archived nor soft-deleted.") @RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@Parameter(name = INCLUDE_ARCHIVED_PARAM, description = "A Toggle to include archived dossiers: If `true` the response contains dossiers that have been archived.") @RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@Parameter(name = INCLUDE_SOFT_DELETED_PARAM, description = "A Toggle to include soft-deleted dossiers: If `true` the response contains dossiers that have been soft-deleted, i.e. the dossiers can still be restored.") @RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
@ResponseStatus(value = HttpStatus.OK)
@ResponseBody
@GetMapping(value = PATH + DOSSIER_ID_PATH_PARAM, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Gets an existing dossier.", description = "By default, the requested dossier will be returned only if it is active. This behavior can be changed by using and combining the respective toggle parameters.")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found")})
Dossier getDossier(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier to retrieve.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = INCLUDE_ACTIVE_PARAM, description = "A Toggle to return an active dossier: If `true` the dossiers will be returned if it is active, i.e. the dossiers is neither archived nor deleted.") @RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@Parameter(name = INCLUDE_ARCHIVED_PARAM, description = "A Toggle to return an archived dossier: If `true` the dossier will be returned if it is archived.") @RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@Parameter(name = INCLUDE_SOFT_DELETED_PARAM, description = "A Toggle to return a soft-deleted dossier: If `true` the dossier will be returned if it has been soft-deleted, i.e. the dossier can still be restored.") @RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
@ResponseBody
@PostMapping(value = PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Creates or updates a dossier for a specific dossier template.", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "201", description = "Successfully saved the dossier."), @ApiResponse(responseCode = "400", description = "Incorrect dossier ID provided or attempted to change dossier-template for a dossier with files."), @ApiResponse(responseCode = "409", description = "Duplicate")})
ResponseEntity<Dossier> createDossierOrUpdateDossier(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@RequestBody DossierRequest dossier);
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@DeleteMapping(value = PATH + DOSSIER_ID_PATH_PARAM)
@Operation(summary = "Deletes an existing dossier.", description = "Dossiers get soft-deleted unless specified other. A soft-deleted dossier can be restored during a retention period that is configured in the application settings. The default retention period is 96h.")
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Successfully deleted the dossier."), @ApiResponse(responseCode = "404", description = "Not found")})
void deleteDossier(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier to retrieve.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId);
}

View File

@ -0,0 +1,37 @@
package com.iqser.red.service.persistence.service.v2.api.external.resource;
import com.iqser.red.service.persistence.service.v1.api.shared.model.DossierTemplateModel;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.util.List;
@ResponseStatus(HttpStatus.OK)
public interface DossierTemplateResource {
String DOSSIER_TEMPLATE_PATH = "/dossier-templates";
String PATH = ExternalApiConstants.BASE_PATH + DOSSIER_TEMPLATE_PATH;
String DOSSIER_TEMPLATE_ID_PARAM = "dossierTemplateId";
String DOSSIER_TEMPLATE_ID_PATH_VARIABLE = "/{" + DOSSIER_TEMPLATE_ID_PARAM + "}";
@GetMapping(value = PATH, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Lists all existing DossierTemplates.", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "List of all existing DossierTemplates.")})
List<DossierTemplateModel> getAllDossierTemplates();
@GetMapping(value = PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Get a specific DossierTemplate by its identifier.", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Get a specific DossierTemplate by its identifier."), @ApiResponse(responseCode = "404", description = "The DossierTemplate is not found.")})
DossierTemplateModel getDossierTemplate(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId);
}

View File

@ -0,0 +1,7 @@
package com.iqser.red.service.persistence.service.v2.api.external.resource;
public interface ExternalApiConstants {
String BASE_PATH = "/api";
}

View File

@ -0,0 +1,96 @@
package com.iqser.red.service.persistence.service.v2.api.external.resource;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileAttributes;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatus;
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileUploadResult;
import com.iqser.red.service.persistence.service.v2.api.external.model.FileDeleteRequest;
import com.iqser.red.service.persistence.service.v2.api.external.model.FileStatusList;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierResource.*;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.*;
public interface FileResource {
String FILE_PATH = "/files";
String PATH = ExternalApiConstants.BASE_PATH + DOSSIER_TEMPLATE_PATH + DOSSIER_TEMPLATE_ID_PATH_VARIABLE + DOSSIER_PATH + DOSSIER_ID_PATH_PARAM + FILE_PATH;
String BULK_DELETE_PATH = "/bulk/delete";
String FILE_ATTRIBUTES_PATH = "/attributes";
String KEEP_MANUAL_CHANGES_PARAM = "keepManualChanges";
String DELETE_PERMANENTLY_PARAM = "deletePermanently";
String FILE_PARAM = "file";
String FILE_ID_PARAM = "fileId";
String FILE_ID_PATH_VARIABLE = "/{" + FILE_ID_PARAM + "}";
@ResponseBody
@ResponseStatus(value = HttpStatus.CREATED)
@PostMapping(value = PATH, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Upload a file for a specific dossier.", description = "The multipart file upload returns the identifier for the uploaded file. If the dossier contains a file with the same name, it will be overwritten. Supported file types are PDF documents, Microsoft Office documents, and CSV files. Microsoft office files (file extensions `docx`, `xlsx`, or `pptx`) will be converted into PDF documents. Please note that the generated PDF might look slightly different to the original as the system does not necessarily have all fonts. However, it will generate an output on best effort to stay as close to the original as possible. CSV files are used to support a bulk annotation of file attributes. If the dossier is configured in a way to map specific fields of the CSV to file attributes and the CSV matches the mapped structure, the system will process the file or ignore it otherwise.")
@ApiResponses(value = {@ApiResponse(responseCode = "201", description = "File upload succeeded. Return the fileId of the uploaded file.")})
FileUploadResult upload(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier to where the file is to be uploaded.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = FILE_PARAM, description = "The file to be uploaded.", required = true) @RequestPart(name = FILE_PARAM) MultipartFile file,
@Parameter(name = DOSSIER_ID_PARAM, description = "A Toggle to keep manual changes: Manual changes are manually added annotations or manipulations on existing ones. If set to `true` the system keeps the manual changes on re-uploading (overwriting) the file.") @RequestParam(value = KEEP_MANUAL_CHANGES_PARAM, required = false, defaultValue = "false") boolean keepManualChanges);
@ResponseStatus(value = HttpStatus.OK)
@ResponseBody
@GetMapping(value = PATH, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Gets the status for all files in a dossier.", description = "The status contains information like ... By default, only the status of active files is returned. There are several parameters that can be combined to change the response scope.")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
FileStatusList getDossierStatus(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier containing the file of which the status is requested.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = INCLUDE_ACTIVE_PARAM, description = "A Toggle to include active files: If `true` (default) the response contains the status of files that are active, i.e. they are not soft-deleted.") @RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@Parameter(name = INCLUDE_ARCHIVED_PARAM, description = "A Toggle to include files of archived dossiers: If `true` the response contains the status of files that belong to an archived dossier. Set to `false` if you expect a `404 Not found` if the dossier is archived.") @RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@Parameter(name = INCLUDE_SOFT_DELETED_PARAM, description = "A Toggle to include soft-deleted dossiers and files: If `true` the response contains the status of files that have been soft-deleted, i.e. the files can still be restored.") @RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
@ResponseStatus(value = HttpStatus.OK)
@ResponseBody
@GetMapping(value = PATH + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Gets the status for a file.", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "404", description = "Not found")})
FileStatus getFileStatus(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier containing the file of which the status is requested.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = FILE_ID_PARAM, description = "The identifier of the file of which the status is requested.", required = true) @PathVariable(FILE_ID_PARAM) String fileId,
@Parameter(name = INCLUDE_ACTIVE_PARAM, description = "A Toggle to include active files: If `true` (default) the response contains the status of files that are active, i.e. they are not soft-deleted.") @RequestParam(name = INCLUDE_ACTIVE_PARAM, defaultValue = "true", required = false) boolean includeActive,
@Parameter(name = INCLUDE_ARCHIVED_PARAM, description = "A Toggle to include files of archived dossiers: If `true` the response contains the status of files that belong to an archived dossier. Set to `false` if you expect a `404 Not found` if the dossier is archived.") @RequestParam(name = INCLUDE_ARCHIVED_PARAM, defaultValue = "false", required = false) boolean includeArchived,
@Parameter(name = INCLUDE_SOFT_DELETED_PARAM, description = "A Toggle to include soft-deleted dossiers and files: If `true` the response contains the status of files that have been soft-deleted, i.e. the files can still be restored.") @RequestParam(name = INCLUDE_SOFT_DELETED_PARAM, defaultValue = "false", required = false) boolean includeSoftDeleted);
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@DeleteMapping(value = PATH + FILE_ID_PATH_VARIABLE)
@Operation(summary = "Deletes a file for a given dossierId and FileId", description = "When deleting a file, it gets 'soft-deleted' by default, i.e. it can be restored within retention time configured in the dossier template. There is a toggle to also permanently delete the file.")
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
void deleteFile(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier that contains the file.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = FILE_ID_PARAM, description = "The identifier of the file that will be deleted.", required = true) @PathVariable(FILE_ID_PARAM) String fileId,
@Parameter(name = DELETE_PERMANENTLY_PARAM, description = "A Toggle to permanently delete the file: If `true` the file will be deleted permanently, i.e. in contrast to a soft-delete (value is `false`) the file cannot be restored anymore. This can be applied also on previously soft-deleted files.") @RequestParam(name = DELETE_PERMANENTLY_PARAM, defaultValue = "false", required = false) boolean deletePermanently);
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@PostMapping(value = PATH + BULK_DELETE_PATH)
@Operation(summary = "Deletes a list of files of a specific dossier (DELETE with body payload)", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
void deleteFiles(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier that contains the file.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@RequestBody FileDeleteRequest fileDeleteRequest,
@Parameter(name = DELETE_PERMANENTLY_PARAM, description = "A Toggle to permanently delete the file: If `true` the file will be deleted permanently, i.e. in contrast to a soft-delete (value is `false`) the file cannot be restored anymore. This can be applied also on previously soft-deleted files.") @RequestParam(name = DELETE_PERMANENTLY_PARAM, defaultValue = "false", required = false) boolean deletePermanently);
@Operation(summary = "Set file attributes to an existing file", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
@PostMapping(value = PATH + FILE_ID_PATH_VARIABLE + FILE_ATTRIBUTES_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
void setFileAttributes(@Parameter(name = DOSSIER_TEMPLATE_ID_PARAM, description = "The identifier of the dossier template that is used for the dossier.", required = true) @PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
@Parameter(name = DOSSIER_ID_PARAM, description = "The identifier of the dossier that contains the file.", required = true) @PathVariable(DOSSIER_ID_PARAM) String dossierId,
@Parameter(name = FILE_ID_PARAM, description = "The identifier of the file of which the file attributes are set.", required = true) @PathVariable(FILE_ID_PARAM) String fileId,
@RequestBody FileAttributes fileAttributes);
}

View File

@ -0,0 +1,29 @@
package com.iqser.red.service.persistence.service.v2.api.external.resource;
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReport;
import com.iqser.red.service.persistence.service.v1.api.shared.model.license.LicenseReportRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
public interface LicenseResource {
String LICENSE_PATH = "/license";
String PATH = ExternalApiConstants.BASE_PATH + LICENSE_PATH;
String ACTIVE_USAGE_PATH = "/active/usage";
@ResponseBody
@ResponseStatus(value = HttpStatus.OK)
@PostMapping(value = PATH + ACTIVE_USAGE_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Creates and serves license report.", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Successfully created and served a license report.")})
LicenseReport getReport(@RequestBody LicenseReportRequest reportRequest);
}

View File

@ -0,0 +1,16 @@
package com.iqser.red.service.persistence.service.v2.api.external;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
public class IdentityTest {
@Test
public void mockTest() {
int i = 1;
assertThat(i).isEqualTo(1);
}
}

View File

@ -72,12 +72,19 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-external-api-impl-v2</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-internal-api-impl-v1</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -1,5 +1,25 @@
package com.iqser.red.service.peristence.v1.server;
import com.iqser.red.persistence.service.v1.external.api.impl.PersistenceServiceExternalApiConfiguration;
import com.iqser.red.persistence.service.v2.external.api.impl.PersistenceServiceExternalApiConfigurationV2;
import com.iqser.red.service.dictionarymerge.commons.DictionaryMergeService;
import com.iqser.red.service.persistence.management.v1.processor.PersistenceServiceProcessorConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.cache.PersistenceServiceExternalApiCacheConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.configuration.MessagingConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.settings.FileManagementServiceSettings;
import com.iqser.red.service.persistence.v1.internal.api.PersistenceServiceInternalApiConfiguration;
import com.iqser.red.storage.commons.StorageAutoConfiguration;
import com.knecon.fforesight.databasetenantcommons.DatabaseTenantCommonsAutoConfiguration;
import com.knecon.fforesight.jobscommons.JobsAutoConfiguration;
import com.knecon.fforesight.keycloakcommons.DefaultKeyCloakCommonsAutoConfiguration;
import com.knecon.fforesight.swaggercommons.SpringDocAutoConfiguration;
import com.knecon.fforesight.tenantcommons.AsyncConfig;
import com.knecon.fforesight.tenantcommons.MultiTenancyAutoConfiguration;
import com.knecon.fforesight.tenantcommons.MultiTenancyMessagingConfiguration;
import com.knecon.fforesight.tenantcommons.MultiTenancyWebConfiguration;
import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
@ -19,28 +39,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.iqser.red.service.dictionarymerge.commons.DictionaryMergeService;
import com.iqser.red.persistence.service.v1.external.api.impl.PersistenceServiceExternalApiConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.PersistenceServiceProcessorConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.cache.PersistenceServiceExternalApiCacheConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.configuration.MessagingConfiguration;
import com.iqser.red.service.persistence.management.v1.processor.settings.FileManagementServiceSettings;
import com.iqser.red.service.persistence.v1.internal.api.PersistenceServiceInternalApiConfiguration;
import com.iqser.red.storage.commons.StorageAutoConfiguration;
import com.knecon.fforesight.databasetenantcommons.DatabaseTenantCommonsAutoConfiguration;
import com.knecon.fforesight.jobscommons.JobsAutoConfiguration;
import com.knecon.fforesight.keycloakcommons.DefaultKeyCloakCommonsAutoConfiguration;
import com.knecon.fforesight.swaggercommons.SpringDocAutoConfiguration;
import com.knecon.fforesight.tenantcommons.AsyncConfig;
import com.knecon.fforesight.tenantcommons.MultiTenancyAutoConfiguration;
import com.knecon.fforesight.tenantcommons.MultiTenancyMessagingConfiguration;
import com.knecon.fforesight.tenantcommons.MultiTenancyWebConfiguration;
import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.MeterRegistry;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@EnableAsync
@EnableRetry
@ -49,7 +47,7 @@ import lombok.extern.slf4j.Slf4j;
@EnableConfigurationProperties({FileManagementServiceSettings.class})
@ImportAutoConfiguration({StorageAutoConfiguration.class, JobsAutoConfiguration.class, DatabaseTenantCommonsAutoConfiguration.class, MultiTenancyAutoConfiguration.class, SpringDocAutoConfiguration.class, DefaultKeyCloakCommonsAutoConfiguration.class})
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class, CassandraAutoConfiguration.class, DataSourceAutoConfiguration.class, LiquibaseAutoConfiguration.class})
@Import({PersistenceServiceExternalApiConfiguration.class, PersistenceServiceInternalApiConfiguration.class, PersistenceServiceExternalApiCacheConfiguration.class, MultiTenancyWebConfiguration.class, PersistenceServiceProcessorConfiguration.class, MessagingConfiguration.class, AsyncConfig.class, MultiTenancyMessagingConfiguration.class})
@Import({PersistenceServiceExternalApiConfigurationV2.class, PersistenceServiceExternalApiConfiguration.class, PersistenceServiceInternalApiConfiguration.class, PersistenceServiceExternalApiCacheConfiguration.class, MultiTenancyWebConfiguration.class, PersistenceServiceProcessorConfiguration.class, MessagingConfiguration.class, AsyncConfig.class, MultiTenancyMessagingConfiguration.class})
public class Application {
/**

View File

@ -109,7 +109,8 @@ fforesight:
keycloak:
ignored-endpoints: [ '/redaction-gateway-v1','/actuator/health/**', '/redaction-gateway-v1/async/download/with-ott/**',
'/internal-api/**', '/redaction-gateway-v1/docs/swagger-ui',
'/redaction-gateway-v1/docs/**','/redaction-gateway-v1/docs', ]
'/redaction-gateway-v1/docs/**','/redaction-gateway-v1/docs',
'/api','/api/docs/**','/api/docs','/api/docs/swagger-ui' ]
enabled: true
springdoc:
base-path: '/redaction-gateway-v1'

View File

@ -22,9 +22,11 @@
<module>persistence-service-shared-api-v1</module>
<module>persistence-service-internal-api-v1</module>
<module>persistence-service-external-api-v1</module>
<module>persistence-service-external-api-v2</module>
<module>persistence-service-processor-v1</module>
<module>persistence-service-server-v1</module>
<module>persistence-service-external-api-impl-v1</module>
<module>persistence-service-external-api-impl-v2</module>
<module>persistence-service-internal-api-impl-v1</module>
</modules>