mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
Merge pull request #2020 from tdonohue/DS-3883-port-to-5.x
DS-3883: Speed up Item summary lists by being smarter about when we load Thumbnails/Bitstreams (port to 5.x)
This commit is contained in:
@@ -18,6 +18,7 @@ import org.dspace.content.authority.Choices;
|
||||
import org.dspace.content.crosswalk.ContextAwareDisseminationCrosswalk;
|
||||
import org.dspace.content.crosswalk.CrosswalkException;
|
||||
import org.dspace.content.crosswalk.DisseminationCrosswalk;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
@@ -691,7 +692,10 @@ public class ItemAdapter extends AbstractAdapter
|
||||
|
||||
// Suppress license?
|
||||
Boolean showLicense = ConfigurationManager.getBooleanProperty("webui.licence_bundle.show");
|
||||
|
||||
|
||||
// Check if ORIGINAL bundle included (either explicitly or via include all fileGrp types)
|
||||
boolean includeContentBundle = this.fileGrpTypes.isEmpty() ? true : this.fileGrpTypes.contains("ORIGINAL");
|
||||
|
||||
// Loop over all requested bundles
|
||||
for (Bundle bundle : bundles)
|
||||
{
|
||||
@@ -716,20 +720,41 @@ public class ItemAdapter extends AbstractAdapter
|
||||
continue;
|
||||
}
|
||||
|
||||
// /////////////////////////////////////
|
||||
// Determine which bitstreams to include in bundle
|
||||
Bitstream[] bitstreams = new Bitstream[0];
|
||||
|
||||
// If this is the THUMBNAIL bundle, and we are NOT including content bundle,
|
||||
// Then assume this is an item summary page, and we can just include the main thumbnail.
|
||||
if ("THUMBNAIL".equals(bundle.getName()) && !includeContentBundle)
|
||||
{
|
||||
Thumbnail thumbnail = ItemService.getThumbnail(context, item.getID(), false);
|
||||
if(thumbnail != null) {
|
||||
bitstreams = new Bitstream[] { thumbnail.getThumb() };
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Default to including all bitstreams
|
||||
bitstreams = bundle.getBitstreams();
|
||||
}
|
||||
|
||||
|
||||
// ///////////////////
|
||||
// Start bundle's file group
|
||||
attributes = new AttributeMap();
|
||||
attributes.put("USE", use);
|
||||
startElement(METS,"fileGrp",attributes);
|
||||
|
||||
for (Bitstream bitstream : bundle.getBitstreams())
|
||||
|
||||
for (Bitstream bitstream : bitstreams)
|
||||
{
|
||||
// //////////////////////////////
|
||||
// Determine the file's IDs
|
||||
String fileID = getFileID(bitstream);
|
||||
|
||||
Bitstream originalBitstream = null;
|
||||
if (isDerivedBundle)
|
||||
// If we are looping through a derived bundle and content bundle is included,
|
||||
// ensure each derived bitstream and original bitstream share the same groupID
|
||||
if (isDerivedBundle && includeContentBundle)
|
||||
{
|
||||
originalBitstream = findOriginalBitstream(item, bitstream);
|
||||
}
|
||||
|
Reference in New Issue
Block a user