From 250b996c62d43f0bdb3b1397f7cb0a89c763d53f Mon Sep 17 00:00:00 2001 From: Tim Donohue Date: Fri, 30 Sep 2011 21:31:07 +0000 Subject: [PATCH] Fix for DS-1029: AIP Backup & Restore unable to auto-create metadata fields on restore/ingest ('createMetadataFields' option is ignored). Essentially all this does is slightly reorganize the logic. We need to ensure the 'finishObject()' method (which does various "finishing" work to auto-create any missing metadata fields as needed) is called *before* an Item is created. git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@6764 9c30dcfa-912a-0410-8fc2-9e0234be79fd --- .../packager/AbstractMETSIngester.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java b/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java index 7d87f27ac7..caf4e4473f 100644 --- a/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java +++ b/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSIngester.java @@ -502,6 +502,11 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester // have subclass manage license since it may be extra package file. addLicense(context, item, license, collection, params); + // Subclass hook for final checks and rearrangements + // (this allows subclasses to do some final validation / changes as + // necessary) + finishObject(context, dso, params); + // Finally, if item is still in the workspace, then we actually need // to install it into the archive & assign its handle. if(wsi!=null) @@ -522,10 +527,20 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester //Add template item if one is referenced from manifest (only for Collections) addTemplateItem(context, dso, manifest, pkgFile, params, callback); } + + // Subclass hook for final checks and rearrangements + // (this allows subclasses to do some final validation / changes as + // necessary) + finishObject(context, dso, params); }// end if Community/Collection else if (type == Constants.SITE) { - // Do nothing -- Crosswalks will handle anything necessary to ingest at Site-level + // Do nothing by default -- Crosswalks will handle anything necessary to ingest at Site-level + + // Subclass hook for final checks and rearrangements + // (this allows subclasses to do some final validation / changes as + // necessary) + finishObject(context, dso, params); } else { @@ -537,11 +552,6 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester // -- Step 6 -- // Finish things up! - // Subclass hook for final checks and rearrangements - // (this allows subclasses to do some final validation / changes as - // necessary) - finishObject(context, dso, params); - // Update the object to make sure all changes are committed PackageUtils.updateDSpaceObject(dso);