Pull request #173: RED-3014: Sort soft deleted files and soft deleted dossier responses by soft deleted date / time descending

Merge in RED/persistence-service from RED-3014-ps1 to master

* commit '1f66ef0efbb62be28f21735033241bc7abac0dc0':
  RED-3014: Sort soft deleted files and soft deleted dossier responses by soft deleted date / time descending
This commit is contained in:
Ali Oezyetimoglu 2022-01-11 10:02:11 +01:00
commit 0a660d5e60
2 changed files with 8 additions and 2 deletions

View File

@ -127,10 +127,13 @@ public class DossierController implements DossierResource {
@Transactional
public List<Dossier> getSoftDeletedDossiers() {
return convert(dossierService.getAllDossiers()
var softDeletedDossiers = convert(dossierService.getAllDossiers()
.stream()
.filter(p -> p.getStatus().equals(DossierStatus.DELETED) && p.getHardDeletedTime() == null)
.collect(Collectors.toList()), Dossier.class, new DossierMapper());
softDeletedDossiers.sort((dossier1, dossier2) -> dossier2.getSoftDeletedTime().compareTo(dossier1.getSoftDeletedTime()));
return softDeletedDossiers;
}

View File

@ -61,10 +61,13 @@ public class FileStatusController implements StatusResource {
@Override
public List<FileModel> getSoftDeletedDossierStatus(@PathVariable(DOSSIER_ID_PARAM) String dossierId) {
return reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(convert(fileStatusService.getDossierStatus(dossierId)
var softDeletedFiles = reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(convert(fileStatusService.getDossierStatus(dossierId)
.stream()
.filter(f -> f.getProcessingStatus().equals(ProcessingStatus.DELETED) && f.getHardDeletedTime() == null)
.collect(Collectors.toList()), FileModel.class, new FileModelMapper()));
softDeletedFiles.sort((f1, f2) -> f2.getDeleted().compareTo(f1.getDeleted()));
return softDeletedFiles;
}