Merge branch 'master' into RED-1098

This commit is contained in:
Viktor Seifert 2022-06-30 16:21:32 +02:00
commit 30561e5601
24 changed files with 338 additions and 116 deletions

View File

@ -6,6 +6,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.OffsetDateTime;
@Data
@Builder
@NoArgsConstructor
@ -21,6 +23,9 @@ public class Watermark {
private int opacity;
private int fontSize;
private String fontType;
private String createdBy;
private OffsetDateTime dateAdded;
private OffsetDateTime dateModified;
private WatermarkOrientation orientation;
}

View File

@ -1,6 +1,6 @@
package com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file;
public enum ProcessingStatus {
ANALYSE, ERROR, FULLREPROCESS, IMAGE_ANALYZING, INDEXING, NER_ANALYZING, OCR_PROCESSING, PROCESSED, PROCESSING, REPROCESS, SURROUNDING_TEXT_PROCESSING, UNPROCESSED, FULL_PROCESSING, PRE_PROCESSING, PRE_PROCESSED, PRE_PROCESSING_FAILED
ANALYSE, ERROR, FULLREPROCESS, IMAGE_ANALYZING, INDEXING, NER_ANALYZING, OCR_PROCESSING, PROCESSED, PROCESSING, REPROCESS, SURROUNDING_TEXT_PROCESSING, UNPROCESSED, FULL_PROCESSING, PRE_PROCESSING, PRE_PROCESSED
}

View File

@ -24,8 +24,6 @@ public interface UploadResource {
String DOSSIER_ID_PARAM = "dossierId";
String DOSSIER_ID_PATH_PARAM = "/{" + DOSSIER_ID_PARAM + "}";
String FLATTEN_PARAM = "flatten";
@PostMapping(value = UPLOAD_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces =
MediaType.APPLICATION_JSON_VALUE)

View File

@ -1,5 +1,6 @@
package com.iqser.red.service.persistence.service.v1.api.resources;
import com.iqser.red.service.persistence.service.v1.api.model.common.JSONPrimitive;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.configuration.Watermark;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@ -11,12 +12,13 @@ import java.util.List;
public interface WatermarkResource {
String WATERMARK_PATH = "/watermark";
String CHECK_USED_REST_PATH = "/used";
String WATERMARK_ID_PARAMETER_NAME = "watermarkId";
String WATERMARK_ID_PATH_VARIABLE = "/{" + WATERMARK_ID_PARAMETER_NAME + "}";
String DOSSIER_TEMPLATE_ID_PARAMETER_NAME = "dossierTemplateId";
@ResponseStatus(HttpStatus.CREATED)
@ResponseStatus(HttpStatus.OK)
@PostMapping(value = WATERMARK_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
Watermark createOrUpdateWatermark(@RequestBody Watermark watermark);
@ -30,4 +32,8 @@ public interface WatermarkResource {
@DeleteMapping(value = WATERMARK_PATH + WATERMARK_ID_PATH_VARIABLE)
void deleteWatermark(@PathVariable(WATERMARK_ID_PARAMETER_NAME) long watermarkId);
@ResponseStatus(value = HttpStatus.OK)
@GetMapping(value = WATERMARK_PATH + CHECK_USED_REST_PATH , produces = MediaType.APPLICATION_JSON_VALUE)
JSONPrimitive<Boolean> isWatermarkUsed(@RequestParam(WATERMARK_ID_PARAMETER_NAME) long watermarkId);
}

View File

@ -12,6 +12,7 @@ import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import javax.persistence.*;
import java.time.OffsetDateTime;
@Data
@Builder
@ -40,7 +41,12 @@ public class WatermarkEntity {
private int fontSize;
@Column
private String fontType;
@Column
private String createdBy;
@Column
private OffsetDateTime dateAdded;
@Column
private OffsetDateTime dateModified;
@Column
@Enumerated(EnumType.STRING)
private WatermarkOrientation orientation;

View File

@ -15,7 +15,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.time.OffsetDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Optional;
@Slf4j
@Service
@ -28,7 +31,7 @@ public class WatermarkService {
@Transactional
public void deleteWatermark(Long watermarkId) {
public void deleteWatermark(long watermarkId) {
watermarkRepository.findById(watermarkId).ifPresentOrElse(loadedWatermark -> {
dossierRepository.countDeleteWatermark(watermarkId);
dossierRepository.countDeletePreviewWatermark(watermarkId);
@ -39,7 +42,7 @@ public class WatermarkService {
}
public WatermarkEntity getWatermark(Long watermarkId) {
public WatermarkEntity getWatermark(long watermarkId) {
return watermarkRepository.findById(watermarkId)
.orElseThrow(() -> new NotFoundException("Watermark Configuration not found"));
@ -51,25 +54,31 @@ public class WatermarkService {
validateWatermark(watermark);
if (watermark.getId() != null) { // update
watermarkRepository.findById(watermark.getId())
.ifPresentOrElse(loadedWatermark -> {
validateWatermarkNameIsUnique(watermark.getName(), watermark.getDossierTemplateId(), loadedWatermark.getId());
BeanUtils.copyProperties(watermark, loadedWatermark, "dossierTemplateId");
var dossierTemplate = dossierTemplatePersistenceService.getDossierTemplate(watermark.getDossierTemplateId());
loadedWatermark.setDossierTemplate(dossierTemplate);
}, () -> {
validateWatermarkNameIsUnique(watermark.getName(), watermark.getDossierTemplateId(), 0);
WatermarkEntity watermarkEntity = new WatermarkEntity();
BeanUtils.copyProperties(watermark, watermarkEntity, "id");
var dossierTemplate = dossierTemplatePersistenceService.getDossierTemplate(watermark.getDossierTemplateId());
watermarkEntity.setDossierTemplate(dossierTemplate);
watermarkRepository.save(watermarkEntity);
});
return watermarkRepository.findById(watermark.getId()).orElseThrow(() -> new NotFoundException("Watermark Configuration not found"));
Optional<WatermarkEntity> loadedWatermark = watermarkRepository.findById(watermark.getId());
if (loadedWatermark.isPresent()) {
validateDossierTemplateId(watermark.getDossierTemplateId(), loadedWatermark.get().getDossierTemplateId());
validateWatermarkNameIsUnique(watermark.getName(), loadedWatermark.get().getDossierTemplateId(), loadedWatermark.get().getId());
BeanUtils.copyProperties(watermark, loadedWatermark.get(), "dossierTemplateId", "createdBy", "dateAdded", "dateModified");
loadedWatermark.get().setDateModified(OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
var dossierTemplate = dossierTemplatePersistenceService.getDossierTemplate(loadedWatermark.get().getDossierTemplateId());
loadedWatermark.get().setDossierTemplate(dossierTemplate);
return loadedWatermark.get();
} else { // if not found by id -> add it as a new watermark
validateDossierTemplateId(watermark.getDossierTemplateId(), null);
validateWatermarkNameIsUnique(watermark.getName(), watermark.getDossierTemplateId(), 0);
WatermarkEntity watermarkEntity = new WatermarkEntity();
BeanUtils.copyProperties(watermark, watermarkEntity, "id", "dateAdded", "dateModified");
watermarkEntity.setDateAdded(OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
var dossierTemplate = dossierTemplatePersistenceService.getDossierTemplate(watermark.getDossierTemplateId());
watermarkEntity.setDossierTemplate(dossierTemplate);
return watermarkRepository.save(watermarkEntity);
}
} else {
validateDossierTemplateId(watermark.getDossierTemplateId(), null);
validateWatermarkNameIsUnique(watermark.getName(), watermark.getDossierTemplateId(), 0);
WatermarkEntity watermarkEntity = new WatermarkEntity();
BeanUtils.copyProperties(watermark, watermarkEntity, "id");
BeanUtils.copyProperties(watermark, watermarkEntity, "id", "dateAdded", "dateModified");
watermarkEntity.setDateAdded(OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
var dossierTemplate = dossierTemplatePersistenceService.getDossierTemplate(watermark.getDossierTemplateId());
watermarkEntity.setDossierTemplate(dossierTemplate);
return watermarkRepository.save(watermarkEntity);
@ -80,7 +89,7 @@ public class WatermarkService {
private void validateWatermark(Watermark watermark) {
if (StringUtils.isBlank(watermark.getName())) {
throw new BadRequestException("The watermark name must not be null");
throw new BadRequestException("The watermark name must not be empty");
}
if (StringUtils.isNotBlank(watermark.getText()) && !StringUtils.isAsciiPrintable(StringUtils.normalizeSpace(watermark.getText()))) {
throw new BadRequestException("The watermark may only contain ASCII characters");
@ -88,6 +97,14 @@ public class WatermarkService {
}
private void validateDossierTemplateId(String newDossierTemplateId, String existingDossierTemplateId) {
if (newDossierTemplateId == null && existingDossierTemplateId == null) {
throw new BadRequestException("The dossier template id is not provided");
}
if (newDossierTemplateId != null && existingDossierTemplateId != null && !existingDossierTemplateId.equals(newDossierTemplateId)) {
throw new ConflictException("The watermark dossier template id does not match");
}
}
private void validateWatermarkNameIsUnique(String watermarkName, String dossierTemplateId, long watermarkId) {
getWatermarksForDossierTemplateId(dossierTemplateId).forEach(existing -> {
if (existing.getName().equals(watermarkName) && existing.getId() != watermarkId) {
@ -100,4 +117,10 @@ public class WatermarkService {
return watermarkRepository.findByDossierTemplateId(dossierTemplateId);
}
public boolean isWatermarkUsed(long watermarkId) {
watermarkRepository.findById(watermarkId); //check if watermark exists
int count = dossierRepository.countDossiersWithWatermarkInUse(watermarkId);
return count != 0;
}
}

View File

@ -101,9 +101,12 @@ public class DossierPersistenceService {
if (createOrUpdateDossierRequest.getWatermarkId() != null) {
var watermarkEntity = watermarkService.getWatermark(createOrUpdateDossierRequest.getWatermarkId());
if (watermarkEntity.getDossierTemplateId().equals(createOrUpdateDossierRequest.getDossierTemplateId())) {
if (!watermarkEntity.isEnabled()) {
throw new BadRequestException("Watermark configuration is disabled");
}
dossier.setWatermark(watermarkEntity);
} else {
log.debug("Invalid watermark id");
throw new BadRequestException("Invalid watermark id - dossierTemplate id does not match");
}
} else {
dossier.setWatermark(null);
@ -111,9 +114,12 @@ public class DossierPersistenceService {
if (createOrUpdateDossierRequest.getPreviewWatermarkId() != null) {
var previewWatermarkEntity = watermarkService.getWatermark(createOrUpdateDossierRequest.getPreviewWatermarkId());
if (previewWatermarkEntity.getDossierTemplateId().equals(createOrUpdateDossierRequest.getDossierTemplateId())) {
if (!previewWatermarkEntity.isEnabled()) {
throw new BadRequestException("Preview watermark configuration is disabled");
}
dossier.setPreviewWatermark(previewWatermarkEntity);
} else {
log.debug("Invalid preview watermark id");
throw new BadRequestException("Invalid preview watermark id - dossierTemplate id does not match");
}
} else {
dossier.setPreviewWatermark(null);

View File

@ -68,17 +68,6 @@ public class FileStatusPersistenceService {
}
@Transactional
public void updateProcessingStatusPreprocessingFailed(String fileId) {
if (isFileDeleted(fileId)) {
return;
}
fileRepository.updateProcessingStatus(fileId, ProcessingStatus.PRE_PROCESSING_FAILED, OffsetDateTime.now()
.truncatedTo(ChronoUnit.MILLIS), calculateProcessingErrorCounter(fileId, ProcessingStatus.PRE_PROCESSING_FAILED));
}
@Transactional
public void updateProcessingStatus(String fileId, int numberOfPages, long dictionaryVersion, long rulesVersion, long legalBasisVersion, long duration,
long dossierDictionaryVersion, int analysisVersion, int analysisNumber) {
@ -328,9 +317,9 @@ public class FileStatusPersistenceService {
countUpdate = fileRepository.overwriteFile(fileId, filename, uploader, ProcessingStatus.UNPROCESSED, WorkflowStatus.NEW, OffsetDateTime.now()
.truncatedTo(ChronoUnit.MILLIS), OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
deleteFileAttributes(fileId);
}
deleteFileAttributes(fileId);
if (countUpdate == 0) {
throw new NotFoundException("Unknown file=" + fileId);
@ -370,9 +359,9 @@ public class FileStatusPersistenceService {
}
public List<FileEntity> getAllRelevantStatusesForReanalysisScheduler() {
public List<FileEntity> getAllRelevantStatusesForReanalysisScheduler(int maxRetries) {
return fileRepository.getAllRelevantStatusesForReanalysisScheduler();
return fileRepository.getAllRelevantStatusesForReanalysisScheduler(maxRetries);
}
@ -394,7 +383,6 @@ public class FileStatusPersistenceService {
switch (processingStatus) {
case ERROR:
case PRE_PROCESSING_FAILED:
return fileRepository.findById(fileId).map(FileEntity::getProcessingErrorCounter).orElse(0) + 1;
case PROCESSED:

View File

@ -61,9 +61,12 @@ public interface DossierRepository extends JpaRepository<DossierEntity, String>
@Modifying
@Query("update DossierEntity d set d.watermarkId = null where d.watermarkId = :watermarkId")
int countDeleteWatermark(Long watermarkId);
int countDeleteWatermark(long watermarkId);
@Modifying
@Query("update DossierEntity d set d.previewWatermarkId = null where d.previewWatermarkId = :previewWatermarkId")
int countDeletePreviewWatermark(Long previewWatermarkId);
int countDeletePreviewWatermark(long previewWatermarkId);
@Query("select count(d) from DossierEntity d where d.watermarkId = :watermarkId or d.previewWatermarkId = :watermarkId")
int countDossiersWithWatermarkInUse(long watermarkId);
}

View File

@ -122,7 +122,7 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.filename = :filename, f.uploader = :uploader, f.processingStatus = :processingStatus, " + "f.lastUploaded = :lastUploaded, f.lastUpdated = :lastUpdated, f.fileManipulationDate = :lastUploaded, " + "f.lastOCRTime = null, f.lastProcessed = null, f.lastReviewer = null, f.lastApprover = null, " + "f.approvalDate = null, f.numberOfAnalyses = 0, f.lastManualChangeDate = null, f.redactionModificationDate = null, " + "f.dictionaryVersion = 0, f.dossierDictionaryVersion = 0, f.rulesVersion = 0, f.hasImages = false, " + "f.hasHints = false, f.hasRedactions = false, f.hasSuggestions = false, f.hasUpdates = false, " + "f.deleted = null, f.hardDeletedTime = null, f.hasHighlights = false, f.processingErrorCounter = 0 where f.id = :fileId")
@Query("update FileEntity f set f.filename = :filename, f.uploader = :uploader, f.processingStatus = :processingStatus, " + "f.lastUploaded = :lastUploaded, f.lastUpdated = :lastUpdated, f.fileManipulationDate = :lastUploaded, " + "f.lastProcessed = null," + "f.approvalDate = null, f.numberOfAnalyses = 0, f.lastManualChangeDate = null, f.redactionModificationDate = null, " + "f.dictionaryVersion = 0, f.dossierDictionaryVersion = 0, f.rulesVersion = 0, f.hasImages = false, " + "f.hasHints = false, f.hasRedactions = false, f.hasSuggestions = false, f.hasUpdates = false, " + "f.deleted = null, f.hardDeletedTime = null, f.hasHighlights = false, f.processingErrorCounter = 0 where f.id = :fileId")
int overwriteFileAndKeepManualRedactions(String fileId, String filename, String uploader, ProcessingStatus processingStatus, OffsetDateTime lastUploaded,
OffsetDateTime lastUpdated);
@ -149,8 +149,8 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
void setLastManualChangeDate(String fileId, OffsetDateTime lastManualChangeDate, OffsetDateTime lastUpdated);
@Query("select f from FileEntity f join DossierEntity d on d.id = f.dossierId where f.workflowStatus <> 'APPROVED' and f.excludedFromAutomaticAnalysis = false " + "and ( f.processingStatus = 'PROCESSED' or f.processingStatus = 'UNPROCESSED' or f.processingStatus = 'ERROR' )" + "and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " + "and f.deleted is null and f.hardDeletedTime is null")
List<FileEntity> getAllRelevantStatusesForReanalysisScheduler();
@Query("select f from FileEntity f join DossierEntity d on d.id = f.dossierId where f.workflowStatus <> 'APPROVED' and f.excludedFromAutomaticAnalysis = false " + "and ( f.processingStatus = 'PROCESSED' or f.processingStatus = 'UNPROCESSED' or f.processingStatus = 'ERROR' )" + "and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null " + "and f.deleted is null and f.hardDeletedTime is null and f.processingErrorCounter <= :maxRetries")
List<FileEntity> getAllRelevantStatusesForReanalysisScheduler(int maxRetries);
@Modifying(clearAutomatically = true)

View File

@ -19,6 +19,7 @@ import com.iqser.red.service.persistence.service.v1.api.resources.DictionaryReso
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@ -116,6 +117,13 @@ public class DictionaryController implements DictionaryResource {
validateColor(typeValueRequest.getHexColor());
validateBoolean(typeValueRequest.isHint(), "isHint");
validateBoolean(typeValueRequest.isCaseInsensitive(), "isCaseInsensitive");
String skippedHexColor = typeValueRequest.getSkippedHexColor();
if (StringUtils.isBlank(skippedHexColor)) { //use the default value
skippedHexColor = colorsService.getColors(typeValueRequest.getDossierTemplateId()).getNotRedacted();
typeValueRequest.setSkippedHexColor(skippedHexColor);
} else {
validateColor(skippedHexColor);
}
// To check whether the type exists
Type typeResult = convert(dictionaryPersistenceService.getType(typeId), Type.class);
@ -169,7 +177,13 @@ public class DictionaryController implements DictionaryResource {
}
String color = typeRequest.getHexColor();
validateColor(color);
return convert(dictionaryPersistenceService.addType(typeRequest.getType(), typeRequest.getDossierTemplateId(), color, typeRequest.getRecommendationHexColor(), typeRequest.getSkippedHexColor(), typeRequest.getRank(), typeRequest.isHint(), typeRequest.isCaseInsensitive(), typeRequest.isRecommendation(), typeRequest.getDescription(), typeRequest.isAddToDictionaryAction(), typeRequest.getLabel(), typeRequest.getDossierId(), typeRequest.isHasDictionary(), typeRequest.isSystemManaged(), typeRequest.isAutoHideSkipped()), Type.class);
String skippedHexColor = typeRequest.getSkippedHexColor();
if (StringUtils.isBlank(skippedHexColor)) { //use the default value
skippedHexColor = colorsService.getColors(typeRequest.getDossierTemplateId()).getNotRedacted();
} else {
validateColor(typeRequest.getSkippedHexColor());
}
return convert(dictionaryPersistenceService.addType(typeRequest.getType(), typeRequest.getDossierTemplateId(), color, typeRequest.getRecommendationHexColor(), skippedHexColor, typeRequest.getRank(), typeRequest.isHint(), typeRequest.isCaseInsensitive(), typeRequest.isRecommendation(), typeRequest.getDescription(), typeRequest.isAddToDictionaryAction(), typeRequest.getLabel(), typeRequest.getDossierId(), typeRequest.isHasDictionary(), typeRequest.isSystemManaged(), typeRequest.isAutoHideSkipped()), Type.class);
}

View File

@ -91,9 +91,9 @@ public class FileStatusController implements StatusResource {
String assignee = fileStatus.getAssignee();
if (userId != null) {
assignee = userId;
fileStatusService.setAssignee(fileId, assignee);
}
fileStatusService.setStatusSuccessful(fileId, assignee != null ? WorkflowStatus.UNDER_REVIEW : WorkflowStatus.NEW);
fileStatusService.setAssignee(fileId, assignee);
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
indexingService.addToIndexingQueue(IndexMessageType.UPDATE, null, dossierId, fileId, 2);
}
@ -108,8 +108,8 @@ public class FileStatusController implements StatusResource {
assignee = approverId;
}
fileStatusService.setStatusSuccessful(fileId, assignee != null ? WorkflowStatus.UNDER_APPROVAL : WorkflowStatus.NEW);
fileStatusService.setAssignee(fileId, approverId);
fileStatusService.setStatusSuccessful(fileId, assignee != null ? WorkflowStatus.UNDER_APPROVAL : WorkflowStatus.NEW);
analysisFlagsCalculationService.calculateFlags(dossierId, fileId);
indexingService.addToIndexingQueue(IndexMessageType.UPDATE, null, dossierId, fileId, 2);
}

View File

@ -1,13 +1,12 @@
package com.iqser.red.service.peristence.v1.server.controller;
import com.iqser.red.service.persistence.management.v1.processor.service.WatermarkService;
import com.iqser.red.service.persistence.service.v1.api.model.common.JSONPrimitive;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.configuration.Watermark;
import com.iqser.red.service.persistence.service.v1.api.resources.WatermarkResource;
import lombok.RequiredArgsConstructor;
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 org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -38,4 +37,8 @@ public class WatermarkController implements WatermarkResource {
watermarkService.deleteWatermark(watermarkId);
}
public JSONPrimitive<Boolean> isWatermarkUsed(@RequestParam(WATERMARK_ID_PARAMETER_NAME) long watermarkId) {
return JSONPrimitive.of(watermarkService.isWatermarkUsed(watermarkId));
}
}

View File

@ -43,7 +43,7 @@ public class FileStatusProcessingUpdateService {
fileStatusService.setStatusAnalyse(dossierId, fileId, false);
//TODO This might be also priority depending on what was the pervious call.
fileStatusService.addToAnalysisQueue(dossierId, fileId, false, null, false);
fileStatusService.addToAnalysisQueue(dossierId, fileId, false, null);
}
break;
@ -80,7 +80,7 @@ public class FileStatusProcessingUpdateService {
public void preprocessingFailed(String dossierId, String fileId) {
fileStatusService.updateProcessingStatusPreprocessingFailed(dossierId, fileId);
setStatusError(dossierId, fileId, "preprocessingFailed");
}

View File

@ -74,14 +74,13 @@ public class FileStatusService {
private final FileManagementServiceSettings settings;
private final ReanalysisRequiredStatusService reanalysisRequiredStatusService;
private final ViewedPagesPersistenceService viewedPagesPersistenceService;
private final ApplicationConfigService applicationConfigService;
private final FileManagementServiceSettings fileManagementServiceSettings;
@Transactional
public List<FileModel> getAllRelevantStatusesForReanalysisScheduler() {
var fileEntities = fileStatusPersistenceService.getAllRelevantStatusesForReanalysisScheduler();
var fileEntities = fileStatusPersistenceService.getAllRelevantStatusesForReanalysisScheduler(fileManagementServiceSettings.getMaxErrorRetries());
var convertedList = convert(fileEntities, FileModel.class, new FileModelMapper());
return reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(convertedList).stream().filter(FileModel::isAnalysisRequired).collect(Collectors.toList());
}
@ -125,7 +124,7 @@ public class FileStatusService {
public void updateProcessingStatusPreprocessed(String dossierId, String fileId, boolean hasHighlights, long fileSize) {
fileStatusPersistenceService.updateProcessingStatusPreprocessed(fileId, hasHighlights, fileSize);
addToAnalysisQueue(dossierId, fileId, false, Set.of(), false);
addToAnalysisQueue(dossierId, fileId, false, Set.of());
if (fileManagementServiceSettings.isPdf2ImageServiceEnabled()) {
addToPdf2ImageQueue(dossierId, fileId);
@ -134,16 +133,6 @@ public class FileStatusService {
}
public void updateProcessingStatusPreprocessingFailed(String dossierId, String fileId) {
// TODO add better logic than always reprocess.
fileStatusPersistenceService.updateProcessingStatusPreprocessingFailed(fileId);
var fileEntity = fileStatusPersistenceService.getStatus(fileId);
addToPreprocessingQueue(dossierId, fileId, fileEntity.getFilename());
}
public void setExcludedPages(String fileId, Set<Integer> excludedPages) {
fileStatusPersistenceService.setExcludedPages(fileId, excludedPages);
@ -203,13 +192,8 @@ public class FileStatusService {
return;
}
if (fileStatus.getProcessingErrorCounter() >= settings.getMaxErrorRetries() && !triggeredManually) {
log.warn("File {} was {} times retried with failure", fileStatus.getId(), fileStatus.getProcessingErrorCounter());
return;
}
fileStatusPersistenceService.updateProcessingStatus(fileId, ProcessingStatus.REPROCESS);
addToAnalysisQueue(dossierId, fileId, priority, sectionsToReanalyse, triggeredManually);
addToAnalysisQueue(dossierId, fileId, priority, sectionsToReanalyse);
}
@ -235,18 +219,13 @@ public class FileStatusService {
return;
}
if (fileStatus.getProcessingErrorCounter() >= settings.getMaxErrorRetries()) {
log.warn("File {} was {} times retried with failure", fileStatus.getId(), fileStatus.getProcessingErrorCounter());
return;
}
if (requiresStructureAnalysis) {
log.info("Delete text and NER entities from file {} in dossier {}", fileId, dossierId);
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.TEXT);
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.NER_ENTITIES);
}
addToAnalysisQueue(dossierId, fileId, priority, Sets.newHashSet(), false);
addToAnalysisQueue(dossierId, fileId, priority, Sets.newHashSet());
}
@ -262,18 +241,18 @@ public class FileStatusService {
@Transactional
protected void addToAnalysisQueue(String dossierId, String fileId, boolean priority, Set<Integer> sectionsToReanalyse, boolean triggeredManually) {
protected void addToAnalysisQueue(String dossierId, String fileId, boolean priority, Set<Integer> sectionsToReanalyse) {
var dossier = dossierPersistenceService.getAndValidateDossier(dossierId);
var fileEntity = fileStatusPersistenceService.getStatus(fileId);
if (fileEntity.isExcluded()) {
log.debug("File {} is excluded", fileEntity.getId());
if(!fileManagementStorageService.objectExists(dossierId, fileId, FileType.ORIGIN)){
addToPreprocessingQueue(dossierId, fileId, fileEntity.getFilename());
return;
}
if (fileEntity.getProcessingErrorCounter() >= settings.getMaxErrorRetries() && !triggeredManually) {
log.warn("File {} was {} times retried with failure", fileEntity.getId(), fileEntity.getProcessingErrorCounter());
if (fileEntity.isExcluded()) {
log.debug("File {} is excluded", fileEntity.getId());
return;
}
@ -347,7 +326,7 @@ public class FileStatusService {
public void createStatus(String dossierId, String fileId, String uploader, String filename) {
fileStatusPersistenceService.createStatus(dossierId, fileId, filename, uploader);
addToPreprocessingQueue(dossierId, fileId, filename);
addToAnalysisQueue(dossierId, fileId,false, Set.of());
}
@ -405,10 +384,10 @@ public class FileStatusService {
String lastReviewer = fileStatus.getLastReviewer();
String lastApprover = fileStatus.getLastApprover();
if (WorkflowStatus.UNDER_REVIEW.equals(fileStatus.getWorkflowStatus())) {
lastReviewer = StringUtils.isNotEmpty(assignee) ? assignee : fileStatus.getAssignee();
lastReviewer = StringUtils.isNotEmpty(assignee) ? fileStatus.getAssignee() : lastReviewer;
}
if (WorkflowStatus.UNDER_APPROVAL.equals(fileStatus.getWorkflowStatus())) {
lastApprover = StringUtils.isNotEmpty(assignee) ? assignee : fileStatus.getAssignee();
lastApprover = StringUtils.isNotEmpty(assignee) ? fileStatus.getAssignee() : lastApprover;
}
fileStatusPersistenceService.setAssignee(fileId, assignee, lastReviewer, lastApprover);
@ -442,11 +421,6 @@ public class FileStatusService {
return;
}
if (fileStatus.getProcessingErrorCounter() >= settings.getMaxErrorRetries()) {
log.warn("File {} was {} times retried with failure", fileStatus.getId(), fileStatus.getProcessingErrorCounter());
return;
}
fileStatusPersistenceService.updateProcessingStatus(fileId, ProcessingStatus.OCR_PROCESSING);
addToOcrQueue(dossierId, fileId, 2);
}
@ -497,6 +471,7 @@ public class FileStatusService {
public void overwriteFile(String dossierId, String fileId, String uploader, String filename, boolean keepManualRedactions) {
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.ORIGIN);
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.REDACTION_LOG);
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.SECTION_GRID);
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.IMAGE_INFO);
@ -512,7 +487,7 @@ public class FileStatusService {
viewedPagesPersistenceService.deleteForFile(fileId);
addToPreprocessingQueue(dossierId, fileId, filename);
addToAnalysisQueue(dossierId, fileId, false, Set.of());
}
@ -567,13 +542,8 @@ public class FileStatusService {
return;
}
if (fileStatus.getProcessingErrorCounter() >= settings.getMaxErrorRetries()) {
log.warn("File {} was {} times retried with failure", fileStatus.getId(), fileStatus.getProcessingErrorCounter());
return;
}
fileStatusPersistenceService.updateProcessingStatus(fileId, ProcessingStatus.ANALYSE);
addToAnalysisQueue(dossierId, fileId, priority, Sets.newHashSet(), false);
addToAnalysisQueue(dossierId, fileId, priority, Sets.newHashSet());
}

View File

@ -402,7 +402,7 @@ public class ManualRedactionService {
var dossier = dossierPersistenceService.getAndValidateDossier(dossierId);
var actionPerformed = false;
var redactionLog = fileManagementStorageService.getRedactionLog(dossier.getId(), fileId);
RedactionLog redactionLog = redactionLogService.getRedactionLog(dossierId, fileId, true, true);
for (var annotationId : annotationIds) {
@ -540,7 +540,7 @@ public class ManualRedactionService {
AnnotationStatus annotationStatus) {
var dossier = dossierPersistenceService.getAndValidateDossier(dossierId);
RedactionLog redactionLog = fileManagementStorageService.getRedactionLog(dossierId, fileId);
RedactionLog redactionLog = redactionLogService.getRedactionLog(dossierId, fileId, true, true);
for (var annotationId : annotationIds) {
IdRemovalEntity idRemoval = removeRedactionPersistenceService.findRemoveRedaction(fileId, annotationId);

View File

@ -40,9 +40,6 @@ public class RedactionLogService {
var fileStatus = fileStatusService.getStatus(fileId);
if (fileStatus.isExcluded()) {
throw new NotFoundException("Excluded files have no redactionLog");
}
RedactionLog redactionLog;
if (withManualRedactions) {

View File

@ -30,6 +30,6 @@ public class FileManagementServiceSettings {
private boolean pdf2ImageServiceEnabled;
private int maxErrorRetries = 5;
private int maxErrorRetries = 1;
}

View File

@ -1,6 +1,6 @@
-- add the generated id to watermark_configuration table
alter table watermark_configuration add column id BIGINT GENERATED ALWAYS AS IDENTITY;
alter table watermark_configuration add column name VARCHAR (255), add column enabled BOOLEAN DEFAULT TRUE;
alter table watermark_configuration add column name VARCHAR (255), add column enabled BOOLEAN DEFAULT TRUE, add column created_by VARCHAR (255), add column date_added TIMESTAMP WITHOUT TIME ZONE, add column date_modified TIMESTAMP WITHOUT TIME ZONE;
--initialise the new columns for the current watermark configurations
update watermark_configuration set name = 'Watermark ' || id, enabled = true;

View File

@ -58,6 +58,21 @@ public class DictionaryTest extends AbstractPersistenceServerServiceTest {
assertThat(loadedType.getFalseRecommendationEntries()).hasSize(2);
}
@Test
public void testSkippedColor() {
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
var type = typeProvider.testAndProvideType(dossierTemplate);
assertThat(type.getRecommendationHexColor()).isEqualTo("#aaaaaa");
assertThat(type.getSkippedHexColor()).isEqualTo("#aaaaaa");
type.setSkippedHexColor(null);
dictionaryClient.updateTypeValue(type.getTypeId(), type);
var loadedType = dictionaryClient.getDictionaryForType(type.getId(), null);
assertThat(loadedType.getSkippedHexColor()).isNotNull();
}
@Test
public void testAddEntriesWithStopWord() {

View File

@ -66,6 +66,10 @@ public class DossierTest extends AbstractPersistenceServerServiceTest {
var watermarkConfig = watermarkClient.createOrUpdateWatermark(watermark);
watermark.setEnabled(false);
watermark.setName("watermark disabled");
var watermarkConfigDisabled = watermarkClient.createOrUpdateWatermark(watermark);
var allDossiers = dossierClient.getAllDossiers(false, false);
assertThat(allDossiers.size()).isEqualTo(1);
assertThat(allDossiers.get(0)).isEqualTo(dossier);
@ -79,7 +83,7 @@ public class DossierTest extends AbstractPersistenceServerServiceTest {
cru.setWatermarkId(watermarkConfig.getId());
BeanUtils.copyProperties(dossier, cru);
cru.setDossierName("Dossier 1 Update");
cru.setPreviewWatermarkId(watermarkConfig.getId());
cru.setPreviewWatermarkId(watermarkConfigDisabled.getId());
// Create dossier status
CreateOrUpdateDossierStatusRequest crudsr = new CreateOrUpdateDossierStatusRequest();
crudsr.setName("name1");
@ -91,11 +95,20 @@ public class DossierTest extends AbstractPersistenceServerServiceTest {
cru.setDossierStatusId(loadedDossierStatus.getId());
try {
dossierClient.updateDossier(cru, dossier.getId());
} catch (FeignException e) {
assertThat(e.status()).isEqualTo(400);
}
cru.setPreviewWatermarkId(watermarkConfig.getId());
var updated = dossierClient.updateDossier(cru, dossier.getId());
assertThat(updated.getDossierName()).isEqualTo("Dossier 1 Update");
assertThat(updated.getPreviewWatermarkId()).isEqualTo(watermarkConfig.getId());
assertThat(updated.getDossierStatusId()).isEqualTo(loadedDossierStatus.getId());
assertThat(watermarkClient.isWatermarkUsed(watermarkConfig.getId())).isEqualTo(JSONPrimitive.of(true));
// put dossier status to null
cru.setDossierStatusId(null);
updated = dossierClient.updateDossier(cru, dossier.getId());

View File

@ -491,4 +491,51 @@ public class FileTest extends AbstractPersistenceServerServiceTest {
}
@Test
public void testFile4424() {
var start = OffsetDateTime.now();
var dossier = dossierTesterAndProvider.provideTestDossier();
var file = fileTesterAndProvider.testAndProvideFile(dossier);
// update dossier - add new member
CreateOrUpdateDossierRequest cru = new CreateOrUpdateDossierRequest();
BeanUtils.copyProperties(dossier, cru);
cru.getMemberIds().add("2");
var loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
assertThat(loadedFile.getAssignee()).isNull();
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.NEW);
assertThat(loadedFile.getLastReviewer()).isNull();
assertThat(loadedFile.getLastApprover()).isNull();
fileClient.setStatusUnderReview(dossier.getId(), file.getId(), "1");
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_REVIEW);
assertThat(loadedFile.getAssignee()).isEqualTo("1");
assertThat(loadedFile.getLastReviewer()).isNull();
assertThat(loadedFile.getLastApprover()).isNull();
fileClient.setCurrentFileAssignee(dossier.getId(), file.getId(), "2");
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_REVIEW);
assertThat(loadedFile.getAssignee()).isEqualTo("2");
assertThat(loadedFile.getLastReviewer()).isEqualTo("1");
assertThat(loadedFile.getLastApprover()).isNull();
fileClient.setStatusUnderApproval(dossier.getId(), file.getId(), "2");
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_APPROVAL);
assertThat(loadedFile.getAssignee()).isEqualTo("2");
assertThat(loadedFile.getLastReviewer()).isEqualTo("2");
assertThat(loadedFile.getLastApprover()).isNull();
fileClient.setCurrentFileAssignee(dossier.getId(), file.getId(), "1");
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
assertThat(loadedFile.getWorkflowStatus()).isEqualTo(WorkflowStatus.UNDER_APPROVAL);
assertThat(loadedFile.getAssignee()).isEqualTo("1");
assertThat(loadedFile.getLastReviewer()).isEqualTo("2");
assertThat(loadedFile.getLastApprover()).isEqualTo("2");
}
}

View File

@ -10,6 +10,7 @@ import com.iqser.red.service.peristence.v1.server.integration.service.FileTester
import com.iqser.red.service.peristence.v1.server.integration.service.TypeProvider;
import com.iqser.red.service.peristence.v1.server.integration.utils.AbstractPersistenceServerServiceTest;
import com.iqser.red.service.peristence.v1.server.service.FileManagementStorageService;
import com.iqser.red.service.peristence.v1.server.service.RedactionLogService;
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.FileStatusPersistenceService;
import com.iqser.red.service.persistence.service.v1.api.model.annotations.*;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileType;
@ -24,6 +25,7 @@ import lombok.SneakyThrows;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime;
@ -68,6 +70,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
@Autowired
private FileClient fileClient;
@Test
@SneakyThrows
public void testManualRedaction3641() {
@ -300,10 +303,12 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.removeFromDictionary(false)
.build())).get(0);
fileManagementStorageService.storeObject(dossier.getId(), file.getId(), FileType.REDACTION_LOG, objectMapper.writeValueAsBytes(new RedactionLog(1, 1,
List.of(RedactionLogEntry.builder().id(removeRedaction.getAnnotationId()).type("manual").value("value entry").build()),
null, 0, 0, 0, 0)));
var redactionLog = new RedactionLog(1, 1,
List.of(RedactionLogEntry.builder().id(addRedaction.getAnnotationId()).type("manual").value("value entry").build()),
null, 0, 0, 0, 0);
fileManagementStorageService.storeObject(dossier.getId(), file.getId(), FileType.REDACTION_LOG, objectMapper.writeValueAsBytes(redactionLog));
when(redactionClient.getRedactionLog(Mockito.any())).thenReturn(redactionLog);
manualRedactionClient.updateRemoveRedactionStatus(dossier.getId(), file.getId(),
UpdateRedactionRequest.builder()
.annotationIds(List.of(removeRedaction.getAnnotationId()))
@ -326,10 +331,12 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
loadedRemoveRedaction = manualRedactionClient.getRemoveRedaction(file.getId(), addRedaction.getAnnotationId());
assertThat(loadedRemoveRedaction.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
fileManagementStorageService.storeObject(dossier.getId(), file.getId(), FileType.REDACTION_LOG, objectMapper.writeValueAsBytes(new RedactionLog(1, 1,
var redLog = new RedactionLog(1, 1,
List.of(RedactionLogEntry.builder().id("annotationId").type("manual").value("value entry").build()),
null, 0, 0, 0, 0)));
null, 0, 0, 0, 0);
fileManagementStorageService.storeObject(dossier.getId(), file.getId(), FileType.REDACTION_LOG, objectMapper.writeValueAsBytes(redLog));
when(redactionClient.getRedactionLog(Mockito.any())).thenReturn(redLog);
var removeRedaction2 = manualRedactionClient.addRemoveRedaction(dossier.getId(), file.getId(), List.of(RemoveRedactionRequest.builder()
.annotationId("annotationId")
.comment("comment")

View File

@ -3,7 +3,12 @@ package com.iqser.red.service.peristence.v1.server.integration.tests;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertThrows;
import com.iqser.red.service.peristence.v1.server.integration.client.DossierClient;
import com.iqser.red.service.peristence.v1.server.integration.service.DossierTesterAndProvider;
import com.iqser.red.service.persistence.service.v1.api.model.common.JSONPrimitive;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.CreateOrUpdateDossierRequest;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.iqser.red.service.peristence.v1.server.integration.client.WatermarkClient;
@ -19,9 +24,15 @@ public class WatermarkTest extends AbstractPersistenceServerServiceTest {
@Autowired
private DossierTemplateTesterAndProvider dossierTemplateTesterAndProvider;
@Autowired
private DossierTesterAndProvider dossierTesterAndProvider;
@Autowired
private WatermarkClient watermarkClient;
@Autowired
private DossierClient dossierClient;
@Test
public void testWatermark() {
@ -42,15 +53,57 @@ public class WatermarkTest extends AbstractPersistenceServerServiceTest {
watermark.setOpacity(20);
watermark.setOrientation(WatermarkOrientation.DIAGONAL);
watermark.setDossierTemplateId(dossierTemplate.getId());
watermark.setCreatedBy("user");
var saved = watermarkClient.createOrUpdateWatermark(watermark);
var loadedWatermark = watermarkClient.getWatermark(saved.getId());
assertThat(loadedWatermark).isEqualTo(saved);
assertThat(saved.getDateAdded()).isNotNull();
// try to save the same watermark without id
try {
watermarkClient.createOrUpdateWatermark(watermark);
} catch (FeignException e) {
assertThat(e.status()).isEqualTo(409);
}
// try to save the same watermark with id
try {
watermarkClient.createOrUpdateWatermark(saved);
} catch (FeignException e) {
assertThat(e.status()).isEqualTo(409);
}
// update current watermark
saved.setFontSize(14);
saved = watermarkClient.createOrUpdateWatermark(saved);
loadedWatermark = watermarkClient.getWatermark(saved.getId());
assertThat(loadedWatermark).isEqualTo(saved);
saved.setEnabled(true);
saved.setDossierTemplateId(null);
var updated = watermarkClient.createOrUpdateWatermark(saved);
assertThat(updated.getDossierTemplateId()).isEqualTo(dossierTemplate.getId());
assertThat(updated.getDateModified()).isNotNull();
assertThat(updated.isEnabled()).isTrue();
assertThat(watermarkClient.isWatermarkUsed(updated.getId())).isEqualTo(JSONPrimitive.of(false));
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
// update dossier with watermark config
CreateOrUpdateDossierRequest cru = new CreateOrUpdateDossierRequest();
BeanUtils.copyProperties(dossier, cru);
cru.setWatermarkId(updated.getId());
var updatedDossier = dossierClient.updateDossier(cru, dossier.getId());
assertThat(updatedDossier.getWatermarkId()).isEqualTo(updated.getId());
assertThat(watermarkClient.isWatermarkUsed(updated.getId())).isEqualTo(JSONPrimitive.of(true));
// update current watermark with new dossier template id
updated.setDossierTemplateId("dossierTemplate2");
try {
watermarkClient.createOrUpdateWatermark(updated);
} catch (FeignException e) {
assertThat(e.status()).isEqualTo(409);
}
var watermarkList = watermarkClient.getWatermarksForDossierTemplateId(dossierTemplate.getId());
assertThat(watermarkList.size()).isEqualTo(1);
@ -66,6 +119,30 @@ public class WatermarkTest extends AbstractPersistenceServerServiceTest {
} catch (FeignException.FeignClientException e) {
assertThat(e.status()).isEqualTo(409);
}
}
@Test
public void testDeleteWatermark() {
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
Watermark watermark = new Watermark();
watermark.setName("watermark name");
watermark.setText("Minions ipsum chasy para tu la bodaaa bananaaaa hana dul sae. Chasy hana dul sae pepete hana dul sae belloo! Tatata bala tu ti aamoo! Jeje.");
watermark.setFontSize(12);
watermark.setFontType("font");
watermark.setHexColor("#dddddd");
watermark.setOpacity(20);
watermark.setOrientation(WatermarkOrientation.DIAGONAL);
watermark.setDossierTemplateId(dossierTemplate.getId());
var saved = watermarkClient.createOrUpdateWatermark(watermark);
var loadedWatermark = watermarkClient.getWatermark(saved.getId());
assertThat(loadedWatermark).isEqualTo(saved);
// Delete first time
watermarkClient.deleteWatermark(saved.getId());
@ -75,8 +152,52 @@ public class WatermarkTest extends AbstractPersistenceServerServiceTest {
assertThat(e.status()).isEqualTo(404);
}
// try to delete a not existing watermark
try {
watermarkClient.deleteWatermark(saved.getId());
} catch (FeignException e) {
assertThat(e.status()).isEqualTo(404);
}
}
@Test
public void testCreateWatermark() {
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
Watermark watermark = new Watermark();
watermark.setName("watermark name");
watermark.setText("Minions ipsum chasy para tu la bodaaa bananaaaa hana dul sae. Chasy hana dul sae pepete hana dul sae belloo! Tatata bala tu ti aamoo! Jeje.");
watermark.setFontSize(12);
watermark.setFontType("font");
watermark.setHexColor("#dddddd");
watermark.setOpacity(20);
watermark.setOrientation(WatermarkOrientation.DIAGONAL);
watermark.setDossierTemplateId(dossierTemplate.getId());
var saved = watermarkClient.createOrUpdateWatermark(watermark);
var loadedWatermark = watermarkClient.getWatermark(saved.getId());
assertThat(loadedWatermark).isEqualTo(saved);
// try to save the same watermark
try {
watermarkClient.createOrUpdateWatermark(watermark);
} catch (FeignException e) {
assertThat(e.status()).isEqualTo(409);
}
Watermark watermark2 = new Watermark();
watermark.setName("watermark name2");
watermark.setText("Minions ipsum chasy para tu la bodaaa bananaaaa hana dul sae. Chasy hana dul sae pepete hana dul sae belloo! Tatata bala tu ti aamoo! Jeje.");
watermark.setFontSize(12);
watermark.setOrientation(WatermarkOrientation.DIAGONAL);
watermark.setDossierTemplateId(dossierTemplate.getId());
var saved2 = watermarkClient.createOrUpdateWatermark(watermark);
var loadedWatermark2 = watermarkClient.getWatermark(saved.getId());
}
@Test
public void testWatermarkTextWithWrongText() {