mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
DS-2015 ORE data is duplicated when an item is updated through a harvest.
This commit is contained in:
@@ -557,13 +557,25 @@ public class OAIHarvester {
|
|||||||
// Now create the special ORE bundle and drop the ORE document in it
|
// Now create the special ORE bundle and drop the ORE document in it
|
||||||
if (harvestRow.getHarvestType() == 2 || harvestRow.getHarvestType() == 3)
|
if (harvestRow.getHarvestType() == 2 || harvestRow.getHarvestType() == 3)
|
||||||
{
|
{
|
||||||
Bundle OREBundle = item.createBundle("ORE");
|
Bundle OREBundle = null;
|
||||||
|
Bundle[] OREBundles = item.getBundles("ORE");
|
||||||
|
Bitstream OREBitstream = null;
|
||||||
|
|
||||||
|
if ( OREBundles.length > 0 )
|
||||||
|
OREBundle = OREBundles[0];
|
||||||
|
else
|
||||||
|
OREBundle = item.createBundle("ORE");
|
||||||
|
|
||||||
XMLOutputter outputter = new XMLOutputter();
|
XMLOutputter outputter = new XMLOutputter();
|
||||||
String OREString = outputter.outputString(oreREM);
|
String OREString = outputter.outputString(oreREM);
|
||||||
ByteArrayInputStream OREStream = new ByteArrayInputStream(OREString.getBytes());
|
ByteArrayInputStream OREStream = new ByteArrayInputStream(OREString.getBytes());
|
||||||
|
|
||||||
Bitstream OREBitstream = OREBundle.createBitstream(OREStream);
|
OREBitstream = OREBundle.getBitstreamByName("ORE.xml");
|
||||||
|
|
||||||
|
if ( OREBitstream != null )
|
||||||
|
OREBundle.removeBitstream(OREBitstream);
|
||||||
|
|
||||||
|
OREBitstream = OREBundle.createBitstream(OREStream);
|
||||||
OREBitstream.setName("ORE.xml");
|
OREBitstream.setName("ORE.xml");
|
||||||
|
|
||||||
BitstreamFormat bf = FormatIdentifier.guessFormat(ourContext, OREBitstream);
|
BitstreamFormat bf = FormatIdentifier.guessFormat(ourContext, OREBitstream);
|
||||||
|
Reference in New Issue
Block a user