mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-09 11:03:12 +00:00
DS-3127: Prevent database updates when directly manipulating the bistream list of a bundle
This commit is contained in:
@@ -198,7 +198,7 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
|
||||
// We don't need to remove the link between bundle & bitstream, this will be handled in the delete() method.
|
||||
bitstreamService.delete(context, bitstream);
|
||||
}else{
|
||||
bundle.getBitstreams().remove(bitstream);
|
||||
bundle.removeBitstream(bitstream);
|
||||
bitstream.getBundles().remove(bundle);
|
||||
}
|
||||
}
|
||||
@@ -304,13 +304,13 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
|
||||
if(CollectionUtils.isNotEmpty(updatedBitstreams) && !updatedBitstreams.equals(currentBitstreams))
|
||||
{
|
||||
//First clear out the existing list of bitstreams
|
||||
bundle.getBitstreams().clear();
|
||||
bundle.clearBitstreams();
|
||||
|
||||
// Now add them back in the proper order
|
||||
for (Bitstream bitstream : updatedBitstreams)
|
||||
{
|
||||
bitstream.getBundles().remove(bundle);
|
||||
bundle.getBitstreams().add(bitstream);
|
||||
bundle.addBitstream(bitstream);
|
||||
bitstream.getBundles().add(bundle);
|
||||
bitstreamService.update(context, bitstream);
|
||||
}
|
||||
@@ -430,8 +430,8 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
|
||||
bundle.getName(), getIdentifiers(context, bundle)));
|
||||
|
||||
// Remove bitstreams
|
||||
List<Bitstream> bitstreams = new LinkedList<>(bundle.getBitstreams());
|
||||
bundle.getBitstreams().clear();
|
||||
List<Bitstream> bitstreams = bundle.getBitstreams();
|
||||
bundle.clearBitstreams();
|
||||
for (Bitstream bitstream : bitstreams) {
|
||||
removeBitstream(context, bundle, bitstream);
|
||||
}
|
||||
|
Reference in New Issue
Block a user