Merge branch 'master' into feature/RED-10543
# Conflicts: # persistence-service-v1/persistence-service-processor-v1/src/main/java/com/iqser/red/service/persistence/management/v1/processor/service/persistence/DossierAttributeConfigPersistenceService.java
This commit is contained in:
commit
47052745c7
@ -16,8 +16,10 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.iqser.red.persistence.service.v1.external.api.impl.controller.DossierController;
|
||||
import com.iqser.red.persistence.service.v1.external.api.impl.controller.StatusController;
|
||||
import com.iqser.red.persistence.service.v2.external.api.impl.mapper.ComponentMapper;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.NotAllowedException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.roles.ApplicationRoles;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ComponentLogService;
|
||||
@ -29,6 +31,7 @@ import com.iqser.red.service.persistence.management.v1.processor.service.users.m
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLogEntry;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.component.RevertOverrideRequest;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.FileModel;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.BulkComponentsRequest;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.Component;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.ComponentOverrideList;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.FileComponents;
|
||||
@ -37,6 +40,7 @@ import com.iqser.red.service.persistence.service.v2.api.external.resource.Compon
|
||||
import com.knecon.fforesight.keycloakcommons.security.KeycloakSecurity;
|
||||
import com.knecon.fforesight.tenantcommons.TenantProvider;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -51,11 +55,16 @@ public class ComponentControllerV2 implements ComponentResource {
|
||||
private final UserService userService;
|
||||
private final StatusController statusController;
|
||||
private final FileStatusService fileStatusService;
|
||||
private final DossierController dossierController;
|
||||
private final DossierTemplatePersistenceService dossierTemplatePersistenceService;
|
||||
private final CurrentApplicationTypeProvider currentApplicationTypeProvider;
|
||||
private final ComponentMapper componentMapper = ComponentMapper.INSTANCE;
|
||||
|
||||
|
||||
@Value("${documine.components.filesLimit:100}")
|
||||
private int documineComponentsFilesLimit = 100;
|
||||
|
||||
|
||||
@Override
|
||||
public FileComponents getComponents(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
|
||||
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
|
||||
@ -92,12 +101,37 @@ public class ComponentControllerV2 implements ComponentResource {
|
||||
checkApplicationType();
|
||||
dossierTemplatePersistenceService.checkDossierTemplateExistsOrElseThrow404(dossierTemplateId);
|
||||
var dossierFiles = statusController.getDossierStatus(dossierId);
|
||||
|
||||
if(dossierFiles.size() > documineComponentsFilesLimit) {
|
||||
throw new BadRequestException(String.format("The dossier you requested components for contains %s files this is above the limit of %s files for this endpoint, please use the POST %s", dossierFiles.size(), documineComponentsFilesLimit, FILE_PATH + BULK_COMPONENTS_PATH));
|
||||
}
|
||||
|
||||
return new FileComponentsList(dossierFiles.stream()
|
||||
.map(file -> getComponents(dossierTemplateId, dossierId, file.getFileId(), includeDetails))
|
||||
.toList());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FileComponentsList getComponentsForFiles(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
|
||||
@PathVariable(DOSSIER_ID_PARAM) String dossierId,
|
||||
@RequestParam(name = INCLUDE_DETAILS_PARAM, defaultValue = "false", required = false) boolean includeDetails,
|
||||
@RequestBody BulkComponentsRequest bulkComponentsRequest){
|
||||
|
||||
if(bulkComponentsRequest.getFileIds().size() > documineComponentsFilesLimit) {
|
||||
throw new BadRequestException(String.format("You requested components for %s files this is above the limit of %s files for this endpoint, lower the fileIds in the request", bulkComponentsRequest.getFileIds().size(), documineComponentsFilesLimit));
|
||||
}
|
||||
|
||||
checkApplicationType();
|
||||
dossierTemplatePersistenceService.checkDossierTemplateExistsOrElseThrow404(dossierTemplateId);
|
||||
dossierController.getDossier(dossierId, false, false);
|
||||
return new FileComponentsList(bulkComponentsRequest.getFileIds().stream()
|
||||
.map(fileId -> getComponents(dossierTemplateId, dossierId, fileId, includeDetails))
|
||||
.toList());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@PreAuthorize("hasAuthority('" + GET_RSS + "')")
|
||||
public void addOverride(@PathVariable(DOSSIER_TEMPLATE_ID_PARAM) String dossierTemplateId,
|
||||
|
||||
@ -449,11 +449,15 @@ public class DossierTemplateControllerV2 implements DossierTemplateResource {
|
||||
return new DossierAttributeDefinitionList(dossierAttributeConfigPersistenceService.getDossierAttributes(dossierTemplateId)
|
||||
.stream()
|
||||
.map(config -> DossierAttributeDefinition.builder()
|
||||
|
||||
.id(config.getId())
|
||||
.name(config.getLabel())
|
||||
.type(config.getType())
|
||||
.reportingPlaceholder(config.getPlaceholder())
|
||||
.displaySettings(DossierAttributeDefinition.DossierDisplaySettings.builder()
|
||||
.editable(config.isEditable())
|
||||
.filterable(config.isFilterable())
|
||||
.displayedInDossierList(config.isDisplayedInDossierList())
|
||||
.build())
|
||||
.build())
|
||||
.toList());
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.iqser.red.service.persistence.service.v2.api.external.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BulkComponentsRequest {
|
||||
|
||||
private List<String> fileIds = new ArrayList<>();
|
||||
}
|
||||
@ -17,5 +17,18 @@ public class DossierAttributeDefinition {
|
||||
private String name;
|
||||
private DossierAttributeType type;
|
||||
private String reportingPlaceholder;
|
||||
private DossierDisplaySettings displaySettings;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class DossierDisplaySettings {
|
||||
|
||||
private boolean editable;
|
||||
private boolean filterable;
|
||||
private boolean displayedInDossierList;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.component.RevertOverrideRequest;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.BulkComponentsRequest;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.Component;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.ComponentOverrideList;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.FileComponents;
|
||||
@ -74,6 +75,16 @@ public interface ComponentResource {
|
||||
@Parameter(name = INCLUDE_DETAILS_PARAM, description = INCLUDE_DETAILS_DESCRIPTION) @RequestParam(name = INCLUDE_DETAILS_PARAM, defaultValue = "false", required = false) boolean includeDetails);
|
||||
|
||||
|
||||
@PostMapping(value = FILE_PATH
|
||||
+ BULK_COMPONENTS_PATH, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE}, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Returns the components for all files of a dossier", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||
FileComponentsList getComponentsForFiles(@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 = INCLUDE_DETAILS_DESCRIPTION) @RequestParam(name = INCLUDE_DETAILS_PARAM, defaultValue = "false", required = false) boolean includeDetails,
|
||||
@RequestBody BulkComponentsRequest bulkComponentsRequest);
|
||||
|
||||
|
||||
@ResponseBody
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
@PostMapping(value = FILE_PATH + FILE_ID_PATH_VARIABLE + OVERRIDES_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
|
||||
@ -1626,6 +1626,50 @@ paths:
|
||||
$ref: '#/components/responses/429'
|
||||
"500":
|
||||
$ref: '#/components/responses/500'
|
||||
post:
|
||||
operationId: getComponentsForFiles
|
||||
tags:
|
||||
- 4. Components
|
||||
summary: Returns the FileComponents for requested files
|
||||
description: |
|
||||
This endpoint fetches components for the requested files by its ids. Like individual file components,
|
||||
these represent various aspects, metadata or content of the files. Entity and component rules define these components based on the file's
|
||||
content. They can give a *structured view* on a document's text.
|
||||
|
||||
To include detailed component information, set the `includeDetails` query parameter to `true`.
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/dossierTemplateId'
|
||||
- $ref: '#/components/parameters/dossierId'
|
||||
- $ref: '#/components/parameters/includeComponentDetails'
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BulkComponentsRequest'
|
||||
required: true
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/FileComponentsList'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/FileComponentsList'
|
||||
description: |
|
||||
Successfully fetched components for all files in the dossier.
|
||||
"400":
|
||||
$ref: '#/components/responses/400'
|
||||
"401":
|
||||
$ref: '#/components/responses/401'
|
||||
"403":
|
||||
$ref: '#/components/responses/403'
|
||||
"404":
|
||||
$ref: '#/components/responses/404-dossier'
|
||||
"429":
|
||||
$ref: '#/components/responses/429'
|
||||
"500":
|
||||
$ref: '#/components/responses/500'
|
||||
/api/downloads:
|
||||
get:
|
||||
operationId: getDownloadStatusList
|
||||
@ -2773,6 +2817,16 @@ components:
|
||||
entityRuleId: DEF.13.37
|
||||
type: another_entity_type
|
||||
page: 456
|
||||
BulkComponentsRequest:
|
||||
type: object
|
||||
description: Request payload to get components for multiple files.
|
||||
properties:
|
||||
fileIds:
|
||||
type: array
|
||||
description: A list with unique identifiers of the files for which components should be retrieved.
|
||||
items:
|
||||
type: string
|
||||
description: The unique identifier of a file.
|
||||
DossierStatusDefinition:
|
||||
type: object
|
||||
description: |
|
||||
@ -2864,6 +2918,8 @@ components:
|
||||
placeholder follows a specific format convention:
|
||||
`{{dossier.attribute.<name>}}` while the name is transformed into 'PascalCase' and does not contain
|
||||
whitespaces. The placeholder is unique in a dossier template.
|
||||
displaySettings:
|
||||
$ref: '#/components/schemas/DossierAttributeDisplaySettings'
|
||||
required:
|
||||
- name
|
||||
- type
|
||||
@ -2872,6 +2928,35 @@ components:
|
||||
name: "Document Summary"
|
||||
type: "TEXT"
|
||||
reportingPlaceholder: "{{dossier.attribute.DocumentSummary}}"
|
||||
displaySettings:
|
||||
editable: true
|
||||
filterable: false
|
||||
displayedInDossierList: false
|
||||
DossierAttributeDisplaySettings:
|
||||
type: object
|
||||
description: |
|
||||
Display setting for the user interface. These settings control how the UI handles and presents the dossier attributes.
|
||||
properties:
|
||||
editable:
|
||||
type: boolean
|
||||
description: |
|
||||
If `true`, the user interfaces allow manual editing of the value. Otherwise only importing and setting by rules would be possible.
|
||||
filterable:
|
||||
type: boolean
|
||||
description: |
|
||||
If `true`, the user interfaces add filter options to the dossier list.
|
||||
displayedInDossierList:
|
||||
type: boolean
|
||||
description: |
|
||||
if `true`, the user interfaces show the values in the dossier list.
|
||||
required:
|
||||
- editable
|
||||
- filterable
|
||||
- displayedInDossierList
|
||||
example:
|
||||
editable: true
|
||||
filterable: true
|
||||
displayedInDossierList: false
|
||||
FileAttributeDefinition:
|
||||
type: object
|
||||
description: |
|
||||
@ -2994,10 +3079,18 @@ components:
|
||||
name: "Dossier Summary"
|
||||
type: "TEXT"
|
||||
reportingPlaceholder: "{{dossier.attribute.DossierSummary}}"
|
||||
displaySettings:
|
||||
editable: true
|
||||
filterable: false
|
||||
displayedInFileList: false
|
||||
- id: "23e45678-e90b-12d3-a456-765114174321"
|
||||
name: "Comment"
|
||||
type: "TEXT"
|
||||
reportingPlaceholder: "{{dossier.attribute.Comment}}"
|
||||
displaySettings:
|
||||
editable: true
|
||||
filterable: false
|
||||
displayedInFileList: false
|
||||
FileAttributeDefinitionList:
|
||||
type: object
|
||||
description: A list of file attribute definitions.
|
||||
|
||||
@ -1492,6 +1492,8 @@ components:
|
||||
placeholder follows a specific format convention:
|
||||
`{{dossier.attribute.<name>}}` while the name is transformed into 'PascalCase' and does not contain
|
||||
whitespaces. The placeholder is unique in a dossier template.
|
||||
displaySettings:
|
||||
$ref: '#/components/schemas/DossierAttributeDisplaySettings'
|
||||
required:
|
||||
- name
|
||||
- type
|
||||
@ -1500,6 +1502,35 @@ components:
|
||||
name: "Document Summary"
|
||||
type: "TEXT"
|
||||
reportingPlaceholder: "{{dossier.attribute.DocumentSummary}}"
|
||||
displaySettings:
|
||||
editable: true
|
||||
filterable: false
|
||||
displayedInDossierList: false
|
||||
DossierAttributeDisplaySettings:
|
||||
type: object
|
||||
description: |
|
||||
Display setting for the user interface. These settings control how the UI handles and presents the dossier attributes.
|
||||
properties:
|
||||
editable:
|
||||
type: boolean
|
||||
description: |
|
||||
If `true`, the user interfaces allow manual editing of the value. Otherwise only importing and setting by rules would be possible.
|
||||
filterable:
|
||||
type: boolean
|
||||
description: |
|
||||
If `true`, the user interfaces add filter options to the dossier list.
|
||||
displayedInDossierList:
|
||||
type: boolean
|
||||
description: |
|
||||
if `true`, the user interfaces show the values in the dossier list.
|
||||
required:
|
||||
- editable
|
||||
- filterable
|
||||
- displayedInDossierList
|
||||
example:
|
||||
editable: true
|
||||
filterable: true
|
||||
displayedInDossierList: false
|
||||
FileAttributeDefinition:
|
||||
type: object
|
||||
description: |
|
||||
@ -1622,10 +1653,18 @@ components:
|
||||
name: "Dossier Summary"
|
||||
type: "TEXT"
|
||||
reportingPlaceholder: "{{dossier.attribute.DossierSummary}}"
|
||||
displaySettings:
|
||||
editable: true
|
||||
filterable: false
|
||||
displayedInFileList: false
|
||||
- id: "23e45678-e90b-12d3-a456-765114174321"
|
||||
name: "Comment"
|
||||
type: "TEXT"
|
||||
reportingPlaceholder: "{{dossier.attribute.Comment}}"
|
||||
displaySettings:
|
||||
editable: true
|
||||
filterable: false
|
||||
displayedInFileList: false
|
||||
FileAttributeDefinitionList:
|
||||
type: object
|
||||
description: A list of file attribute definitions.
|
||||
|
||||
@ -36,12 +36,12 @@ dependencies {
|
||||
}
|
||||
api("com.knecon.fforesight:azure-ocr-service-api:0.13.0")
|
||||
implementation("com.knecon.fforesight:llm-service-api:1.20.0-RED10072.2")
|
||||
api("com.knecon.fforesight:jobs-commons:0.12.0")
|
||||
api("com.knecon.fforesight:jobs-commons:0.13.0")
|
||||
api("com.iqser.red.commons:storage-commons:2.50.0")
|
||||
api("com.knecon.fforesight:tenant-commons:0.31.0-RED10196.0") {
|
||||
exclude(group = "com.iqser.red.commons", module = "storage-commons")
|
||||
}
|
||||
api("com.knecon.fforesight:database-tenant-commons:0.30.0") {
|
||||
api("com.knecon.fforesight:database-tenant-commons:0.31.0") {
|
||||
exclude(group = "com.knecon.fforesight", module = "tenant-commons")
|
||||
}
|
||||
api("com.knecon.fforesight:keycloak-commons:0.30.0") {
|
||||
|
||||
@ -30,6 +30,10 @@ public class DossierAttributeConfigEntity {
|
||||
@Column
|
||||
private boolean editable;
|
||||
@Column
|
||||
private boolean filterable;
|
||||
@Column
|
||||
private boolean displayedInDossierList;
|
||||
@Column
|
||||
private String placeholder;
|
||||
|
||||
@Column
|
||||
|
||||
@ -72,8 +72,11 @@ public class DossierAttributeConfigPersistenceService {
|
||||
config.setLabel(dossierAttributeConfig.getLabel());
|
||||
config.setType(dossierAttributeConfig.getType());
|
||||
config.setEditable(dossierAttributeConfig.isEditable());
|
||||
config.setDisplayedInDossierList(dossierAttributeConfig.isDisplayedInDossierList());
|
||||
config.setFilterable(dossierAttributeConfig.isFilterable());
|
||||
checkAndSetPlaceholder(dossierAttributeConfig);
|
||||
config.setPlaceholder(dossierAttributeConfig.getPlaceholder());
|
||||
setPlaceholder(config);
|
||||
uniqueLabelAndPlaceholder(dossierAttributeConfig);
|
||||
return dossierAttributeConfigRepository.save(config);
|
||||
} else {
|
||||
|
||||
@ -250,4 +250,6 @@ databaseChangeLog:
|
||||
- include:
|
||||
file: db/changelog/tenant/153-custom-technical-name-change.yaml
|
||||
- include:
|
||||
file: db/changelog/tenant/154-add-last-download-to-file.yaml
|
||||
file: db/changelog/tenant/154-add-last-download-to-file.yaml
|
||||
- include:
|
||||
file: db/changelog/tenant/155-add-displayed-and-filterable-to-dossier-attribute-config.yaml
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
databaseChangeLog:
|
||||
- changeSet:
|
||||
id: 155-add-displayed-and-filterable-to-dossier-attribute-config
|
||||
author: maverick
|
||||
changes:
|
||||
- addColumn:
|
||||
columns:
|
||||
- column:
|
||||
name: displayed_in_dossier_list
|
||||
type: BOOLEAN
|
||||
defaultValueBoolean: false
|
||||
- column:
|
||||
name: filterable
|
||||
type: BOOLEAN
|
||||
defaultValueBoolean: false
|
||||
tableName: dossier_attribute_config
|
||||
@ -28,8 +28,7 @@ dependencies {
|
||||
api("org.apache.logging.log4j:log4j-slf4j-impl:2.20.0")
|
||||
api("net.logstash.logback:logstash-logback-encoder:7.4")
|
||||
implementation("ch.qos.logback:logback-classic")
|
||||
implementation("org.liquibase:liquibase-core:4.30.0") // Needed to be set explicit, otherwise spring dependency management sets it to 4.20.0
|
||||
implementation("org.apache.commons:commons-lang3:3.13.0") // Needed for liquibase 4.30.0
|
||||
implementation("org.liquibase:liquibase-core:4.29.2") // Needed to be set explicit, otherwise spring dependency management sets it to 4.20.0
|
||||
|
||||
testImplementation("org.springframework.amqp:spring-rabbit-test:3.0.2")
|
||||
testImplementation("org.springframework.security:spring-security-test:6.0.2")
|
||||
|
||||
@ -9,6 +9,9 @@ tenant-user-management-service.url: "http://tenant-user-management-service:8080/
|
||||
|
||||
logging.pattern.level: "%5p [${spring.application.name},%X{traceId:-},%X{spanId:-}]"
|
||||
|
||||
documine:
|
||||
components:
|
||||
filesLimit: 150
|
||||
|
||||
logging.type: ${LOGGING_TYPE:CONSOLE}
|
||||
kubernetes.namespace: ${NAMESPACE:default}
|
||||
|
||||
@ -63,6 +63,7 @@ public class ComponentOverrideTest extends AbstractPersistenceServerServiceTest
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testOverrides() throws IOException {
|
||||
|
||||
|
||||
@ -16,6 +16,8 @@ public class DossierAttributeConfig {
|
||||
private String id;
|
||||
private String label;
|
||||
private boolean editable;
|
||||
private boolean filterable;
|
||||
private boolean displayedInDossierList;
|
||||
private String placeholder;
|
||||
@Builder.Default
|
||||
private DossierAttributeType type = DossierAttributeType.TEXT;
|
||||
|
||||
@ -9,7 +9,7 @@ dependencies {
|
||||
api(project(":persistence-service-shared-api-v1"))
|
||||
api("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.17.2")
|
||||
api("com.google.guava:guava:31.1-jre")
|
||||
api("com.knecon.fforesight:mongo-database-commons:0.17.0") {
|
||||
api("com.knecon.fforesight:mongo-database-commons:0.18.0") {
|
||||
exclude(group = "com.knecon.fforesight", module = "tenant-commons")
|
||||
exclude(group = "org.liquibase.ext", module = "liquibase-mongodb")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user