Skip to content

Commit

Permalink
fli-iam#2488 : removing requirement for processing comment filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckflipXYZ committed Dec 4, 2024
1 parent 85a6294 commit 6a92540
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void massiveDownloadProcessingByExaminationIds(
@Parameter(description = "id of the examination", required = true) @Valid
@RequestBody List<Long> examinationIds,
@Parameter(description = "comment of the desired processings") @Valid
@RequestParam(value = "processingComment") String processingComment,
@RequestParam(value = "processingComment", required = false) String processingComment,
@Parameter(description = "outputs to extract") @Valid
@RequestParam(value = "resultOnly", defaultValue = "false") boolean resultOnly, HttpServletResponse response) throws RestServiceException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void massiveDownloadProcessingByExaminationIds(
@Parameter(description = "ids of examination", required=true) @Valid
@RequestBody List<Long> examinationIds,
@Parameter(description = "comment of the desired processings") @Valid
@RequestParam(value = "processingComment") String processingComment,
@RequestParam(value = "processingComment", required = false) String processingComment,
@Parameter(description = "outputs to extract") @Valid
@RequestParam(value = "resultOnly") boolean resultOnly,
HttpServletResponse response) throws RestServiceException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void massiveDownload(List<DatasetProcessing> processingList, boolean resu
Map<Long, List<String>> filesByAcquisitionId = new HashMap<>();

try (ZipOutputStream zipOutputStream = new ZipOutputStream(response.getOutputStream())) {
manageProcessingsDownload(processingList, downloadResults, zipOutputStream, format, withManifest, filesByAcquisitionId, converterId);
manageProcessingsDownload(processingList,q downloadResults, zipOutputStream, format, withManifest, filesByAcquisitionId, converterId);

String ids = String.join(",", Stream.concat(processingList.stream().map(DatasetProcessing::getInputDatasets), processingList.stream().map(DatasetProcessing::getOutputDatasets)).map(dataset -> ((Dataset) dataset).getId().toString()).collect(Collectors.toList()));
ShanoirEvent event = new ShanoirEvent(ShanoirEventType.DOWNLOAD_DATASET_EVENT, ids,
Expand Down Expand Up @@ -99,7 +99,10 @@ private void manageProcessingsDownload(List<DatasetProcessing> processingList, M

public void massiveDownloadByExaminations(List<Examination> examinationList, String processingComment, boolean resultOnly, String format, HttpServletResponse response, boolean withManifest, Long converterId) throws RestServiceException {
List<Long> processingIdsList = datasetProcessingRepository.findAllIdsByExaminationIds(examinationList.stream().map(Examination::getId).toList());
List<DatasetProcessing> processingList = datasetProcessingService.findAllById(processingIdsList).stream().filter(it -> Objects.equals(it.getComment(), processingComment)).toList();
List<DatasetProcessing> processingList = datasetProcessingService.findAllById(processingIdsList);
if(!Objects.isNull(processingComment)){
processingList = processingList.stream().filter(it -> Objects.equals(it.getComment(), processingComment)).toList();
};
massiveDownload(processingList, resultOnly, format, response, withManifest, converterId);
}

Expand Down

0 comments on commit 6a92540

Please sign in to comment.