mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 13:33:08 +00:00
DS-1052: Items with null date.accessioned are perminantly sorted to the top of all date based searches. (committed to both trunk and branch)
git-svn-id: http://scm.dspace.org/svn/repo/dspace/branches/dspace-1_8_x@6864 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -123,10 +123,29 @@ public class InstallItem
|
||||
handle = HandleManager.createHandle(c, item, suppliedHandle);
|
||||
}
|
||||
|
||||
//NOTE: this method specifically skips over "populateMetadata()"
|
||||
// As this is a "restore" all the metadata should have already been restored
|
||||
|
||||
//@TODO: Do we actually want a "Restored on ..." provenance message? Or perhaps kick off an event?
|
||||
// Even though we are restoring an item it may not have a have the proper dates. So lets
|
||||
// double check that it has a date accessioned and date issued, and if either of those dates
|
||||
// are not set then set them to today.
|
||||
DCDate now = DCDate.getCurrent();
|
||||
|
||||
// If the item dosn't have a date.accessioned create one.
|
||||
DCValue[] dateAccessioned = item.getDC("date", "accessioned", Item.ANY);
|
||||
if (dateAccessioned.length == 0)
|
||||
{
|
||||
item.addDC("date", "accessioned", null, now.toString());
|
||||
}
|
||||
|
||||
// create issue date if not present
|
||||
DCValue[] currentDateIssued = item.getDC("date", "issued", Item.ANY);
|
||||
if (currentDateIssued.length == 0)
|
||||
{
|
||||
DCDate issued = new DCDate(now.getYear(),now.getMonth(),now.getDay(),-1,-1,-1);
|
||||
item.addDC("date", "issued", null, issued.toString());
|
||||
}
|
||||
|
||||
// Record that the item was restored
|
||||
String provDescription = "Restored into DSpace on "+ now + " (GMT).";
|
||||
item.addDC("description", "provenance", "en", provDescription);
|
||||
|
||||
return finishItem(c, item, is, null);
|
||||
}
|
||||
@@ -153,7 +172,7 @@ public class InstallItem
|
||||
}
|
||||
}
|
||||
|
||||
// fill in metadata needed by new Item.
|
||||
|
||||
private static void populateMetadata(Context c, Item item, DCDate embargoLiftDate)
|
||||
throws SQLException, IOException, AuthorizeException
|
||||
{
|
||||
|
Reference in New Issue
Block a user