Pull request #8: RED-2232: Upgraded redaction-report-service and pdftron-redaction-service

Merge in RED/persistence-service from RED-2232 to master

* commit '8bd2ab2ddc78d18609e86c927ffa2b681bf77d91':
  RED-2232: Upgraded redaction-report-service and pdftron-redaction-service
This commit is contained in:
Dominique Eiflaender 2021-09-23 15:08:57 +02:00 committed by aoezyetimoglu
commit f48f2994b6
8 changed files with 34 additions and 42 deletions

View File

@ -9,6 +9,7 @@ public class IdentityTest {
@Test @Test
public void mockTest(){ public void mockTest(){
assertThat(1).isEqualTo(1); int i = 1;
assertThat(i).isEqualTo(1);
} }
} }

View File

@ -145,12 +145,6 @@ public class FileStatusPersistenceService {
}); });
} }
public void updateLastManualRedaction(String fileId) {
updateLastManualRedaction(fileId, OffsetDateTime.now());
}
@Transactional @Transactional
public void updateLastManualRedaction(String fileId, OffsetDateTime date) { public void updateLastManualRedaction(String fileId, OffsetDateTime date) {

View File

@ -8,6 +8,7 @@ public class IdentityTest {
@Test @Test
public void mockTest(){ public void mockTest(){
assertThat(1).isEqualTo(1); int i = 1;
assertThat(i).isEqualTo(1);
} }
} }

View File

@ -26,7 +26,7 @@
<dependency> <dependency>
<groupId>com.iqser.red.service</groupId> <groupId>com.iqser.red.service</groupId>
<artifactId>redaction-report-service-api-v1</artifactId> <artifactId>redaction-report-service-api-v1</artifactId>
<version>2.17.0</version> <version>3.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.iqser.red.service</groupId> <groupId>com.iqser.red.service</groupId>
@ -36,18 +36,6 @@
<groupId>com.iqser.red.service</groupId> <groupId>com.iqser.red.service</groupId>
<artifactId>persistence-service-api-v1</artifactId> <artifactId>persistence-service-api-v1</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>file-management-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId>
</exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>configuration-service-api-v1</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
@ -69,16 +57,12 @@
<dependency> <dependency>
<groupId>com.iqser.red.service</groupId> <groupId>com.iqser.red.service</groupId>
<artifactId>pdftron-redaction-service-api-v1</artifactId> <artifactId>pdftron-redaction-service-api-v1</artifactId>
<version>2.12.0</version> <version>3.0.0</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.iqser.red.service</groupId> <groupId>com.iqser.red.service</groupId>
<artifactId>redaction-service-api-v1</artifactId> <artifactId>redaction-service-api-v1</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>com.iqser.red.service</groupId>
<artifactId>configuration-service-api-v1</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>

View File

@ -279,7 +279,7 @@ public class DictionaryController implements DictionaryResource {
List<Type> typeResponse = dictionaryPersistenceService.getCumulatedTypes(dossierTemplateId, dossierId); List<Type> typeResponse = dictionaryPersistenceService.getCumulatedTypes(dossierTemplateId, dossierId);
for (Type res : typeResponse) { for (Type res : typeResponse) {
if (typeId != res.getId() && labelToCheck.equals(res.getLabel())) { if (!typeId.equals(res.getId()) && labelToCheck.equals(res.getLabel())) {
throw new ConflictException("Label must be unique."); throw new ConflictException("Label must be unique.");
} }
} }

View File

@ -68,7 +68,6 @@ public class DossierAttributesController implements DossierAttributesResource {
} }
@Override @Override
@Transactional
public List<DossierAttribute> getDossierAttributes(@PathVariable(DOSSIER_ID_PARAM) String dossierId) { public List<DossierAttribute> getDossierAttributes(@PathVariable(DOSSIER_ID_PARAM) String dossierId) {
return dossierAttributePersistenceService.getDossierAttributes(dossierId); return dossierAttributePersistenceService.getDossierAttributes(dossierId);
} }

View File

@ -263,7 +263,7 @@ public class FileStatusService {
fileStatusPersistenceService.updateLastOCRTime(fileId, OffsetDateTime.now()); fileStatusPersistenceService.updateLastOCRTime(fileId, OffsetDateTime.now());
} }
@Transactional
public void overwriteFile(String dossierId, String fileId, String uploader, String filename, int length) { public void overwriteFile(String dossierId, String fileId, String uploader, String filename, int length) {
fileStatusPersistenceService.overwriteFile(fileId, uploader, filename); fileStatusPersistenceService.overwriteFile(fileId, uploader, filename);

View File

@ -4,6 +4,7 @@ import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing; import com.google.common.hash.Hashing;
import com.iqser.red.service.peristence.v1.server.controller.DictionaryController; import com.iqser.red.service.peristence.v1.server.controller.DictionaryController;
import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException; import com.iqser.red.service.persistence.management.v1.processor.exception.BadRequestException;
import com.iqser.red.service.persistence.management.v1.processor.exception.NotFoundException;
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.*; import com.iqser.red.service.persistence.management.v1.processor.service.persistence.*;
import com.iqser.red.service.persistence.service.v1.api.model.*; import com.iqser.red.service.persistence.service.v1.api.model.*;
import com.iqser.red.service.persistence.service.v1.api.model.data.annotations.*; import com.iqser.red.service.persistence.service.v1.api.model.data.annotations.*;
@ -17,7 +18,7 @@ import org.springframework.stereotype.Service;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.util.List; import java.util.List;
import java.util.Optional;
@Slf4j @Slf4j
@Service @Service
@ -253,7 +254,7 @@ public class ManualRedactionService {
boolean hasSuggestions = calculateHasSuggestions(fileId); boolean hasSuggestions = calculateHasSuggestions(fileId);
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions); fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
} else { } else {
fileStatusPersistenceService.updateLastManualRedaction(fileId); fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
} }
} }
@ -272,7 +273,7 @@ public class ManualRedactionService {
boolean hasSuggestions = calculateHasSuggestions(fileId); boolean hasSuggestions = calculateHasSuggestions(fileId);
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions); fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
} else { } else {
fileStatusPersistenceService.updateLastManualRedaction(fileId); fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
} }
} }
@ -287,7 +288,7 @@ public class ManualRedactionService {
boolean hasSuggestions = calculateHasSuggestions(fileId); boolean hasSuggestions = calculateHasSuggestions(fileId);
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions); fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
} else { } else {
fileStatusPersistenceService.updateLastManualRedaction(fileId); fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
} }
} }
@ -301,7 +302,7 @@ public class ManualRedactionService {
boolean hasSuggestions = calculateHasSuggestions(fileId); boolean hasSuggestions = calculateHasSuggestions(fileId);
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions); fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
} else { } else {
fileStatusPersistenceService.updateLastManualRedaction(fileId); fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
} }
} }
@ -316,7 +317,7 @@ public class ManualRedactionService {
boolean hasSuggestions = calculateHasSuggestions(fileId); boolean hasSuggestions = calculateHasSuggestions(fileId);
fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions); fileStatusPersistenceService.setUpdateLastManualRedactionAndHasSuggestions(fileId, OffsetDateTime.now(), hasSuggestions);
} else { } else {
fileStatusPersistenceService.updateLastManualRedaction(fileId); fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
fileStatusService.setStatusReprocess(dossierId, fileId, 100); fileStatusService.setStatusReprocess(dossierId, fileId, 100);
} }
} }
@ -324,7 +325,7 @@ public class ManualRedactionService {
public void deleteComment(String fileId, long commentId) { public void deleteComment(String fileId, long commentId) {
fileStatusPersistenceService.updateLastManualRedaction(fileId); fileStatusPersistenceService.updateLastManualRedaction(fileId, OffsetDateTime.now());
commentPersistenceService.softDelete(commentId, OffsetDateTime.now()); commentPersistenceService.softDelete(commentId, OffsetDateTime.now());
// update indicator // update indicator
@ -341,11 +342,17 @@ public class ManualRedactionService {
if (idRemoval.isRemoveFromDictionary()) { if (idRemoval.isRemoveFromDictionary()) {
RedactionLog redactionLog = fileManagementStorageService.getRedactionLog(dossierId, fileId); RedactionLog redactionLog = fileManagementStorageService.getRedactionLog(dossierId, fileId);
RedactionLogEntry redactionLogEntry = redactionLog.getRedactionLogEntry() Optional<RedactionLogEntry> redactionLogEntryOptional = redactionLog.getRedactionLogEntry()
.stream() .stream()
.filter(entry -> entry.getId().equals(idRemoval.getId().getId())) .filter(entry -> entry.getId().equals(idRemoval.getId().getId()))
.findFirst() .findFirst();
.get();
if(!redactionLogEntryOptional.isPresent()) {
throw new NotFoundException("Annotation does not exist in redaction log.");
}
var redactionLogEntry = redactionLogEntryOptional.get();
if (annotationStatus == AnnotationStatus.APPROVED) { if (annotationStatus == AnnotationStatus.APPROVED) {
removeFromDictionary(redactionLogEntry.getTypeId(), redactionLogEntry.getValue(), dossierId, fileId); removeFromDictionary(redactionLogEntry.getTypeId(), redactionLogEntry.getValue(), dossierId, fileId);
@ -460,11 +467,17 @@ public class ManualRedactionService {
if (removeFromDictionary) { if (removeFromDictionary) {
RedactionLog redactionLog = fileManagementStorageService.getRedactionLog(dossierId, fileId); RedactionLog redactionLog = fileManagementStorageService.getRedactionLog(dossierId, fileId);
RedactionLogEntry redactionLogEntry = redactionLog.getRedactionLogEntry() Optional<RedactionLogEntry> redactionLogEntryOptional = redactionLog.getRedactionLogEntry()
.stream() .stream()
.filter(entry -> entry.getId().equals(annotationId)) .filter(entry -> entry.getId().equals(annotationId))
.findFirst() .findFirst();
.get();
if(!redactionLogEntryOptional.isPresent()) {
throw new NotFoundException("Annotation does not exist in redaction log.");
}
var redactionLogEntry = redactionLogEntryOptional.get();
if (revert) { if (revert) {
addToDictionary(redactionLogEntry.getTypeId(), redactionLogEntry.getValue(), dossierId, fileId); addToDictionary(redactionLogEntry.getTypeId(), redactionLogEntry.getValue(), dossierId, fileId);
} else { } else {