mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
extract bitstream thumbnail name pattern into own function
(cherry picked from commit c5466c2249
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
af5632c2f2
commit
9d099dcf3f
@@ -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