// Build some provenance data while we're at it.
Collection[] colls = getCollections();
// Add suitable provenance - includes user, date, collections +
// bitstream checksums
EPerson e = ourContext.getCurrentUser();
StringBuilder prov = new StringBuilder();
prov.append("Item reinstated by ").append(e.getFullName()).append(" (")
.append(e.getEmail()).append(") on ").append(timestamp).append("\n")
.append("Item was in collections:\n");
for (int i = 0; i < colls.length; i++)
{
prov.append(colls[i].getMetadata("name")).append(" (ID: ").append(colls[i].getID()).append(")\n");
}
// Clear withdrawn flag
itemRow.setColumn("withdrawn", false);
// in_archive flag is now true
itemRow.setColumn("in_archive", true);
// Add suitable provenance - includes user, date, collections +
// bitstream checksums
prov.append(InstallItem.getBitstreamProvenanceMessage(this));
addDC("description", "provenance", "en", prov.toString());
// Update item in DB
update();
ourContext.addEvent(new Event(Event.MODIFY, Constants.ITEM, getID(), "REINSTATE"));
// authorization policies
if (colls.length > 0)
{
// FIXME: not multiple inclusion friendly - just apply access
// policies from first collection
// remove the item's policies and replace them with
// the defaults from the collection
inheritCollectionDefaultPolicies(colls[0]);
}
// Write log
log.info(LogManager.getHeader(ourContext, "reinstate_item", "user="
+ e.getEmail() + ",item_id=" + getID()));
}