Skip to content

Commit

Permalink
116430: Support for multiple input files per process
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Vannerum committed Jul 15, 2024
1 parent 5a43e6b commit 4e68164
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;

import org.apache.commons.cli.CommandLine;
Expand Down Expand Up @@ -158,4 +159,8 @@ public UUID getEpersonIdentifier() {
public void setEpersonIdentifier(UUID epersonIdentifier) {
this.epersonIdentifier = epersonIdentifier;
}

public Optional<String> fileParameterToBitstreamType(String fileParameter) {
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void runDSpaceScript(List<MultipartFile> files, Context context, ScriptC
dSpaceRunnable.initialize(args.toArray(new String[0]), restDSpaceRunnableHandler, context.getCurrentUser());
if (files != null && !files.isEmpty()) {
checkFileNames(dSpaceRunnable, files);
processFiles(context, restDSpaceRunnableHandler, files);
processFiles(context, restDSpaceRunnableHandler, files, dSpaceRunnable);
}
restDSpaceRunnableHandler.schedule(dSpaceRunnable);
} catch (ParseException e) {
Expand All @@ -171,11 +171,12 @@ private void runDSpaceScript(List<MultipartFile> files, Context context, ScriptC
}

private void processFiles(Context context, RestDSpaceRunnableHandler restDSpaceRunnableHandler,
List<MultipartFile> files)
throws IOException, SQLException, AuthorizeException {
List<MultipartFile> files, DSpaceRunnable dspaceRunnable)
throws IOException, SQLException, AuthorizeException {
for (MultipartFile file : files) {
restDSpaceRunnableHandler
.writeFilestream(context, file.getOriginalFilename(), file.getInputStream(), "inputfile");
String type = (String) dspaceRunnable.fileParameterToBitstreamType(file.getName())
.orElse("inputfile");
restDSpaceRunnableHandler.writeFilestream(context, file.getOriginalFilename(), file.getInputStream(), type);
}
}

Expand Down

0 comments on commit 4e68164

Please sign in to comment.