Pull request #313: Processed value for manual redactions that are dictionary entries
Merge in RED/persistence-service from processed-date-patch-m to master * commit '01c129866a3c0bbf3550f51574a5710891536085': Processed value for manual redactions that are dictionary entries
This commit is contained in:
commit
abe621570e
@ -9,6 +9,7 @@ import java.util.Set;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.model.annotations.entitymapped.ManualRedactionEntry;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -41,7 +42,8 @@ public class AddRedactionPersistenceService {
|
||||
manualRedactionEntry.setTypeId(addRedactionRequest.getTypeId());
|
||||
manualRedactionEntry.setDictionaryEntryType(addRedactionRequest.getDictionaryEntryType());
|
||||
|
||||
if (addRedactionRequest.getStatus() == AnnotationStatus.APPROVED) {
|
||||
if (addRedactionRequest.getStatus() == AnnotationStatus.APPROVED
|
||||
&& !(addRedactionRequest.isAddToDictionary() || addRedactionRequest.isAddToDossierDictionary())) {
|
||||
manualRedactionEntry.setProcessedDate(OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
|
||||
}
|
||||
|
||||
@ -125,4 +127,9 @@ public class AddRedactionPersistenceService {
|
||||
manualRedactionRepository.updateStatus(fileIds, value, AnnotationStatus.REQUESTED, AnnotationStatus.APPROVED, OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void markAsProcessed(ManualRedactionEntry e) {
|
||||
|
||||
manualRedactionRepository.markAsProcessed(new AnnotationEntityId(e.getAnnotationId(), e.getFileId()), OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS));
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,4 +50,7 @@ public interface ManualRedactionRepository extends JpaRepository<ManualRedaction
|
||||
@Query("update ManualRedactionEntryEntity m set m.status = :newStatus, m.processedDate = :processedDate where m.id.fileId in :fileIds and m.value = :filterValue and m.addToDictionary = true and m.status = :filterStatus ")
|
||||
void updateStatus(Set<String> fileIds, String filterValue, AnnotationStatus filterStatus, AnnotationStatus newStatus, OffsetDateTime processedDate);
|
||||
|
||||
@Modifying
|
||||
@Query("update ManualRedactionEntryEntity m set m.processedDate = :processedDate where m.id = :annotationEntityId")
|
||||
void markAsProcessed(AnnotationEntityId annotationEntityId, OffsetDateTime processedDate);
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ public class ManualRedactionService {
|
||||
addToDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossierId, fileId, DictionaryEntryType.ENTRY);
|
||||
}
|
||||
}
|
||||
} else if(redactionLogEntryOptional.isPresent() && redactionLogEntryOptional.get().isHint()){
|
||||
} else if (redactionLogEntryOptional.isPresent() && redactionLogEntryOptional.get().isHint()) {
|
||||
reprocess(dossierId, fileId);
|
||||
}
|
||||
|
||||
@ -597,6 +597,9 @@ public class ManualRedactionService {
|
||||
// These are marked as processed once analysis completes, not when they are set as approved
|
||||
if (manualRedactions != null) {
|
||||
|
||||
if (manualRedactions.getEntriesToAdd() != null) {
|
||||
manualRedactions.getEntriesToAdd().forEach(addRedactionPersistenceService::markAsProcessed);
|
||||
}
|
||||
if (manualRedactions.getIdsToRemove() != null) {
|
||||
manualRedactions.getIdsToRemove().forEach(removeRedactionPersistenceService::markAsProcessed);
|
||||
}
|
||||
@ -604,8 +607,7 @@ public class ManualRedactionService {
|
||||
manualRedactions.getForceRedactions().forEach(forceRedactionPersistenceService::markAsProcessed);
|
||||
}
|
||||
if (manualRedactions.getImageRecategorization() != null) {
|
||||
manualRedactions.getImageRecategorization()
|
||||
.forEach(recategorizationPersistenceService::markAsProcessed);
|
||||
manualRedactions.getImageRecategorization().forEach(recategorizationPersistenceService::markAsProcessed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user