RED-10353: Added error code to file
This commit is contained in:
parent
c0e3731844
commit
92fc6f7f8c
@ -10,6 +10,7 @@ import org.hibernate.annotations.Fetch;
|
|||||||
import org.hibernate.annotations.FetchMode;
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.utils.JSONIntegerSetConverter;
|
import com.iqser.red.service.persistence.management.v1.processor.utils.JSONIntegerSetConverter;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.ErrorCode;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.ProcessingStatus;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.ProcessingStatus;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.WorkflowStatus;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.WorkflowStatus;
|
||||||
|
|
||||||
@ -201,6 +202,11 @@ public class FileEntity {
|
|||||||
@Column
|
@Column
|
||||||
private OffsetDateTime errorTimestamp;
|
private OffsetDateTime errorTimestamp;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private ErrorCode errorCode;
|
||||||
|
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
private List<FileEntityComponentMappingVersionEntity> componentMappingVersions;
|
private List<FileEntityComponentMappingVersionEntity> componentMappingVersions;
|
||||||
|
|
||||||
|
|||||||
@ -213,12 +213,13 @@ public class FileStatusPersistenceService {
|
|||||||
public void updateStatusErrorInfo(String fileId, FileErrorInfo fileErrorInfo) {
|
public void updateStatusErrorInfo(String fileId, FileErrorInfo fileErrorInfo) {
|
||||||
|
|
||||||
if (fileErrorInfo == null) {
|
if (fileErrorInfo == null) {
|
||||||
fileRepository.updateStatusErrorInfo(fileId, null, null, null, null);
|
fileRepository.updateStatusErrorInfo(fileId, null, null, null, null, null);
|
||||||
} else {
|
} else {
|
||||||
fileRepository.updateStatusErrorInfo(fileId,
|
fileRepository.updateStatusErrorInfo(fileId,
|
||||||
fileErrorInfo.getCause().substring(0, Math.min(fileErrorInfo.getCause().length(), 255)),
|
fileErrorInfo.getCause().substring(0, Math.min(fileErrorInfo.getCause().length(), 255)),
|
||||||
fileErrorInfo.getQueue(),
|
fileErrorInfo.getQueue(),
|
||||||
fileErrorInfo.getService(),
|
fileErrorInfo.getService(),
|
||||||
|
fileErrorInfo.getErrorCode(),
|
||||||
fileErrorInfo.getTimestamp());
|
fileErrorInfo.getTimestamp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +234,7 @@ public class FileStatusPersistenceService {
|
|||||||
}
|
}
|
||||||
if (processingStatus == ProcessingStatus.PROCESSED) {
|
if (processingStatus == ProcessingStatus.PROCESSED) {
|
||||||
// reset the error info
|
// reset the error info
|
||||||
fileRepository.updateStatusErrorInfo(fileId, null, null, null, null);
|
fileRepository.updateStatusErrorInfo(fileId, null, null, null, null, null);
|
||||||
// In case the file is updated to "processed", "lastProcessed" date should be updated to "now"
|
// In case the file is updated to "processed", "lastProcessed" date should be updated to "now"
|
||||||
fileRepository.updateProcessingStatus(fileId,
|
fileRepository.updateProcessingStatus(fileId,
|
||||||
processingStatus,
|
processingStatus,
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import com.iqser.red.service.persistence.management.v1.processor.entity.projecti
|
|||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FilePageCountsProjection;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FilePageCountsProjection;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FileProcessingStatusProjection;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FileProcessingStatusProjection;
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FileWorkflowStatusProjection;
|
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.projection.FileWorkflowStatusProjection;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.ErrorCode;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.ProcessingStatus;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.ProcessingStatus;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.WorkflowStatus;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.WorkflowStatus;
|
||||||
|
|
||||||
@ -133,11 +134,12 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
|
|||||||
|
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Query("update FileEntity f set f.errorCause = :cause, f.errorQueue = :queue, f.errorService = :service, f.errorTimestamp = :timestamp " + "where f.id = :fileId")
|
@Query("update FileEntity f set f.errorCause = :cause, f.errorQueue = :queue, f.errorService = :service, f.errorTimestamp = :timestamp, f.errorCode = :errorCode where f.id = :fileId")
|
||||||
void updateStatusErrorInfo(@Param("fileId") String fileId,
|
void updateStatusErrorInfo(@Param("fileId") String fileId,
|
||||||
@Param("cause") String cause,
|
@Param("cause") String cause,
|
||||||
@Param("queue") String queue,
|
@Param("queue") String queue,
|
||||||
@Param("service") String service,
|
@Param("service") String service,
|
||||||
|
@Param("errorCode") ErrorCode errorCode,
|
||||||
@Param("timestamp") OffsetDateTime timestamp);
|
@Param("timestamp") OffsetDateTime timestamp);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public class FileModelMapper implements BiConsumer<FileEntity, FileModel> {
|
|||||||
|
|
||||||
fileEntity.getFileAttributes()
|
fileEntity.getFileAttributes()
|
||||||
.forEach(fa -> fileModel.getFileAttributes().put(fa.getFileAttributeId().getFileAttributeConfigId(), fa.getValue()));
|
.forEach(fa -> fileModel.getFileAttributes().put(fa.getFileAttributeId().getFileAttributeConfigId(), fa.getValue()));
|
||||||
fileModel.setFileErrorInfo(new FileErrorInfo(fileEntity.getErrorCause(), fileEntity.getErrorQueue(), fileEntity.getErrorService(), fileEntity.getErrorTimestamp()));
|
fileModel.setFileErrorInfo(new FileErrorInfo(fileEntity.getErrorCause(), fileEntity.getErrorQueue(), fileEntity.getErrorService(), fileEntity.getErrorTimestamp(), fileEntity.getErrorCode()));
|
||||||
fileModel.setComponentMappingVersions(getComponentMappingVersions(fileEntity));
|
fileModel.setComponentMappingVersions(getComponentMappingVersions(fileEntity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -230,12 +230,14 @@ databaseChangeLog:
|
|||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/143-modify-download-redaction-file-status-details.yaml
|
file: db/changelog/tenant/143-modify-download-redaction-file-status-details.yaml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/144-add-protobuf-migration-done-to-file.yaml
|
file: db/changelog/tenant/144-add-error-code-to-file.yaml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/145-add-indexes-to-file-table.yaml
|
file: db/changelog/tenant/145-add-protobuf-migration-done-to-file.yaml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/146-add-layout-parsing-type-to-dossier-template.yaml
|
file: db/changelog/tenant/146-add-indexes-to-file-table.yaml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/147-add-quotechar-to-component-mapping.yaml
|
file: db/changelog/tenant/147-add-layout-parsing-type-to-dossier-template.yaml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/148-remove-based-on-dict-annotation-id-columns.yaml
|
file: db/changelog/tenant/148-add-quotechar-to-component-mapping.yaml
|
||||||
|
- include:
|
||||||
|
file: db/changelog/tenant/149-remove-based-on-dict-annotation-id-columns.yaml
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
databaseChangeLog:
|
||||||
|
- changeSet:
|
||||||
|
id: 144-add-error-code-to-file
|
||||||
|
author: dom
|
||||||
|
changes:
|
||||||
|
- addColumn:
|
||||||
|
columns:
|
||||||
|
- column:
|
||||||
|
name: error_code
|
||||||
|
type: VARCHAR(255)
|
||||||
|
tableName: file
|
||||||
@ -76,7 +76,7 @@ public class ComponentOverrideTest extends AbstractPersistenceServerServiceTest
|
|||||||
|
|
||||||
var dossierTemplate = dossierTemplateClient.getDossierTemplate(dossier.getDossierTemplateId());
|
var dossierTemplate = dossierTemplateClient.getDossierTemplate(dossier.getDossierTemplateId());
|
||||||
|
|
||||||
var file = fileTesterAndProvider.testAndProvideFile(dossier, "filename");
|
var file = fileTesterAndProvider.testAndProvideFile(dossier, "filename1");
|
||||||
|
|
||||||
System.out.println("DOSSIER TEMPLATE ID: " + dossierTemplate.getId());
|
System.out.println("DOSSIER TEMPLATE ID: " + dossierTemplate.getId());
|
||||||
System.out.println("DOSSIER ID: " + dossier.getId());
|
System.out.println("DOSSIER ID: " + dossier.getId());
|
||||||
@ -199,7 +199,7 @@ public class ComponentOverrideTest extends AbstractPersistenceServerServiceTest
|
|||||||
|
|
||||||
var dossierTemplate = dossierTemplateClient.getDossierTemplate(dossier.getDossierTemplateId());
|
var dossierTemplate = dossierTemplateClient.getDossierTemplate(dossier.getDossierTemplateId());
|
||||||
|
|
||||||
var file = fileTesterAndProvider.testAndProvideFile(dossier, "filename");
|
var file = fileTesterAndProvider.testAndProvideFile(dossier, "filename2");
|
||||||
|
|
||||||
System.out.println("DOSSIER TEMPLATE ID: " + dossierTemplate.getId());
|
System.out.println("DOSSIER TEMPLATE ID: " + dossierTemplate.getId());
|
||||||
System.out.println("DOSSIER ID: " + dossier.getId());
|
System.out.println("DOSSIER ID: " + dossier.getId());
|
||||||
@ -261,7 +261,7 @@ public class ComponentOverrideTest extends AbstractPersistenceServerServiceTest
|
|||||||
assertTrue(overrides.getComponentOverrides().isEmpty());
|
assertTrue(overrides.getComponentOverrides().isEmpty());
|
||||||
|
|
||||||
// case 2: re-upload file that was deleted before overrides should also not be returned anymore
|
// case 2: re-upload file that was deleted before overrides should also not be returned anymore
|
||||||
fileTesterAndProvider.testAndProvideFile(dossier, "filename");
|
fileTesterAndProvider.testAndProvideFile(dossier, "filename3");
|
||||||
|
|
||||||
var e = assertThrows(FeignException.class, () -> componentClient.getOverrides(dossierTemplate.getId(), dossier.getId(), file.getId()));
|
var e = assertThrows(FeignException.class, () -> componentClient.getOverrides(dossierTemplate.getId(), dossier.getId(), file.getId()));
|
||||||
assertEquals(e.status(), 404);
|
assertEquals(e.status(), 404);
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
package com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file;
|
||||||
|
|
||||||
|
public enum ErrorCode {
|
||||||
|
RULES_EXECUTION_TIMEOUT, LOCKED_RULES, MISSING_DOCX_PDFTRON_LICENSE
|
||||||
|
}
|
||||||
@ -18,6 +18,7 @@ public class FileErrorInfo {
|
|||||||
private String queue;
|
private String queue;
|
||||||
private String service;
|
private String service;
|
||||||
private OffsetDateTime timestamp;
|
private OffsetDateTime timestamp;
|
||||||
|
private ErrorCode errorCode;
|
||||||
|
|
||||||
|
|
||||||
public FileErrorInfo(String cause, String queue, String service) {
|
public FileErrorInfo(String cause, String queue, String service) {
|
||||||
@ -28,4 +29,23 @@ public class FileErrorInfo {
|
|||||||
this.timestamp = OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS);
|
this.timestamp = OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public FileErrorInfo(String cause, String queue, String service, OffsetDateTime timestamp) {
|
||||||
|
|
||||||
|
this.cause = cause;
|
||||||
|
this.queue = queue;
|
||||||
|
this.service = service;
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FileErrorInfo(String cause, String queue, String service, ErrorCode errorCode) {
|
||||||
|
|
||||||
|
this.cause = cause;
|
||||||
|
this.queue = queue;
|
||||||
|
this.service = service;
|
||||||
|
this.timestamp = OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS);
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user