Pull request #582: RED-5809

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

* commit 'a074180241ac4a8dd359e0a9e8988092475f3dea':
  RED-5809: removed unnecessary import
  RED-5809: updated processedTime when declining a requested image recategoration redaction
  RED-5809: updated processedTime when declining a requested force redaction
  RED-5809: updated processedTime when declining a requested force redaction
This commit is contained in:
Ali Oezyetimoglu 2022-12-21 10:45:43 +01:00
commit 8589f8e188
3 changed files with 18 additions and 10 deletions

View File

@ -77,10 +77,10 @@ public class ForceRedactionPersistenceService {
return new HashSet<>(forceRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions));
}
@Transactional
public void markAsProcessed(String annotationId, String fileId) {
public void markAsProcessed(ManualForceRedaction e) {
forceRedactionRepository.markAsProcessed(new AnnotationEntityId(e.getAnnotationId(), e.getFileId()), OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
forceRedactionRepository.markAsProcessed(new AnnotationEntityId(annotationId, fileId), OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
}
}

View File

@ -78,10 +78,10 @@ public class ImageRecategorizationPersistenceService {
}
@Transactional
public void markAsProcessed(String annotationId, String fileId) {
public void markAsProcessed(ManualImageRecategorization e) {
imageRecategorizationRepository.markAsProcessed(new AnnotationEntityId(e.getAnnotationId(), e.getFileId()), OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
imageRecategorizationRepository.markAsProcessed(new AnnotationEntityId(annotationId, fileId), OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
}
}

View File

@ -618,7 +618,11 @@ public class ManualRedactionService {
for (var annotationId : annotationIds) {
var forceRedaction = forceRedactionPersistenceService.findForceRedaction(fileId, annotationId);
forceRedactionPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
actionPerformed = actionPerformed || !(forceRedaction.getStatus() == AnnotationStatus.REQUESTED && annotationStatus == AnnotationStatus.DECLINED);
boolean isDeclined = forceRedaction.getStatus() == AnnotationStatus.REQUESTED && annotationStatus == AnnotationStatus.DECLINED;
actionPerformed = actionPerformed || !isDeclined;
if (isDeclined) {
forceRedactionPersistenceService.markAsProcessed(annotationId, fileId);
}
}
if (actionPerformed) {
@ -654,7 +658,11 @@ public class ManualRedactionService {
for (var annotationId : annotationIds) {
var imageRecategorization = recategorizationPersistenceService.findRecategorization(fileId, annotationId);
recategorizationPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
actionPerformed = actionPerformed || !(imageRecategorization.getStatus() == AnnotationStatus.REQUESTED && annotationStatus == AnnotationStatus.DECLINED);
boolean isDeclined = imageRecategorization.getStatus() == AnnotationStatus.REQUESTED && annotationStatus == AnnotationStatus.DECLINED;
actionPerformed = actionPerformed || !isDeclined;
if (isDeclined) {
recategorizationPersistenceService.markAsProcessed(annotationId, fileId);
}
}
if (actionPerformed) {
@ -752,14 +760,14 @@ public class ManualRedactionService {
if (manualRedactions.getForceRedactions() != null) {
manualRedactions.getForceRedactions().forEach(e -> {
if (!e.getStatus().equals(AnnotationStatus.REQUESTED) && e.getProcessedDate() == null) {
forceRedactionPersistenceService.markAsProcessed(e);
forceRedactionPersistenceService.markAsProcessed(e.getAnnotationId(), e.getFileId());
}
});
}
if (manualRedactions.getImageRecategorization() != null) {
manualRedactions.getImageRecategorization().forEach(e -> {
if (!e.getStatus().equals(AnnotationStatus.REQUESTED) && e.getProcessedDate() == null) {
recategorizationPersistenceService.markAsProcessed(e);
recategorizationPersistenceService.markAsProcessed(e.getAnnotationId(), e.getFileId());
}
});
}