mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 23:43:06 +00:00
[Task 71441] altered the processFiles endpoint and added the process filetypes endpoint with tests
This commit is contained in:
@@ -14,7 +14,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
@@ -23,7 +25,9 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.authorize.service.AuthorizeService;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataField;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.ProcessStatus;
|
||||
import org.dspace.content.dao.ProcessDAO;
|
||||
import org.dspace.content.service.BitstreamFormatService;
|
||||
@@ -227,4 +231,18 @@ public class ProcessServiceImpl implements ProcessService {
|
||||
return processDAO.countRows(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getFileTypesForProcessBitstreams(Context context, Process process) {
|
||||
List<Bitstream> list = getBitstreams(context, process);
|
||||
Set<String> fileTypesSet = new HashSet<>();
|
||||
for (Bitstream bitstream : list) {
|
||||
List<MetadataValue> metadata = bitstreamService.getMetadata(bitstream,
|
||||
Process.BITSTREAM_TYPE_METADATAFIELD, Item.ANY);
|
||||
if (metadata != null && !metadata.isEmpty()) {
|
||||
fileTypesSet.add(metadata.get(0).getValue());
|
||||
}
|
||||
}
|
||||
return new ArrayList<>(fileTypesSet);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user