/** * Commit the contained item to the main archive. The item is associated with the relevant * collection, added to the search index, and any other tasks such as assigning dates are * performed. * * @return the fully archived item. */ @Override public Item archive(Context context, BasicWorkflowItem workflowItem) throws SQLException, IOException, AuthorizeException { // FIXME: Check auth Item item = workflowItem.getItem(); Collection collection = workflowItem.getCollection(); log.info( LogManager.getHeader( context, "archive_item", "workflow_item_id=" + workflowItem.getID() + "item_id=" + item.getID() + "collection_id=" + collection.getID())); installItemService.installItem(context, workflowItem); // Log the event log.info( LogManager.getHeader( context, "install_item", "workflow_id=" + workflowItem.getID() + ", item_id=" + item.getID() + "handle=FIXME")); return item; }
// Record approval provenance statement protected void recordApproval(Context context, BasicWorkflowItem workflowItem, EPerson e) throws SQLException, IOException, AuthorizeException { Item item = workflowItem.getItem(); // Get user's name + email address String usersName = getEPersonName(e); // Get current date String now = DCDate.getCurrent().toString(); // Here's what happened String provDescription = "Approved for entry into archive by " + usersName + " on " + now + " (GMT) "; // add bitstream descriptions (name, size, checksums) provDescription += installItemService.getBitstreamProvenanceMessage(context, item); // Add to item as a DC field itemService.addMetadata( context, item, MetadataSchema.DC_SCHEMA, "description", "provenance", "en", provDescription); itemService.update(context, item); }
// Create workflow start provenance message protected void recordStart(Context context, Item myitem) throws SQLException, IOException, AuthorizeException { // get date DCDate now = DCDate.getCurrent(); // Create provenance description String provmessage; if (myitem.getSubmitter() != null) { provmessage = "Submitted by " + myitem.getSubmitter().getFullName() + " (" + myitem.getSubmitter().getEmail() + ") on " + now.toString() + "\n"; } else // null submitter { provmessage = "Submitted by unknown (probably automated) on" + now.toString() + "\n"; } // add sizes and checksums of bitstreams provmessage += installItemService.getBitstreamProvenanceMessage(context, myitem); // Add message to the DC itemService.addMetadata( context, myitem, MetadataSchema.DC_SCHEMA, "description", "provenance", "en", provmessage); itemService.update(context, myitem); }
/** * Commit the contained item to the main archive. The item is associated with the relevant * collection, added to the search index, and any other tasks such as assigning dates are * performed. * * @param context The relevant DSpace Context. * @param wfi workflow item * @return the fully archived item. * @throws IOException A general class of exceptions produced by failed or interrupted I/O * operations. * @throws SQLException An exception that provides information on a database access error or other * errors. * @throws AuthorizeException Exception indicating the current user of the context does not have * permission to perform a particular action. */ @Override public Item archive(Context context, XmlWorkflowItem wfi) throws SQLException, IOException, AuthorizeException { // FIXME: Check auth Item item = wfi.getItem(); Collection collection = wfi.getCollection(); // Remove (if any) the workflowItemroles for this item workflowItemRoleService.deleteForWorkflowItem(context, wfi); log.info( LogManager.getHeader( context, "archive_item", "workflow_item_id=" + wfi.getID() + "item_id=" + item.getID() + "collection_id=" + collection.getID())); installItemService.installItem(context, wfi); // Notify notifyOfArchive(context, item, collection); // Clear any remaining workflow metadata itemService.clearMetadata( context, item, WorkflowRequirementsService.WORKFLOW_SCHEMA, Item.ANY, Item.ANY, Item.ANY); itemService.update(context, item); // Log the event log.info( LogManager.getHeader( context, "install_item", "workflow_item_id=" + wfi.getID() + ", item_id=" + item.getID() + "handle=FIXME")); return item; }