mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[DS-811] Delete / withdraw items via bulk csv editing
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@6562 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -51,6 +51,15 @@ public class BulkEditChange
|
||||
/** Is this a new item */
|
||||
private boolean newItem;
|
||||
|
||||
/** Has this item been deleted? */
|
||||
private boolean deleted;
|
||||
|
||||
/** Has this item been withdrawn? */
|
||||
private boolean withdrawn;
|
||||
|
||||
/** Has this item been reinstated? */
|
||||
private boolean reinstated;
|
||||
|
||||
/** Have any changes actually been made? */
|
||||
private boolean empty;
|
||||
|
||||
@@ -326,6 +335,66 @@ public class BulkEditChange
|
||||
return newItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this change object represent a deleted item?
|
||||
*
|
||||
* @return Whether or not this is for a deleted item
|
||||
*/
|
||||
public boolean isDeleted()
|
||||
{
|
||||
// Return the new item status
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set that this item has been deleted
|
||||
*/
|
||||
public void setDeleted() {
|
||||
// Store the setting
|
||||
deleted = true;
|
||||
empty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this change object represent a withdrawn item?
|
||||
*
|
||||
* @return Whether or not this is for a withdrawn item
|
||||
*/
|
||||
public boolean isWithdrawn()
|
||||
{
|
||||
// Return the new item status
|
||||
return withdrawn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set that this item has been withdrawn
|
||||
*/
|
||||
public void setWithdrawn() {
|
||||
// Store the setting
|
||||
withdrawn = true;
|
||||
empty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this change object represent a reinstated item?
|
||||
*
|
||||
* @return Whether or not this is for a reinstated item
|
||||
*/
|
||||
public boolean isReinstated()
|
||||
{
|
||||
// Return the new item status
|
||||
return reinstated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set that this item has been deleted
|
||||
*/
|
||||
public void setReinstated() {
|
||||
// Store the setting
|
||||
reinstated = true;
|
||||
empty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Have any changes actually been recorded, or is this empty?
|
||||
*
|
||||
|
@@ -114,6 +114,12 @@ public class DSpaceCSV implements Serializable
|
||||
// Store the heading
|
||||
headings.add(element);
|
||||
}
|
||||
// Store the action
|
||||
else if ("action".equals(element))
|
||||
{
|
||||
// Store the heading
|
||||
headings.add(element);
|
||||
}
|
||||
else if (!"id".equals(element))
|
||||
{
|
||||
// Verify that the heading is valid in the metadata registry
|
||||
@@ -248,6 +254,21 @@ public class DSpaceCSV implements Serializable
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide if this CSV file has an 'action' (case-dependent!) header.
|
||||
*
|
||||
* @return Whether or not there is an 'action' header
|
||||
*/
|
||||
public boolean hasActions() {
|
||||
// Look for a heading called 'action'
|
||||
for (String header : headings) {
|
||||
if (header.equals("action")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value separator for multiple values stored in one csv value.
|
||||
*
|
||||
@@ -575,12 +596,6 @@ public class DSpaceCSV implements Serializable
|
||||
*/
|
||||
private final boolean okToExport(DCValue md)
|
||||
{
|
||||
// First check the metadata format, and K all non DC elements
|
||||
if (!"dc".equals(md.schema))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Now compare with the list to ignore
|
||||
String key = md.schema + "." + md.element;
|
||||
if (md.qualifier != null)
|
||||
|
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
package org.dspace.app.bulkedit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -18,7 +19,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author Stuart Lewis
|
||||
*/
|
||||
public class DSpaceCSVLine
|
||||
public class DSpaceCSVLine implements Serializable
|
||||
{
|
||||
/** The item id of the item represented by this line. -1 is for a new item */
|
||||
private int id;
|
||||
@@ -92,6 +93,22 @@ public class DSpaceCSVLine
|
||||
return items.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any action associated with this line
|
||||
*
|
||||
* @return The action (may be blank, 'withdraw', 'reinstate' or 'delete')
|
||||
*/
|
||||
public String getAction()
|
||||
{
|
||||
if (items.containsKey("action")) {
|
||||
ArrayList actions = items.get("action");
|
||||
if (actions.size() > 0) {
|
||||
return ((String)actions.get(0)).trim();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the metadata keys that are represented in this line
|
||||
*
|
||||
|
@@ -39,6 +39,9 @@ public class MetadataImport
|
||||
/** The Context */
|
||||
Context c;
|
||||
|
||||
/** The DSpaceCSV object we're processing */
|
||||
DSpaceCSV csv;
|
||||
|
||||
/** The lines to import */
|
||||
List<DSpaceCSVLine> toImport;
|
||||
|
||||
@@ -53,11 +56,12 @@ public class MetadataImport
|
||||
* @param c The context
|
||||
* @param toImport An array of CSV lines to examine
|
||||
*/
|
||||
public MetadataImport(Context c, List<DSpaceCSVLine> toImport)
|
||||
public MetadataImport(Context c, DSpaceCSV toImport)
|
||||
{
|
||||
// Store the import settings
|
||||
this.c = c;
|
||||
this.toImport = toImport;
|
||||
csv = toImport;
|
||||
this.toImport = toImport.getCSVLines();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,6 +93,12 @@ public class MetadataImport
|
||||
// Get the DSpace item to compare with
|
||||
int id = line.getID();
|
||||
|
||||
// Is there an action column?
|
||||
if (csv.hasActions() && (!"".equals(line.getAction())) && (id == -1))
|
||||
{
|
||||
throw new MetadataImportException("'action' not allowed for new items!");
|
||||
}
|
||||
|
||||
// Is this a new item?
|
||||
if (id != -1)
|
||||
{
|
||||
@@ -98,6 +108,8 @@ public class MetadataImport
|
||||
{
|
||||
throw new MetadataImportException("Unknown item ID " + id);
|
||||
}
|
||||
|
||||
// Record changes
|
||||
BulkEditChange whatHasChanged = new BulkEditChange(item);
|
||||
|
||||
// Has it moved collection?
|
||||
@@ -127,6 +139,63 @@ public class MetadataImport
|
||||
}
|
||||
}
|
||||
|
||||
if (csv.hasActions())
|
||||
{
|
||||
// Perform the action
|
||||
String action = line.getAction();
|
||||
if ("".equals(action))
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
else if ("expunge".equals(action))
|
||||
{
|
||||
// Does the configuration allow deletes?
|
||||
if (!ConfigurationManager.getBooleanProperty("bulkedit.allowexpunge", false))
|
||||
{
|
||||
throw new MetadataImportException("'expunge' action denied by configuration");
|
||||
}
|
||||
|
||||
// Remove the item
|
||||
Collection[] owners = item.getCollections();
|
||||
for (Collection owner : owners)
|
||||
{
|
||||
if (change)
|
||||
{
|
||||
owner.removeItem(item);
|
||||
}
|
||||
}
|
||||
whatHasChanged.setDeleted();
|
||||
}
|
||||
else if ("withdraw".equals(action))
|
||||
{
|
||||
// Withdraw the item
|
||||
if (!item.isWithdrawn())
|
||||
{
|
||||
if (change)
|
||||
{
|
||||
item.withdraw();
|
||||
}
|
||||
whatHasChanged.setWithdrawn();
|
||||
}
|
||||
}
|
||||
else if ("reinstate".equals(action))
|
||||
{
|
||||
// Reinstate the item
|
||||
if (item.isWithdrawn())
|
||||
{
|
||||
if (change)
|
||||
{
|
||||
item.reinstate();
|
||||
}
|
||||
whatHasChanged.setReinstated();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Unknown action!
|
||||
throw new MetadataImportException("Unknown action: " + action);
|
||||
}
|
||||
}
|
||||
|
||||
// Only record if changes have been made
|
||||
if (whatHasChanged.hasChanges())
|
||||
{
|
||||
@@ -164,7 +233,7 @@ public class MetadataImport
|
||||
{
|
||||
throw new MetadataImportException("New items must have a 'collection' assigned in the form of a handle");
|
||||
}
|
||||
|
||||
|
||||
// Check collections are really collections
|
||||
ArrayList<Collection> check = new ArrayList<Collection>();
|
||||
Collection collection;
|
||||
@@ -204,7 +273,7 @@ public class MetadataImport
|
||||
Collection extra = (Collection)HandleManager.resolveToObject(c, handle);
|
||||
if (first)
|
||||
{
|
||||
whatHasChanged.setOwningCollection(extra);
|
||||
whatHasChanged.setOwningCollection(extra);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -227,7 +296,7 @@ public class MetadataImport
|
||||
{
|
||||
item.addMetadata(dcv.schema,
|
||||
dcv.element,
|
||||
dcv.qualifier,
|
||||
dcv.qualifier,
|
||||
dcv.language,
|
||||
dcv.value);
|
||||
}
|
||||
@@ -253,7 +322,7 @@ public class MetadataImport
|
||||
// Install the item
|
||||
InstallItem.installItem(c, wsItem);
|
||||
}
|
||||
|
||||
|
||||
// Add to extra collections
|
||||
if (line.get("collection").size() > 0)
|
||||
{
|
||||
@@ -313,8 +382,8 @@ public class MetadataImport
|
||||
log.debug(LogManager.getHeader(c, "metadata_import",
|
||||
"item_id=" + item.getID() + ",fromCSV=" + all));
|
||||
|
||||
// Don't compare collections
|
||||
if ("collection".equals(md))
|
||||
// Don't compare collections or actions
|
||||
if (("collection".equals(md)) || ("action".equals(md)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -633,8 +702,8 @@ public class MetadataImport
|
||||
private void add(String[] fromCSV, String md, BulkEditChange changes)
|
||||
throws SQLException, AuthorizeException
|
||||
{
|
||||
// Don't add owning collection
|
||||
if ("collection".equals(md))
|
||||
// Don't add owning collection or action
|
||||
if (("collection".equals(md)) || ("action".equals(md)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -759,7 +828,8 @@ public class MetadataImport
|
||||
List<Collection> oldCollections = change.getOldMappedCollections();
|
||||
if ((adds.size() > 0) || (removes.size() > 0) ||
|
||||
(newCollections.size() > 0) || (oldCollections.size() > 0) ||
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null))
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null) ||
|
||||
(change.isDeleted()) || (change.isWithdrawn()) || (change.isReinstated()))
|
||||
{
|
||||
// Show the item
|
||||
Item i = change.getItem();
|
||||
@@ -788,6 +858,41 @@ public class MetadataImport
|
||||
changeCounter++;
|
||||
}
|
||||
|
||||
// Show actions
|
||||
if (change.isDeleted())
|
||||
{
|
||||
if (changed)
|
||||
{
|
||||
System.out.println(" - EXPUNGED!");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(" - EXPUNGE!");
|
||||
}
|
||||
}
|
||||
if (change.isWithdrawn())
|
||||
{
|
||||
if (changed)
|
||||
{
|
||||
System.out.println(" - WITHDRAWN!");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(" - WITHDRAW!");
|
||||
}
|
||||
}
|
||||
if (change.isReinstated())
|
||||
{
|
||||
if (changed)
|
||||
{
|
||||
System.out.println(" - REINSTATED!");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(" - REINSTATE!");
|
||||
}
|
||||
}
|
||||
|
||||
if (change.getNewOwningCollection() != null)
|
||||
{
|
||||
Collection c = change.getNewOwningCollection();
|
||||
@@ -846,7 +951,7 @@ public class MetadataImport
|
||||
String cName = c.getName();
|
||||
if (!changed)
|
||||
{
|
||||
System.out.print(" + Um-map from collection (" + cHandle + "): ");
|
||||
System.out.print(" + Un-map from collection (" + cHandle + "): ");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1040,7 +1145,7 @@ public class MetadataImport
|
||||
}
|
||||
|
||||
// Perform the first import - just highlight differences
|
||||
MetadataImport importer = new MetadataImport(c, csv.getCSVLines());
|
||||
MetadataImport importer = new MetadataImport(c, csv);
|
||||
List<BulkEditChange> changes;
|
||||
|
||||
if (!line.hasOption('s'))
|
||||
@@ -1126,7 +1231,7 @@ public class MetadataImport
|
||||
catch (Exception e)
|
||||
{
|
||||
c.abort();
|
||||
System.err.println("Error commiting changes to database: " + e.getMessage());
|
||||
System.err.println("Error committing changes to database: " + e.getMessage());
|
||||
System.err.println("Aborting most recent changes.");
|
||||
System.exit(1);
|
||||
}
|
||||
|
@@ -312,6 +312,12 @@ jsp.dspace-admin.metadataimport.add = Add
|
||||
jsp.dspace-admin.metadataimport.added = Added
|
||||
jsp.dspace-admin.metadataimport.remove = Remove
|
||||
jsp.dspace-admin.metadataimport.removed = Removed
|
||||
jsp.dspace-admin.metadataimport.delete = Expunge Item
|
||||
jsp.dspace-admin.metadataimport.deleted = Item Expunged
|
||||
jsp.dspace-admin.metadataimport.withdraw = Withdraw Item
|
||||
jsp.dspace-admin.metadataimport.withdrawn = Item Withdrawn
|
||||
jsp.dspace-admin.metadataimport.reinstate = Reinstate Item
|
||||
jsp.dspace-admin.metadataimport.reinstated = Item Reinstated
|
||||
jsp.dspace-admin.metadataimport.toomany = There are too many changes. Please import fewer changes, adjust the limit, or perform the input directly on the server.
|
||||
jsp.dspace-admin.metadataimport.finished = {0} changes completed successfully.
|
||||
jsp.dspace-admin.index.heading = Administration Tools
|
||||
|
@@ -126,7 +126,7 @@ public class MetadataImportServlet extends DSpaceServlet
|
||||
// Make the changes
|
||||
try
|
||||
{
|
||||
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
|
||||
MetadataImport mImport = new MetadataImport(context, csv);
|
||||
List<BulkEditChange> changes = mImport.runImport(true, false, false, false);
|
||||
|
||||
// Commit the changes
|
||||
@@ -204,7 +204,7 @@ public class MetadataImportServlet extends DSpaceServlet
|
||||
|
||||
// Run the import
|
||||
DSpaceCSV csv = new DSpaceCSV(f, context);
|
||||
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
|
||||
MetadataImport mImport = new MetadataImport(context, csv);
|
||||
List<BulkEditChange> changes = mImport.runImport(false, false, false, false);
|
||||
|
||||
// Store the csv lines in the session
|
||||
|
@@ -79,7 +79,8 @@
|
||||
boolean first = false;
|
||||
if ((adds.size() > 0) || (removes.size() > 0) ||
|
||||
(newCollections.size() > 0) || (oldCollections.size() > 0) ||
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null))
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null) ||
|
||||
(change.isDeleted()) || (change.isWithdrawn()) || (change.isReinstated()))
|
||||
{
|
||||
// Show the item
|
||||
if (!change.isNewItem())
|
||||
@@ -95,6 +96,65 @@
|
||||
first = true;
|
||||
}
|
||||
|
||||
// Show actions
|
||||
if (change.isDeleted())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
%><tr><td bgcolor="white"></td><%
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#9B30FF" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.delete"/></td><td bgcolor="#9B30FF" style="font-size:10pt"></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#9B30FF" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.deleted"/></td><td bgcolor="#9B30FF" style="font-size:10pt"></td></tr><%
|
||||
}
|
||||
}
|
||||
if (change.isWithdrawn())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
%><tr><td bgcolor="white"></td><%
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#9B30FF" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.withdraw"/></td><td bgcolor="#9B30FF" style="font-size:10pt"></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#9B30FF" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.withdrawn"/></td><td bgcolor="#9B30FF" style="font-size:10pt"></td></tr><%
|
||||
}
|
||||
}
|
||||
if (change.isReinstated())
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
%><tr><td bgcolor="white"></td><%
|
||||
}
|
||||
else
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#9B30FF" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.reinstate"/></td><td bgcolor="#9B30FF" style="font-size:10pt"></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#9B30FF" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.reinstated"/></td><td bgcolor="#9B30FF" style="font-size:10pt"></td></tr><%
|
||||
}
|
||||
}
|
||||
|
||||
// Show new owner collection
|
||||
if (change.getNewOwningCollection() != null)
|
||||
{
|
||||
@@ -113,11 +173,11 @@
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addtoownercollection"/></td><td bgcolor="4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addtoownercollection"/></td><td bgcolor="#4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addedtoownercollection"/></td><td bgcolor="4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addedtoownercollection"/></td><td bgcolor="#4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,11 +200,11 @@
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removefromownercollection"/></td><td bgcolor="4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removefromownercollection"/></td><td bgcolor="#4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removedfromownercollection"/></td><td bgcolor="4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removedfromownercollection"/></td><td bgcolor="#4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,11 +224,11 @@
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addtocollection"/></td><td bgcolor="4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addtocollection"/></td><td bgcolor="#4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addedtocollection"/></td><td bgcolor="4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.addedtocollection"/></td><td bgcolor="#4E9258" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,11 +247,11 @@
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removefromcollection"/></td><td bgcolor="98AFC7" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removefromcollection"/></td><td bgcolor="#98AFC7" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removedfromcollection"/></td><td bgcolor="98AFC7" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removedfromcollection"/></td><td bgcolor="#98AFC7" style="font-size:10pt">(<%= cHandle %>): <%= cName %></td></tr><%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,11 +277,11 @@
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.add"/> (<%= md %>)</td><td bgcolor="4E9258" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.add"/> (<%= md %>)</td><td bgcolor="#4E9258" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.added"/> (<%= md %>)</td><td bgcolor="4E9258" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
%><td bgcolor="#4E9258" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.added"/> (<%= md %>)</td><td bgcolor="#4E9258" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,11 +307,11 @@
|
||||
}
|
||||
if (!changed)
|
||||
{
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.remove"/> (<%= md %>)</td><td bgcolor="98AFC7" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.remove"/> (<%= md %>)</td><td bgcolor="#98AFC7" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
}
|
||||
else
|
||||
{
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removed"/> (<%= md %>)</td><td bgcolor="98AFC7" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
%><td bgcolor="#98AFC7" style="font-size:10pt"><fmt:message key="jsp.dspace-admin.metadataimport.removed"/> (<%= md %>)</td><td bgcolor="#98AFC7" style="font-size:10pt"><%= dcv.value %></td></tr><%
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ public class FlowMetadataImportUtils
|
||||
try {
|
||||
|
||||
// Run the import
|
||||
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
|
||||
MetadataImport mImport = new MetadataImport(context, csv);
|
||||
List<BulkEditChange> changes = mImport.runImport(true, false, false, false);
|
||||
|
||||
// Commit the changes
|
||||
@@ -149,7 +149,7 @@ public class FlowMetadataImportUtils
|
||||
log.error("Unable to delete CSV file");
|
||||
}
|
||||
|
||||
MetadataImport mImport = new MetadataImport(context, csv.getCSVLines());
|
||||
MetadataImport mImport = new MetadataImport(context, csv);
|
||||
List<BulkEditChange> changes = mImport.runImport(false, false, false, false);
|
||||
log.debug(LogManager.getHeader(context, "metadataimport", changes.size() + " items with changes identified"));
|
||||
|
||||
@@ -201,6 +201,7 @@ public class FlowMetadataImportUtils
|
||||
result.setContinue(false);
|
||||
result.setOutcome(false);
|
||||
result.setMessage(T_upload_failed);
|
||||
result.setCharacters(e.getMessage());
|
||||
log.debug(LogManager.getHeader(context, "metadataimport", "Error encountered while looking for changes - " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
@@ -61,7 +61,9 @@ public class MetadataImportConfirm extends AbstractDSpaceTransformer {
|
||||
private static final Message T_collection_oldowner = message("xmlui.administrative.metadataimport.MetadataImportConfirm.collection_oldowner");
|
||||
private static final Message T_collection_mapped = message("xmlui.administrative.metadataimport.MetadataImportConfirm.collection_mapped");
|
||||
private static final Message T_collection_unmapped = message("xmlui.administrative.metadataimport.MetadataImportConfirm.collection_unmapped");
|
||||
|
||||
private static final Message T_item_deleted = message("xmlui.administrative.metadataimport.MetadataImportConfirm.item_deleted");
|
||||
private static final Message T_item_withdrawn = message("xmlui.administrative.metadataimport.MetadataImportConfirm.item_withdrawn");
|
||||
private static final Message T_item_reinstated = message("xmlui.administrative.metadataimport.MetadataImportConfirm.item_reinstated");
|
||||
|
||||
public void addPageMeta(PageMeta pageMeta) throws WingException
|
||||
{
|
||||
@@ -111,7 +113,8 @@ public class MetadataImportConfirm extends AbstractDSpaceTransformer {
|
||||
|
||||
if ((adds.size() > 0) || (removes.size() > 0) ||
|
||||
(newCollections.size() > 0) || (oldCollections.size() > 0) ||
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null))
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null) ||
|
||||
(change.isDeleted()) || (change.isWithdrawn()) || (change.isReinstated()))
|
||||
{
|
||||
Row headerrow = mdchanges.addRow(Row.ROLE_HEADER);
|
||||
// Show the item
|
||||
@@ -129,6 +132,32 @@ public class MetadataImportConfirm extends AbstractDSpaceTransformer {
|
||||
headerrow.addCell();
|
||||
}
|
||||
|
||||
// Show actions
|
||||
if (change.isDeleted())
|
||||
{
|
||||
Row mdrow = mdchanges.addRow("addition",Row.ROLE_DATA,"item-delete");
|
||||
|
||||
Cell cell = mdrow.addCell();
|
||||
cell.addContent(T_item_deleted);
|
||||
mdrow.addCellContent("");
|
||||
}
|
||||
if (change.isWithdrawn())
|
||||
{
|
||||
Row mdrow = mdchanges.addRow("addition",Row.ROLE_DATA,"item-withdraw");
|
||||
|
||||
Cell cell = mdrow.addCell();
|
||||
cell.addContent(T_item_withdrawn);
|
||||
mdrow.addCellContent("");
|
||||
}
|
||||
if (change.isReinstated())
|
||||
{
|
||||
Row mdrow = mdchanges.addRow("addition",Row.ROLE_DATA,"item-reinstate");
|
||||
|
||||
Cell cell = mdrow.addCell();
|
||||
cell.addContent(T_item_reinstated);
|
||||
mdrow.addCellContent("");
|
||||
}
|
||||
|
||||
// Show new owning collection
|
||||
if (change.getNewOwningCollection() != null)
|
||||
{
|
||||
|
@@ -61,6 +61,9 @@ public class MetadataImportUpload extends AbstractDSpaceTransformer {
|
||||
private static final Message T_collection_oldowner = message("xmlui.administrative.metadataimport.MetadataImportUpload.collection_oldowner");
|
||||
private static final Message T_collection_mapped = message("xmlui.administrative.metadataimport.MetadataImportUpload.collection_mapped");
|
||||
private static final Message T_collection_unmapped = message("xmlui.administrative.metadataimport.MetadataImportUpload.collection_unmapped");
|
||||
private static final Message T_item_delete = message("xmlui.administrative.metadataimport.MetadataImportUpload.item_delete");
|
||||
private static final Message T_item_withdraw = message("xmlui.administrative.metadataimport.MetadataImportUpload.item_withdraw");
|
||||
private static final Message T_item_reinstate = message("xmlui.administrative.metadataimport.MetadataImportUpload.item_reinstate");
|
||||
|
||||
public void addPageMeta(PageMeta pageMeta) throws WingException
|
||||
{
|
||||
@@ -85,7 +88,6 @@ public class MetadataImportUpload extends AbstractDSpaceTransformer {
|
||||
num_changes = changes.size();
|
||||
}
|
||||
|
||||
|
||||
// DIVISION: metadata-import
|
||||
Division div = body.addInteractiveDivision("metadata-import",contextPath + "/admin/metadataimport", Division.METHOD_MULTIPART,"primary administrative");
|
||||
div.setHead(T_head1);
|
||||
@@ -108,7 +110,8 @@ public class MetadataImportUpload extends AbstractDSpaceTransformer {
|
||||
|
||||
if ((adds.size() > 0) || (removes.size() > 0) ||
|
||||
(newCollections.size() > 0) || (oldCollections.size() > 0) ||
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null))
|
||||
(change.getNewOwningCollection() != null) || (change.getOldOwningCollection() != null) ||
|
||||
(change.isDeleted()) || (change.isWithdrawn()) || (change.isReinstated()))
|
||||
{
|
||||
Row headerrow = mdchanges.addRow(Row.ROLE_HEADER);
|
||||
// Show the item
|
||||
@@ -127,6 +130,32 @@ public class MetadataImportUpload extends AbstractDSpaceTransformer {
|
||||
headerrow.addCell();
|
||||
}
|
||||
|
||||
// Show actions
|
||||
if (change.isDeleted())
|
||||
{
|
||||
Row mdrow = mdchanges.addRow("addition",Row.ROLE_DATA,"item-delete");
|
||||
|
||||
Cell cell = mdrow.addCell();
|
||||
cell.addContent(T_item_delete);
|
||||
mdrow.addCellContent("");
|
||||
}
|
||||
if (change.isWithdrawn())
|
||||
{
|
||||
Row mdrow = mdchanges.addRow("addition",Row.ROLE_DATA,"item-withdraw");
|
||||
|
||||
Cell cell = mdrow.addCell();
|
||||
cell.addContent(T_item_withdraw);
|
||||
mdrow.addCellContent("");
|
||||
}
|
||||
if (change.isReinstated())
|
||||
{
|
||||
Row mdrow = mdchanges.addRow("addition",Row.ROLE_DATA,"item-reinstate");
|
||||
|
||||
Cell cell = mdrow.addCell();
|
||||
cell.addContent(T_item_reinstate);
|
||||
mdrow.addCellContent("");
|
||||
}
|
||||
|
||||
// Show new owning collection
|
||||
if (change.getNewOwningCollection() != null)
|
||||
{
|
||||
|
@@ -117,13 +117,13 @@ public class MetadataExportReader extends AbstractReader implements Recyclable
|
||||
if(dso.getType() == Constants.ITEM)
|
||||
{
|
||||
itemmd.add(dso.getID());
|
||||
exporter = new MetadataExport(context, new ItemIterator(context, itemmd),true);
|
||||
exporter = new MetadataExport(context, new ItemIterator(context, itemmd), false);
|
||||
}
|
||||
else if(dso.getType() == Constants.COLLECTION)
|
||||
{
|
||||
Collection collection = (Collection)dso;
|
||||
ItemIterator toExport = collection.getAllItems();
|
||||
exporter = new MetadataExport(context, toExport,true);
|
||||
exporter = new MetadataExport(context, toExport, false);
|
||||
}
|
||||
else if(dso.getType() == Constants.COMMUNITY)
|
||||
{
|
||||
|
@@ -1380,8 +1380,8 @@
|
||||
<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.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>
|
||||
@@ -1398,6 +1398,9 @@
|
||||
<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>
|
||||
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.item_deleted">Item Expunged</message>
|
||||
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.item_withdrawn">Item Withdrawn</message>
|
||||
<message key="xmlui.administrative.metadataimport.MetadataImportConfirm.item_reinstated">Item Reinstated</message>
|
||||
|
||||
<!-- org.dspace.app.xmlui.administrative.metadataimport.MetadataImportUpload -->
|
||||
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_add">Add: </message>
|
||||
@@ -1409,6 +1412,9 @@
|
||||
<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>
|
||||
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_delete">Expunge Item</message>
|
||||
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_withdraw">Withdraw Item</message>
|
||||
<message key="xmlui.administrative.metadataimport.MetadataImportUpload.item_reinstate">Reinstate Item</message>
|
||||
|
||||
<!-- general mapper messages -->
|
||||
<message key="xmlui.administrative.mapper.general.mapper_trail">Item mapper</message>
|
||||
|
@@ -515,6 +515,18 @@ tr.ds-table-row.metadata-addition td,tr.ds-table-row.metadata-deletion td {
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-delete {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-withdraw {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-reinstate {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
|
||||
/*******************************
|
||||
*********** forms ***********
|
||||
|
@@ -193,6 +193,17 @@ tr.ds-table-row.metadata-addition td,tr.ds-table-row.metadata-deletion td {
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-delete {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-withdraw {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-reinstate {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
.artifact-description
|
||||
{
|
||||
|
@@ -504,6 +504,18 @@ tr.ds-table-row.metadata-deletion {
|
||||
background-color: #CCCCCC;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-delete {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-withdraw {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
tr.ds-table-row.item-reinstate {
|
||||
background-color: #CC99FF;
|
||||
}
|
||||
|
||||
tr.ds-table-row.metadata-addition td,tr.ds-table-row.metadata-deletion td {
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
@@ -980,7 +980,7 @@ org.dspace.app.itemexport.max.size = 200
|
||||
# The delimiter used to separate values within a single field (defaults to a double pipe ||)
|
||||
# bulkedit.valueseparator = ||
|
||||
|
||||
# The delimiter used to serarate fields (defaults to a comma for CSV)
|
||||
# The delimiter used to separate fields (defaults to a comma for CSV)
|
||||
# bulkedit.fieldseparator = ,
|
||||
|
||||
# A hard limit of the number of items allowed to be edited in one go in the UI
|
||||
@@ -992,6 +992,9 @@ org.dspace.app.itemexport.max.size = 200
|
||||
# bulkedit.ignore-on-export = dc.date.accessioned, dc.date.available, \
|
||||
# dc.date.updated, dc.description.provenance
|
||||
|
||||
# Should the 'action' column allow the 'expunge' method. By default this is set to false
|
||||
# bulkedit.allowexpunge = false
|
||||
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
#--------------JSPUI & XMLUI CONFIGURATIONS---------------------#
|
||||
|
Reference in New Issue
Block a user