mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-19 07:53:08 +00:00
DS-3127: Prevent database updates when directly manipulating the bistream list of a bundle
This commit is contained in:
@@ -10,6 +10,7 @@ package org.dspace.content;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.core.Constants;
|
||||
@@ -130,18 +131,40 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bitstreams in this bundle
|
||||
* Get a copy of the bitstream list of this bundle
|
||||
* Note that this is a copy and if you wish to manipulate the bistream list, you should use
|
||||
* {@ref Bundle.addBitstream}, {@ref Bundle.removeBitstream} or {@ref Bundle.clearBitstreams}
|
||||
*
|
||||
* @return the bitstreams
|
||||
*/
|
||||
public List<Bitstream> getBitstreams() {
|
||||
return bitstreams;
|
||||
List<Bitstream> bitstreamList = new LinkedList<>(this.bitstreams);
|
||||
return bitstreamList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new bitstream to this bundle.
|
||||
* @param bitstream
|
||||
*/
|
||||
void addBitstream(Bitstream bitstream){
|
||||
bitstreams.add(bitstream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the list of bitstream of this bundle
|
||||
*/
|
||||
public void clearBitstreams() {
|
||||
bitstreams.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given bitstream from this bundles bitstream list
|
||||
* @param bitstream The bitstream to remove
|
||||
*/
|
||||
public void removeBitstream(Bitstream bitstream) {
|
||||
bitstreams.remove(bitstream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the items this bundle appears in
|
||||
*
|
||||
@@ -215,5 +238,4 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
|
||||
}
|
||||
return bundleService;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user