From 70d0c9e8a8271cd7f6787a9311c85267af99b10c Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Mon, 22 Nov 2010 20:53:10 +0000 Subject: [PATCH] DS-466 : Just realized the code fixed in r5887 appears in two places -- both in ingestAll() and in replaceAll(). It was fixed in ingestAll() in r5887. This commit also ensures it is fixed in replaceAll() method. git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5893 9c30dcfa-912a-0410-8fc2-9e0234be79fd --- .../dspace/content/packager/AbstractPackageIngester.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dspace-api/src/main/java/org/dspace/content/packager/AbstractPackageIngester.java b/dspace-api/src/main/java/org/dspace/content/packager/AbstractPackageIngester.java index ed375adc39..2a23c4229f 100644 --- a/dspace-api/src/main/java/org/dspace/content/packager/AbstractPackageIngester.java +++ b/dspace-api/src/main/java/org/dspace/content/packager/AbstractPackageIngester.java @@ -273,8 +273,14 @@ public abstract class AbstractPackageIngester // A Collection can map to Items that it does not "own". // If a Collection package has an Item as a child, it // should be mapped regardless of ownership. - if (Constants.COLLECTION == replacedDso.getType()) + + // If a Collection package has an Item as a child, it + // should be mapped regardless of ownership. + // Note: Only perform this mapping if new items were ingested to this collection + if (Constants.COLLECTION == replacedDso.getType() && dsoIngestedList.size()>oldSize) { + // Since running 'replaceAll' on an item, will only ingest one Item at most, + // Just make sure that item is mapped to this collection. Item childItem = (Item)dsoIngestedList.get(oldSize); Collection collection = (Collection)replacedDso; if (!childItem.isIn(collection))