[DS-632] Batch Metadata Import needs to validate metadata fields specified in CSVs

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5429 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Stuart Lewis
2010-10-15 02:53:20 +00:00
parent 6501b2ea3f
commit 5c42e27ce2
10 changed files with 418 additions and 200 deletions

View File

@@ -41,6 +41,7 @@ package org.dspace.app.bulkedit;
import org.dspace.content.*;
import org.dspace.content.Collection;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
import java.util.*;
import java.util.regex.Pattern;
@@ -100,10 +101,11 @@ public class DSpaceCSV
* Create a new instance, reading the lines in from file
*
* @param f The file to read from
* @param c The DSpace Context
*
* @throws Exception thrown if there is an error reading or processing the file
*/
public DSpaceCSV(File f) throws Exception
public DSpaceCSV(File f, Context c) throws Exception
{
// Initalise the class
init();
@@ -122,11 +124,42 @@ public class DSpaceCSV
element = element.substring(1, element.length() - 1);
}
if (!"id".equals(element))
// Store the heading
if ("collection".equals(element))
{
// Store the heading
headings.add(element);
}
else if (!"id".equals(element))
{
// Verify that the heading is valid in the metadata registry
String[] clean = element.split("\\[");
String[] parts = clean[0].split("\\.");
String metadataSchema = parts[0];
String metadataElement = parts[1];
String metadataQualifier = null;
if (parts.length > 2) {
metadataQualifier = parts[2];
}
// Check that the scheme exists
MetadataSchema foundSchema = MetadataSchema.find(c, metadataSchema);
if (foundSchema == null) {
throw new MetadataImportInvalidHeadingException(clean[0],
MetadataImportInvalidHeadingException.SCHEMA);
}
// Check that the metadata element exists in the schema
int schemaID = foundSchema.getSchemaID();
MetadataField foundField = MetadataField.findByElement(c, schemaID, metadataElement, metadataQualifier);
if (foundField == null) {
throw new MetadataImportInvalidHeadingException(clean[0],
MetadataImportInvalidHeadingException.ELEMENT);
}
// Store the heading
headings.add(element);
}
}
// Read each subsequent line
@@ -169,8 +202,8 @@ public class DSpaceCSV
if ((toIgnore == null) || ("".equals(toIgnore.trim())))
{
// Set a default value
toIgnore = "dc.date.accession, dc.date.available, " +
"dc.description.provenance";
toIgnore = "dc.date.accessioned, dc.date.available, " +
"dc.date.updated, dc.description.provenance";
}
String[] toIgnoreArray = toIgnore.split(",");
for (String toIgnoreString : toIgnoreArray)
@@ -287,7 +320,7 @@ public class DSpaceCSV
// Get the key (schema.element)
String key = value.schema + "." + value.element;
// Add the qualifer if there is one (schema.element.qualifier)
// Add the qualifier if there is one (schema.element.qualifier)
if (value.qualifier != null)
{
key = key + "." + value.qualifier;
@@ -550,13 +583,13 @@ public class DSpaceCSV
public static void main(String[] args) throws Exception
{
// Test the CSV parsing
String[] csv = {"id,\"dc.title\",dc.contributor.author,dc.description.abstract",
"1,Easy line,\"Lewis, Stuart\",A nice short abstract",
"2,Two authors,\"Lewis, Stuart||Bloggs, Joe\",Two people wrote this item",
"3,Three authors,\"Lewis, Stuart||Bloggs, Joe||Loaf, Meat\",Three people wrote this item",
"4,\"Two line\ntitle\",\"Lewis, Stuart\",abstract",
"5,\"\"\"Embedded quotes\"\" here\",\"Lewis, Stuart\",\"Abstract with\ntwo\nnew lines\"",
"6,\"\"\"Unbalanced embedded\"\" quotes\"\" here\",\"Lewis, Stuart\",\"Abstract with\ntwo\nnew lines\"",};
String[] csv = {"id,collection,\"dc.title[en]\",dc.contributor.author,dc.description.abstract",
"1,2,Easy line,\"Lewis, Stuart\",A nice short abstract",
"2,2,Two authors,\"Lewis, Stuart||Bloggs, Joe\",Two people wrote this item",
"3,2,Three authors,\"Lewis, Stuart||Bloggs, Joe||Loaf, Meat\",Three people wrote this item",
"4,2,\"Two line\ntitle\",\"Lewis, Stuart\",abstract",
"5,2,\"\"\"Embedded quotes\"\" here\",\"Lewis, Stuart\",\"Abstract with\ntwo\nnew lines\"",
"6,2,\"\"\"Unbalanced embedded\"\" quotes\"\" here\",\"Lewis, Stuart\",\"Abstract with\ntwo\nnew lines\"",};
// Write the string to a file
String filename = "test.csv";
@@ -570,14 +603,44 @@ public class DSpaceCSV
out.close();
System.gc();
// test the CSV parsing
DSpaceCSV dcsv = new DSpaceCSV(new File(filename));
// Test the CSV parsing
Context c = new Context();
DSpaceCSV dcsv = new DSpaceCSV(new File(filename), c);
String[] lines = dcsv.getCSVLinesAsStringArray();
for (String line : lines)
{
System.out.println(line);
}
// Test the CSV parsing with a bad heading value
String[] csv2 = {"id,collection,\"dc.title[en]\",dc.contributor.foobar[en-US],dc.description.abstract",
"1,2,Easy line,\"Lewis, Stuart\",A nice short abstract",
"2,2,Two authors,\"Lewis, Stuart||Bloggs, Joe\",Two people wrote this item",
"3,2,Three authors,\"Lewis, Stuart||Bloggs, Joe||Loaf, Meat\",Three people wrote this item",
"4,2,\"Two line\ntitle\",\"Lewis, Stuart\",abstract",
"5,2,\"\"\"Embedded quotes\"\" here\",\"Lewis, Stuart\",\"Abstract with\ntwo\nnew lines\"",
"6,2,\"\"\"Unbalanced embedded\"\" quotes\"\" here\",\"Lewis, Stuart\",\"Abstract with\ntwo\nnew lines\"",};
// Write the string to a file
filename = "test.csv";
out = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(filename), "UTF-8"));
for (String csvLine : csv2) {
out.write(csvLine + "\n");
}
out.flush();
out.close();
System.gc();
// Test the CSV parsing
dcsv = new DSpaceCSV(new File(filename), c);
lines = dcsv.getCSVLinesAsStringArray();
for (String line : lines)
{
System.out.println(line);
}
// Delete the test file
File toDelete = new File(filename);
toDelete.delete();

View File

@@ -83,7 +83,7 @@ public class MetadataExport
}
/**
* Method to export a community (and sub-communites and collections)
* Method to export a community (and sub-communities and collections)
*
* @param c The Context
* @param toExport The Community to export
@@ -111,7 +111,7 @@ public class MetadataExport
* Build an array list of item ids that are in a community (include sub-communities and collections)
*
* @param community The community to build from
* @param itemIDs The itemID (used for recuriosn - use an empty ArrayList)
* @param itemIDs The itemID (used for recursion - use an empty ArrayList)
* @param indent How many spaces to use when writing out the names of items added
* @return The list of item ids
* @throws SQLException

View File

@@ -1026,7 +1026,7 @@ public class MetadataImport
DSpaceCSV csv;
try
{
csv = new DSpaceCSV(new File(filename));
csv = new DSpaceCSV(new File(filename), c);
}
catch (Exception e)
{

View File

@@ -0,0 +1,109 @@
/*
* MetadataImportException.java
*
* Version: $Revision$
*
* Date: $Date$
*
* Copyright (c) 2002-2010, The DSpace Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the DSpace Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.dspace.app.bulkedit;
/**
* Metadata importer exception
*
* @author Stuart Lewis
*/
public class MetadataImportInvalidHeadingException extends Exception
{
/** The type of error (schema or element) */
private int type;
/** The bad heading */
private String badHeading;
/** Error with the schema */
public static final int SCHEMA = 0;
/** Error with the element */
public static final int ELEMENT = 1;
/**
* Instantiate a new MetadataImportInvalidHeadingException
*
* @param message the error message
* @param theType the type of the error
*/
public MetadataImportInvalidHeadingException(String message, int theType)
{
super(message);
badHeading = message;
type = theType;
}
/**
* Get the type of the exception
*
* @return the type of the exception
*/
public String getType()
{
return "" + type;
}
/**
* Get the heading that was invalid
*
* @return the invalid heading
*/
public String getBadHeader()
{
return badHeading;
}
/**
* Get the exception message
*
* @return The exception message
*/
public String getMessage()
{
if (type == SCHEMA)
{
return "Unknown metadata schema in heading: " + badHeading;
}
else
{
return "Unknown metadata elemnt in heading: " + badHeading;
}
}
}

View File

@@ -288,7 +288,9 @@ jsp.dspace-admin.group-group-select.heading = Select Group t
jsp.dspace-admin.group-group-select.title = Select Group
jsp.dspace-admin.metadataimport.title = Import metadata
jsp.dspace-admin.metadataimport.apply = Apply changes
jsp.dspace-admin.metadataimport.unknownerror = An unknown error has occured
jsp.dspace-admin.metadataimport.unknownerror = An unknown error has occurred
jsp.dspace-admin.metadataimport.badheadingschema = Unknown metadata schema in heading
jsp.dspace-admin.metadataimport.badheadingelement = Unknown metadata element in heading
jsp.dspace-admin.metadataimport.changesforitem = Changes for item
jsp.dspace-admin.metadataimport.newitem = New item
jsp.dspace-admin.metadataimport.addtocollection = Map to collection

View File

@@ -47,6 +47,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.dspace.app.bulkedit.MetadataImportInvalidHeadingException;
import org.dspace.app.webui.util.JSPManager;
import org.dspace.app.webui.util.FileUploadRequest;
import org.dspace.app.bulkedit.MetadataImport;
@@ -105,7 +106,7 @@ public class MetadataImportServlet extends DSpaceServlet
// Get the changes
log.info(LogManager.getHeader(context, "metadataimport", "loading file"));
ArrayList<BulkEditChange> changes = processUpload(context, request);
log.debug(LogManager.getHeader(context, "metadataimport", changes.size() + " items with changes identifed"));
log.debug(LogManager.getHeader(context, "metadataimport", changes.size() + " items with changes identified"));
// Were there any changes detected?
if (changes.size() != 0)
@@ -134,10 +135,16 @@ public class MetadataImportServlet extends DSpaceServlet
JSPManager.showJSP(request, response, "/dspace-admin/metadataimport.jsp");
}
}
catch (MetadataImportInvalidHeadingException mihe) {
request.setAttribute("message", mihe.getBadHeader());
request.setAttribute("badheading", mihe.getType());
log.info(LogManager.getHeader(context, "metadataimport", "Error encountered while looking for changes: " + mihe.getMessage()));
JSPManager.showJSP(request, response, "/dspace-admin/metadataimport-error.jsp");
}
catch (Exception e)
{
request.setAttribute("message", e.getMessage());
log.debug(LogManager.getHeader(context, "metadataimport", "Error encountered while looking for changes: " + e.getMessage()));
log.info(LogManager.getHeader(context, "metadataimport", "Error encountered while looking for changes: " + e.getMessage()));
JSPManager.showJSP(request, response, "/dspace-admin/metadataimport-error.jsp");
}
}
@@ -226,7 +233,7 @@ public class MetadataImportServlet extends DSpaceServlet
File f = wrapper.getFile("file");
// Run the import
DSpaceCSV csv = new DSpaceCSV(f);
DSpaceCSV csv = new DSpaceCSV(f, context);
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
ArrayList<BulkEditChange> changes = mImport.runImport(false, false, false, false);

View File

@@ -1,4 +1,5 @@
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
<%@ page import="org.dspace.app.bulkedit.MetadataImportInvalidHeadingException" %>
<%--
- Version: $Revision$
- Date: $Date$
@@ -45,11 +46,30 @@
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
<%
String error = (String)request.getAttribute("error");
if (error == null)
// Get the error message
String error = (String)request.getAttribute("message");
// Is it a bad metadata element in the header?
String badheader = (String)request.getAttribute("badheading");
if (badheader != null)
{
if (badheader.equals("" + MetadataImportInvalidHeadingException.SCHEMA))
{
error = LocaleSupport.getLocalizedMessage(pageContext, "jsp.dspace-admin.metadataimport.badheadingschema") +
": " + error;
}
else
{
error = LocaleSupport.getLocalizedMessage(pageContext, "jsp.dspace-admin.metadataimport.badheadingelement") +
": " + error;
}
}
else if (error == null)
{
error = LocaleSupport.getLocalizedMessage(pageContext, "jsp.dspace-admin.metadataimport.unknownerror");
}
%>
<dspace:layout titlekey="jsp.dspace-admin.metadataimport.title"

View File

@@ -46,17 +46,17 @@ import org.apache.log4j.Logger;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.servlet.multipart.Part;
import org.apache.cocoon.servlet.multipart.PartOnDisk;
import org.dspace.app.bulkedit.BulkEditChange;
import org.dspace.app.bulkedit.DSpaceCSV;
import org.dspace.app.bulkedit.MetadataImport;
import org.dspace.app.bulkedit.MetadataImportException;
import org.dspace.app.bulkedit.MetadataImportInvalidHeadingException;
import org.dspace.app.xmlui.wing.Message;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.Context;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.LogManager;
import org.dspace.app.bulkedit.MetadataImport;
import org.dspace.app.bulkedit.MetadataImportException;
import org.dspace.app.bulkedit.DSpaceCSV;
import org.dspace.app.bulkedit.BulkEditChange;
/**
* Utility methods to processes MetadataImport actions. These methods are used
* exclusively from the administrative flow scripts.
@@ -69,161 +69,175 @@ public class FlowMetadataImportUtils
/** Language Strings */
private static final Message T_upload_successful = new Message("default", "xmlui.administrative.metadataimport.flow.upload_successful");
private static final Message T_upload_failed = new Message("default", "xmlui.administrative.metadataimport.flow.upload_failed");
private static final Message T_import_successful = new Message("default", "xmlui.administrative.metadataimport.flow.import_successful");
private static final Message T_import_failed = new Message("default", "xmlui.administrative.metadataimport.flow.import_failed");
private static final Message T_over_limit = new Message("default", "xmlui.administrative.metadataimport.flow.over_limit");
private static final Message T_no_changes = new Message("default", "xmlui.administrative.metadataimport.general.no_changes");
private static final Message T_upload_failed = new Message("default", "xmlui.administrative.metadataimport.flow.upload_failed");
private static final Message T_upload_badschema = new Message("default", "xmlui.administrative.metadataimport.flow.upload_badschema");
private static final Message T_upload_badelement = new Message("default", "xmlui.administrative.metadataimport.flow.upload_badelement");
private static final Message T_import_successful = new Message("default", "xmlui.administrative.metadataimport.flow.import_successful");
private static final Message T_import_failed = new Message("default", "xmlui.administrative.metadataimport.flow.import_failed");
private static final Message T_over_limit = new Message("default", "xmlui.administrative.metadataimport.flow.over_limit");
private static final Message T_no_changes = new Message("default", "xmlui.administrative.metadataimport.general.no_changes");
// Other variables
private static final int limit = ConfigurationManager.getIntProperty("bulkedit.gui-item-limit", 20);
private static Logger log = Logger.getLogger(FlowMetadataImportUtils.class);
// Other variables
private static final int limit = ConfigurationManager.getIntProperty("bulkedit.gui-item-limit", 20);
private static Logger log = Logger.getLogger(FlowMetadataImportUtils.class);
public static FlowResult processMetadataImport(Context context,Request request) throws SQLException, AuthorizeException, IOException, Exception
public static FlowResult processMetadataImport(Context context,Request request) throws SQLException, AuthorizeException, IOException, Exception
{
FlowResult result = new FlowResult();
result.setContinue(false);
DSpaceCSV csv = (DSpaceCSV)request.getSession().getAttribute("csv");
if(csv != null)
{
try {
FlowResult result = new FlowResult();
result.setContinue(false);
// Run the import
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
ArrayList<BulkEditChange> changes = mImport.runImport(true, false, false, false);
DSpaceCSV csv = (DSpaceCSV)request.getSession().getAttribute("csv");
// Commit the changes
context.commit();
request.setAttribute("changes",changes);
request.getSession().removeAttribute("csv");
if(csv != null)
{
try {
// Run the import
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
ArrayList<BulkEditChange> changes = mImport.runImport(true, false, false, false);
// Commit the changes
context.commit();
request.setAttribute("changes",changes);
request.getSession().removeAttribute("csv");
log.debug(LogManager.getHeader(context, "metadataimport", changes.size() + " items changed"));
if(changes.size() > 0) {
result.setContinue(true);
result.setOutcome(true);
result.setMessage(T_import_successful);
}
else {
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_no_changes);
}
log.debug(LogManager.getHeader(context, "metadataimport", changes.size() + " items changed"));
if(changes.size() > 0) {
result.setContinue(true);
result.setOutcome(true);
result.setMessage(T_import_successful);
}
catch(MetadataImportException e) {
else {
result.setContinue(false);
result.setOutcome(false);
result.addError(e.getLocalizedMessage());
result.setMessage(T_import_failed);
log.debug(LogManager.getHeader(context, "metadataimport", "Error encountered while making changes - " + e.getMessage()));
result.setMessage(T_no_changes);
}
}
else {
catch(MetadataImportException e) {
result.setContinue(false);
result.setOutcome(false);
result.addError(e.getLocalizedMessage());
result.setMessage(T_import_failed);
log.debug(LogManager.getHeader(context, "metadataimport", "Changes cancelled"));
log.debug(LogManager.getHeader(context, "metadataimport", "Error encountered while making changes - " + e.getMessage()));
}
}
else {
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_import_failed);
log.debug(LogManager.getHeader(context, "metadataimport", "Changes cancelled"));
}
return result;
}
public static FlowResult processUploadCSV(Context context, Request request) throws SQLException, AuthorizeException, IOException, Exception
{
FlowResult result = new FlowResult();
result.setContinue(false);
Object object = null;
if(request.get("file") != null) {
object = request.get("file");
}
Part filePart = null;
File file = null;
if (object instanceof Part)
{
filePart = (Part) object;
file = ((PartOnDisk)filePart).getFile();
}
if (filePart != null && filePart.getSize() > 0)
{
String name = filePart.getUploadName();
while (name.indexOf('/') > -1)
{
name = name.substring(name.indexOf('/') + 1);
}
while (name.indexOf('\\') > -1)
{
name = name.substring(name.indexOf('\\') + 1);
}
try {
log.info(LogManager.getHeader(context, "metadataimport", "loading file"));
// Process CSV without import
DSpaceCSV csv = new DSpaceCSV(file, context);
file.delete();
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
ArrayList<BulkEditChange> changes = mImport.runImport(false, false, false, false);
log.debug(LogManager.getHeader(context, "metadataimport", changes.size() + " items with changes identified"));
if(changes.size() > 0)
{
if(changes.size() > limit)
{
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_over_limit);
log.info(LogManager.getHeader(context, "metadataimport", "too many changes - " +
changes.size() + " (" + limit + " allowed)"));
}
else
{
// Success!
// Set session and request attributes
request.setAttribute("changes", changes);
request.getSession().setAttribute("csv", csv);
result.setContinue(true);
result.setOutcome(true);
result.setMessage(T_upload_successful);
}
}
else
{
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_no_changes);
}
}
catch(MetadataImportInvalidHeadingException mihe) {
result.setContinue(false);
result.setOutcome(false);
if (mihe.getType().equals("" + MetadataImportInvalidHeadingException.SCHEMA))
{
result.setMessage(T_upload_badschema);
}
else
{
result.setMessage(T_upload_badelement);
}
result.setCharacters(mihe.getBadHeader());
}
catch(MetadataImportException e) {
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_upload_failed);
log.debug(LogManager.getHeader(context, "metadataimport", "Error encountered while looking for changes - " + e.getMessage()));
}
}
else
{
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_upload_failed);
}
return result;
}
public static FlowResult processUploadCSV(Context context, Request request) throws SQLException, AuthorizeException, IOException, Exception
{
FlowResult result = new FlowResult();
result.setContinue(false);
Object object = null;
if(request.get("file") != null) {
object = request.get("file");
}
Part filePart = null;
File file = null;
if (object instanceof Part)
{
filePart = (Part) object;
file = ((PartOnDisk)filePart).getFile();
}
if (filePart != null && filePart.getSize() > 0)
{
String name = filePart.getUploadName();
while (name.indexOf('/') > -1)
{
name = name.substring(name.indexOf('/') + 1);
}
while (name.indexOf('\\') > -1)
{
name = name.substring(name.indexOf('\\') + 1);
}
try {
log.info(LogManager.getHeader(context, "metadataimport", "loading file"));
// Process CSV without import
DSpaceCSV csv = new DSpaceCSV(file);
file.delete();
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
ArrayList<BulkEditChange> changes = mImport.runImport(false, false, false, false);
log.debug(LogManager.getHeader(context, "metadataimport", changes.size() + " items with changes identifed"));
if(changes.size() > 0)
{
if(changes.size() > limit)
{
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_over_limit);
log.info(LogManager.getHeader(context, "metadataimport", "too many changes - " +
changes.size() + " (" + limit + " allowed)"));
}
else
{
// Success!
// Set session and request attributes
request.setAttribute("changes", changes);
request.getSession().setAttribute("csv", csv);
result.setContinue(true);
result.setOutcome(true);
result.setMessage(T_upload_successful);
}
}
else
{
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_no_changes);
}
}
catch(MetadataImportException e) {
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_upload_failed);
log.debug(LogManager.getHeader(context, "metadataimport", "Error encountered while looking for changes - " + e.getMessage()));
}
}
else
{
result.setContinue(false);
result.setOutcome(false);
result.setMessage(T_upload_failed);
}
return result;
}
}

View File

@@ -1371,42 +1371,44 @@
<message key="xmlui.administrative.item.FindItemForm.identifier_error">Unable to resolve identifier.</message>
<message key="xmlui.administrative.item.FindItemForm.find">Find</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport -->
<message key="xmlui.administrative.metadataimport.general.title">Import Metadata</message>
<message key="xmlui.administrative.metadataimport.general.head1">Import Metadata</message>
<message key="xmlui.administrative.metadataimport.general.trail">Import Metadata</message>
<message key="xmlui.administrative.metadataimport.general.changes">changes</message>
<message key="xmlui.administrative.metadataimport.general.no_changes">No changes were detected</message>
<message key="xmlui.administrative.metadataimport.general.new_item">New item</message>
<message key="xmlui.administrative.metadataimport.flow.upload_successful">Upload successful</message>
<message key="xmlui.administrative.metadataimport.flow.upload_failed">Upload failed</message>
<message key="xmlui.administrative.metadataimport.flow.import_successful">Import successful</message>
<message key="xmlui.administrative.metadataimport.flow.import_failed">Import failed</message>
<message key="xmlui.administrative.metadataimport.flow.over_limit">Number of changes exceeds maximum allowed. Limit changes or alter bulkedit.gui-item-limit in dspace.cfg</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport -->
<message key="xmlui.administrative.metadataimport.general.title">Import Metadata</message>
<message key="xmlui.administrative.metadataimport.general.head1">Import Metadata</message>
<message key="xmlui.administrative.metadataimport.general.trail">Import Metadata</message>
<message key="xmlui.administrative.metadataimport.general.changes">changes</message>
<message key="xmlui.administrative.metadataimport.general.no_changes">No changes were detected</message>
<message key="xmlui.administrative.metadataimport.general.new_item">New item</message>
<message key="xmlui.administrative.metadataimport.flow.upload_successful">Upload successful</message>
<message key="xmlui.administrative.metadataimport.flow.upload_failed">Upload failed</message>
<message key="xmlui.administrative.metadataimport.flow.upload_badschema">Unknown metadata schema in heading</message>
<message key="xmlui.administrative.metadataimport.flow.upload_badelement">Unknown metadata element in heading</message>
<message key="xmlui.administrative.metadataimport.flow.import_successful">Import successful</message>
<message key="xmlui.administrative.metadataimport.flow.import_failed">Import failed</message>
<message key="xmlui.administrative.metadataimport.flow.over_limit">Number of changes exceeds maximum allowed. Limit changes or alter bulkedit.gui-item-limit in dspace.cfg</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport.MetadataImportConfirm -->
<message key="xmlui.administrative.metadataimport.MetadataImportMain.submit_upload">Upload CSV</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport.MetadataImportConfirm -->
<message key="xmlui.administrative.metadataimport.MetadataImportMain.submit_upload">Upload CSV</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport.MetadataImportConfirm -->
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.success">Successfully processed</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.changes_committed">Changes applied to item</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.item_added">Added: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.item_removed">Removed: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_newowner">Added to owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_oldowner">Removed from owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_mapped">Mapped to collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_unmapped">Unmapped from collection</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport.MetadataImportUpload -->
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_add">Add: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_remove">Remove: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_newowner">Add to owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_oldowner">Remove from owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_mapped">Map to collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_unmapped">Un-map from collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.changes_pending">Changes pending for item</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.submit_confirm">Apply changes</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.hint">Pending changes are listed below for review</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport.MetadataImportConfirm -->
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.success">Successfully processed</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.changes_committed">Changes applied to item</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.item_added">Added: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.item_removed">Removed: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_newowner">Added to owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_oldowner">Removed from owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_mapped">Mapped to collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.collection_unmapped">Unmapped from collection</message>
<!-- org.dspace.app.xmlui.administrative.metadataimport.MetadataImportUpload -->
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_add">Add: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_remove">Remove: </message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_newowner">Add to owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_oldowner">Remove from owning collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_mapped">Map to collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.collection_unmapped">Un-map from collection</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.changes_pending">Changes pending for item</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.submit_confirm">Apply changes</message>
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.hint">Pending changes are listed below for review</message>
<!-- general mapper messages -->
<message key="xmlui.administrative.mapper.general.mapper_trail">Item mapper</message>

View File

@@ -37,6 +37,7 @@
(Stuart Lewis)
- [DS-467] Consider making the JSPUI styles.css.jsp a static file
- [DS-632] Batch Metadata Import needs to validate metadata fields specified in CSVs
[Graham Triggs]
- [DS-698] Clear primary_bitstream_id references when deleting a bitstream