RED-10268: Prepared download creates zip file although the data inside the dossier have been deleted
added filter for soft or hard deleted files on download preperation
This commit is contained in:
parent
d4448fa798
commit
fa36ce7fea
@ -7,23 +7,17 @@ import java.io.BufferedInputStream;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.io.InputStreamResource;
|
import org.springframework.core.io.InputStreamResource;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.context.request.RequestAttributes;
|
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
@ -160,8 +154,11 @@ public class DownloadController implements DownloadResource {
|
|||||||
}
|
}
|
||||||
} // otherwise consider the files from dossier
|
} // otherwise consider the files from dossier
|
||||||
|
|
||||||
|
log.info("files: {}",
|
||||||
|
validFiles.stream()
|
||||||
|
.toList());
|
||||||
var validFilesAndNotProcessed = validFiles.stream()
|
var validFilesAndNotProcessed = validFiles.stream()
|
||||||
.filter(f -> !(f.getAnalysisVersion() > 0 && f.getNumberOfAnalyses() > 0))
|
.filter(f -> !(f.getAnalysisVersion() > 0 && f.getNumberOfAnalyses() > 0 && !f.isSoftOrHardDeleted()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!validFilesAndNotProcessed.isEmpty()) {
|
if (!validFilesAndNotProcessed.isEmpty()) {
|
||||||
throw new BadRequestException("At least a file is in its initial analysis process");
|
throw new BadRequestException("At least a file is in its initial analysis process");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user