/** * Check if the item is an inprogress submission * * @param context The relevant DSpace Context. * @param item item to check * @return <code>true</code> if the item is an inprogress submission, i.e. a WorkspaceItem or WorkflowItem * @throws SQLException An exception that provides information on a database access error or other errors. */ public boolean isInProgressSubmission(Context context, Item item) throws SQLException { return workspaceItemService.findByItem(context, item) != null || workflowItemService.findByItem(context, item) != null; }
/** * Is the given item in a DSpace workspace? * <p> * This method queries the database directly to determine if this is the * case rather than using the DSpace API (which is very slow). * * @param context The relevant DSpace Context. * @param item item to check * @return true if item is in workspace * @throws DSpaceSwordException can be thrown by the internals of the DSpace SWORD implementation */ public boolean isItemInWorkspace(Context context, Item item) throws DSpaceSwordException { try { return workspaceItemService.findByItem(context, item) != null; } catch (SQLException e) { throw new DSpaceSwordException(e); } }
/** * Obtain the WorkspaceItem object which wraps the given Item. * <p> * This method queries the database directly to determine if this is the * case rather than using the DSpace API (which is very slow). * * @param context The relevant DSpace Context. * @param item item to check * @return workspace item * @throws DSpaceSwordException can be thrown by the internals of the DSpace SWORD implementation */ public WorkspaceItem getWorkspaceItem(Context context, Item item) throws DSpaceSwordException { try { return workspaceItemService.findByItem(context, item); } catch (SQLException e) { throw new DSpaceSwordException(e); } }
protected boolean isAnyItemInstalled(Context ctx, List<Bundle> bundles) throws SQLException { for (Bundle bundle : bundles) { for (Item item : bundle.getItems()) { if (workspaceItemService.findByItem(ctx, item) == null && workflowItemService.findByItem(ctx, item) == null) { return true; } } } return false; }
wsi = workspaceItemService.findByItem(context, item); } catch (Exception ex) { System.err.println("Caught " + ex.getClass().getCanonicalName() + " while looking for work*Items: " + ex.getMessage());
List<Item> items = b.getItems(); for (Item i : items) { if (workspaceItemService.findByItem(ctx, i) != null || workflowItemService.findByItem(ctx, i) != null) { log.debug(
if (workspaceItemService.findByItem(ctx, i) != null || workflowItemService.findByItem(ctx, i) != null) { log.debug("Ignoring Item " + i.getID() + " as a corresponding workspace or workflow item exists.");
if (workspaceItemService.findByItem(ctx, (Item) dso) != null || workflowItemService.findByItem(ctx, (Item) dso) != null) { log.debug(
@Override public void deleteVersionedItem(Context c, Version versionToDelete, VersionHistory history) throws SQLException { try { // if versionToDelete is the current version we have to reinstate the previous version // and reset canonical if (versionHistoryService.isLastVersion(c, history, versionToDelete) && versioningService.getVersionsByHistory(c, history).size() > 1) { // if a new version gets archived, the old one is set to false. // we need to do the oposite now, if the old version was previously // unarchived. If the old version is still archived, the new // version is a WorkspaceItem or WorkflowItem we should skip this, // as unarchiving of previous versions is done only when a newer // version gets archived. Item item = versionHistoryService.getPrevious(c, history, versionToDelete).getItem(); if (!item.isArchived() || workspaceItemService.findByItem(c, versionToDelete.getItem()) != null || workflowItemService.findByItem(c, versionToDelete.getItem()) != null) { item.setArchived(true); itemService.update(c, item); } } // assign tombstone to the Identifier and reset canonical to the previous version only if there is a // previous version Item itemToDelete = versionToDelete.getItem(); identifierService.delete(c, itemToDelete); } catch (SQLException | AuthorizeException | IdentifierException e) { throw new RuntimeException(e.getMessage(), e); } }
if (ContentServiceFactory.getInstance().getWorkspaceItemService().findByItem(ctx, item) != null || WorkflowServiceFactory.getInstance().getWorkflowItemService().findByItem(ctx, item) != null) {
if (workspaceItemService.findByItem(context, candidate) != null)
WorkspaceItem wsi = workspaceItemService.findByItem(c, item); if (wsi != null) { workspaceItemService.deleteAll(c, wsi);
if (workspaceItemService.findByItem(c, (Item) o) != null || workflowItemService.findByItem(c, (Item) o) != null) { ignoreCustomPolicies = true;
WorkspaceItem wsi = workspaceItemService.findByItem(context, item);
if (owningCollection == null) { InProgressSubmission inProgressSubmission = workspaceItemService.findByItem(context, item); if (inProgressSubmission == null) { inProgressSubmission = WorkflowServiceFactory.getInstance().getWorkflowItemService()