mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
DURACOM-225 fix lazy initialization traversing comms/colls
This commit is contained in:
@@ -33,7 +33,8 @@ public class MediaFilterScriptConfiguration<T extends MediaFilterScript> extends
|
||||
options.addOption("v", "verbose", false, "print all extracted text and other details to STDOUT");
|
||||
options.addOption("q", "quiet", false, "do not print anything except in the event of errors.");
|
||||
options.addOption("f", "force", false, "force all bitstreams to be processed");
|
||||
options.addOption("i", "identifier", true, "ONLY process bitstreams belonging to identifier");
|
||||
options.addOption("i", "identifier", true,
|
||||
"ONLY process bitstreams belonging to the provided handle identifier");
|
||||
options.addOption("m", "maximum", true, "process no more than maximum items");
|
||||
options.addOption("h", "help", false, "help");
|
||||
|
||||
|
@@ -132,12 +132,18 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
||||
@Override
|
||||
public void applyFiltersCommunity(Context context, Community community)
|
||||
throws Exception { //only apply filters if community not in skip-list
|
||||
// ensure that the community is attached to the current hibernate session
|
||||
// as we are committing after each item (handles, sub-communties and
|
||||
// collections are lazy attributes)
|
||||
community = context.reloadEntity(community);
|
||||
if (!inSkipList(community.getHandle())) {
|
||||
List<Community> subcommunities = community.getSubcommunities();
|
||||
for (Community subcommunity : subcommunities) {
|
||||
applyFiltersCommunity(context, subcommunity);
|
||||
}
|
||||
|
||||
// ensure that the community is attached to the current hibernate session
|
||||
// as we are committing after each item
|
||||
community = context.reloadEntity(community);
|
||||
List<Collection> collections = community.getCollections();
|
||||
for (Collection collection : collections) {
|
||||
applyFiltersCollection(context, collection);
|
||||
@@ -148,6 +154,9 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
|
||||
@Override
|
||||
public void applyFiltersCollection(Context context, Collection collection)
|
||||
throws Exception {
|
||||
// ensure that the collection is attached to the current hibernate session
|
||||
// as we are committing after each item (handles are lazy attributes)
|
||||
collection = context.reloadEntity(collection);
|
||||
//only apply filters if collection not in skip-list
|
||||
if (!inSkipList(collection.getHandle())) {
|
||||
Iterator<Item> itemIterator = itemService.findAllByCollection(context, collection);
|
||||
|
Reference in New Issue
Block a user