SF patch #1551876 removeBitstream() fails to update primary bitstream

git-svn-id: http://scm.dspace.org/svn/repo/trunk@1595 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Claudia Juergen
2006-09-05 12:09:32 +00:00
parent c375b0dca4
commit 6eb4991503
2 changed files with 21 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
(Jeroen Ruigrok) (Jeroen Ruigrok)
- SF patch #1549758 Make sure cleanup() doesn't fail with NullPointerException - SF patch #1549758 Make sure cleanup() doesn't fail with NullPointerException
- SF patch #1549867 Make cleanup() commit outstanding work every 100 iterations - SF patch #1549867 Make cleanup() commit outstanding work every 100 iterations
- SF patch #1551876 removeBitstream() fails to update primary bitstream
(Flavio Botelho) (Flavio Botelho)
- SF patch #1529326 Bug in new code at QueryArgs with fixed typo in jsp/search/advanced.jsp - SF patch #1529326 Bug in new code at QueryArgs with fixed typo in jsp/search/advanced.jsp

View File

@@ -248,6 +248,14 @@ public class Bundle extends DSpaceObject
bundleRow.setColumn("primary_bitstream_id", bitstreamID); bundleRow.setColumn("primary_bitstream_id", bitstreamID);
} }
/**
* Unset the primary bitstream ID of the bundle
*/
public void unsetPrimaryBitstreamID()
{
bundleRow.setColumnNull("primary_bitstream_id");
}
public String getHandle() public String getHandle()
{ {
// No Handles for bundles // No Handles for bundles
@@ -428,6 +436,11 @@ public class Bundle extends DSpaceObject
/** /**
* Remove a bitstream from this bundle - the bitstream is only deleted if * Remove a bitstream from this bundle - the bitstream is only deleted if
* this was the last reference to it * this was the last reference to it
* <p>
* If the bitstream in question is the primary bitstream recorded for the
* bundle the primary bitstream field is unset in order to free the
* bitstream from the foreign key constraint so that the
* <code>cleanup</code> process can run normally.
* *
* @param b * @param b
* the bitstream to remove * the bitstream to remove
@@ -452,6 +465,13 @@ public class Bundle extends DSpaceObject
{ {
// We've found the bitstream to remove // We've found the bitstream to remove
li.remove(); li.remove();
// In the event that the bitstream to remove is actually
// the primary bitstream, be sure to unset the primary
// bitstream.
if (b.getID() == getPrimaryBitstreamID()) {
unsetPrimaryBitstreamID();
}
} }
} }