mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +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
|
@Override
|
||||||
public Bitstream getThumbnail(Context context, Bitstream bitstream) throws SQLException {
|
public Bitstream getThumbnail(Context context, Bitstream bitstream) throws SQLException {
|
||||||
Pattern pattern = Pattern.compile("^" +
|
Pattern pattern = getBitstreamNamePattern(bitstream);
|
||||||
(bitstream.getName() != null ? Pattern.quote(bitstream.getName()) : bitstream.getName())
|
|
||||||
+ ".([^.]+)$");
|
|
||||||
|
|
||||||
for (Bundle bundle : bitstream.getBundles()) {
|
for (Bundle bundle : bitstream.getBundles()) {
|
||||||
for (Item item : bundle.getItems()) {
|
for (Item item : bundle.getItems()) {
|
||||||
@@ -422,6 +420,13 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Pattern getBitstreamNamePattern(Bitstream bitstream) {
|
||||||
|
if (bitstream.getName() != null) {
|
||||||
|
return Pattern.compile("^" + Pattern.quote(bitstream.getName()) + ".([^.]+)$");
|
||||||
|
}
|
||||||
|
return Pattern.compile("^" + bitstream.getName() + ".([^.]+)$");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BitstreamFormat getFormat(Context context, Bitstream bitstream) throws SQLException {
|
public BitstreamFormat getFormat(Context context, Bitstream bitstream) throws SQLException {
|
||||||
if (bitstream.getBitstreamFormat() == null) {
|
if (bitstream.getBitstreamFormat() == null) {
|
||||||
|
Reference in New Issue
Block a user