mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 15:33:09 +00:00
extract bitstream thumbnail name pattern into own function
This commit is contained in:
@@ -403,9 +403,7 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
||||
|
||||
@Override
|
||||
public Bitstream getThumbnail(Context context, Bitstream bitstream) throws SQLException {
|
||||
Pattern pattern = Pattern.compile("^" +
|
||||
(bitstream.getName() != null ? Pattern.quote(bitstream.getName()) : bitstream.getName())
|
||||
+ ".([^.]+)$");
|
||||
Pattern pattern = getBitstreamNamePattern(bitstream);
|
||||
|
||||
for (Bundle bundle : bitstream.getBundles()) {
|
||||
for (Item item : bundle.getItems()) {
|
||||
@@ -422,6 +420,13 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Pattern getBitstreamNamePattern(Bitstream bitstream) {
|
||||
if (bitstream.getName() != null) {
|
||||
return Pattern.compile("^" + Pattern.quote(bitstream.getName()) + ".([^.]+)$");
|
||||
}
|
||||
return Pattern.compile("^" + bitstream.getName() + ".([^.]+)$");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BitstreamFormat getFormat(Context context, Bitstream bitstream) throws SQLException {
|
||||
if (bitstream.getBitstreamFormat() == null) {
|
||||
|
Reference in New Issue
Block a user