@Override public BasicWorkflowItem startWithoutNotify(Context c, WorkspaceItem wsi) throws SQLException, AuthorizeException, IOException { // make a hash table entry with item ID for no notify // notify code checks no notify hash for item id noEMail.put(wsi.getItem().getID(), Boolean.TRUE); return start(c, wsi); }
@Override public void remove(Context context, WorkspaceItem workspaceItem, Group group) throws SQLException, AuthorizeException { // get the workspace item and the group from the request values workspaceItem.getSupervisorGroups().remove(group); // get the item and have it remove the policies for the group Item item = workspaceItem.getItem(); itemService.removeGroupPolicies(context, item, group); }
/** * startWithoutNotify() starts the workflow normally, but disables * notifications (useful for large imports,) for the first workflow step - * subsequent notifications happen normally */ @Override public XmlWorkflowItem startWithoutNotify(Context context, WorkspaceItem wsi) throws SQLException, AuthorizeException, IOException, WorkflowException { // make a hash table entry with item ID for no notify // notify code checks no notify hash for item id noEMail.put(wsi.getItem().getID(), Boolean.TRUE); return start(context, wsi); }
@Override public Item createNewItemAndAddItInWorkspace(Context context, Item nativeItem) { try { WorkspaceItem workspaceItem = workspaceItemService.create(context, nativeItem.getOwningCollection(), false); Item itemNew = workspaceItem.getItem(); itemService.update(context, itemNew); return itemNew; } catch (SQLException | AuthorizeException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public Item create(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException { if (workspaceItem.getItem() != null) { throw new IllegalArgumentException( "Attempting to create an item for a workspace item that already contains an item"); } Item item = createItem(context); workspaceItem.setItem(item); log.info(LogManager.getHeader(context, "create_item", "item_id=" + item.getID())); return item; }
@Override public void move(Context context, WorkspaceItem source, Collection fromCollection, Collection toCollection) throws DCInputsReaderException { source.setCollection(toCollection); List<MetadataValue> remove = new ArrayList<>(); List<String> diff = Util.differenceInSubmissionFields(fromCollection, toCollection); for (String toRemove : diff) { for (MetadataValue value : source.getItem().getMetadata()) { if (value.getMetadataField().toString('.').equals(toRemove)) { remove.add(value); } } } source.getItem().removeMetadata(remove); }
@Override public void update(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException { // Authorisation is checked by the item.update() method below log.info(LogManager.getHeader(context, "update_workspace_item", "workspace_item_id=" + workspaceItem.getID())); // Update the item itemService.update(context, workspaceItem.getItem()); // Update ourselves workspaceItemDAO.save(context, workspaceItem); }
@Override public List<String> generateOutput(RecordSet recordSet) { log.info("BTE OutputGenerator started. Records to output: " + recordSet.getRecords().size()); // Printing debug message String totalString = ""; for (Record record : recordSet.getRecords()) { totalString += SubmissionLookupUtils.getPrintableString(record) + "\n"; } log.debug("Records to output:\n" + totalString); witems = new ArrayList<WorkspaceItem>(); for (Record rec : recordSet.getRecords()) { try { WorkspaceItem wi = workspaceItemService.create(context, collection, true); merge(formName, wi.getItem(), rec); witems.add(wi); } catch (AuthorizeException e) { log.error(e.getMessage(), e); } catch (SQLException e) { log.error(e.getMessage(), e); } } return new ArrayList<String>(); }
Item item = wsItem.getItem();
Item item = wsItem.getItem(); AuthorizeManager.authorizeAction(context, item, Constants.READ);
@Override public void deleteWrapper(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException { // Check authorisation. We check permissions on the enclosed item. Item item = workspaceItem.getItem(); authorizeService.authorizeAction(context, item, Constants.WRITE); log.info(LogManager.getHeader(context, "delete_workspace_item", "workspace_item_id=" + workspaceItem.getID() + "item_id=" + item.getID() + "collection_id=" + workspaceItem.getCollection().getID())); // deleteSubmitPermissions(); // Need to delete the workspaceitem row first since it refers // to item ID workspaceItem.getSupervisorGroups().clear(); workspaceItemDAO.delete(context, workspaceItem); }
@Override public WorkspaceItem abort(Context c, XmlWorkflowItem wi, EPerson e) throws AuthorizeException, SQLException, IOException { if (!authorizeService.isAdmin(c)) { throw new AuthorizeException( "You must be an admin to abort a workflow"); } c.turnOffAuthorisationSystem(); //Restore permissions for the submitter // convert into personal workspace WorkspaceItem wsi = returnToWorkspace(c, wi); log.info(LogManager.getHeader(c, "abort_workflow", "workflow_item_id=" + wi.getID() + "item_id=" + wsi.getItem().getID() + "collection_id=" + wi.getCollection().getID() + "eperson_id=" + e.getID())); c.restoreAuthSystemState(); return wsi; }
return wsi.getItem();
@Override public void deleteAll(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException, IOException { /* * Authorisation is a special case. The submitter won't have REMOVE * permission on the collection, so our policy is this: Only the * original submitter or an administrator can delete a workspace item. */ Item item = workspaceItem.getItem(); if (!authorizeService.isAdmin(context) && ((context.getCurrentUser() == null) || (context .getCurrentUser().getID() != item.getSubmitter() .getID()))) { // Not an admit, not the submitter throw new AuthorizeException("Must be an administrator or the " + "original submitter to delete a workspace item"); } log.info(LogManager.getHeader(context, "delete_workspace_item", "workspace_item_id=" + workspaceItem.getID() + "item_id=" + item.getID() + "collection_id=" + workspaceItem.getCollection().getID())); // Need to delete the epersongroup2workspaceitem row first since it refers // to workspaceitem ID workspaceItem.getSupervisorGroups().clear(); // Need to delete the workspaceitem row first since it refers // to item ID workspaceItemDAO.delete(context, workspaceItem); // Delete item itemService.delete(context, item); }
@Override public BasicWorkflowItem start(Context context, WorkspaceItem wsi) throws SQLException, AuthorizeException, IOException { Item myitem = wsi.getItem(); Collection collection = wsi.getCollection(); log.info(LogManager.getHeader(context, "start_workflow", "workspace_item_id=" + wsi.getID() + "item_id=" + myitem.getID() + "collection_id=" + collection.getID())); // record the start of the workflow w/provenance message recordStart(context, myitem); // create the WorkflowItem BasicWorkflowItem wfi = workflowItemService.create(context, myitem, collection); wfi.setMultipleFiles(wsi.hasMultipleFiles()); wfi.setMultipleTitles(wsi.hasMultipleTitles()); wfi.setPublishedBefore(wsi.isPublishedBefore()); // remove the WorkspaceItem workspaceItemService.deleteWrapper(context, wsi); // now get the workflow started wfi.setState(WFSTATE_SUBMIT); advance(context, wfi, null); // Return the workflow item return wfi; }
+ wsi.getID() + "item_id=" + wsi.getItem().getID() + "collection_id=" + wsi.getCollection().getID() + "eperson_id=" + context.getCurrentUser().getID()));
Item item = workspaceItem.getItem();
+ ePerson.getID())); logWorkflowEvent(context, wsi.getItem(), workflowItem, ePerson, WFSTATE_SUBMIT, null, wsi.getCollection(), oldState, null);
throws SQLException, AuthorizeException, IOException, WorkflowException { try { Item myitem = wsi.getItem(); Collection collection = wsi.getCollection(); Workflow wf = xmlWorkflowFactory.getWorkflow(collection);