@Override public void consume(Context ctx, Event event) throws Exception { if (itemsToUpdateAuthority == null) { itemsToUpdateAuthority = new HashSet<>(); itemsToReindex = new HashSet<>(); } DSpaceObject dso = event.getSubject(ctx); if (dso instanceof Item) { Item item = (Item) dso; if (item.isArchived()) { if (!itemsToReindex.contains(item.getID())) { itemsToReindex.add(item.getID()); } } if (("ARCHIVED: " + true).equals(event.getDetail())) { itemsToUpdateAuthority.add(item.getID()); } } }
public void modifyState(Context context, Item item) throws SwordError, DSpaceSwordException { WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
public void deleteItem(Context context, Item item) throws SwordError, DSpaceSwordException { WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
public void replaceResourceContent(Context context, Item item) throws SwordError, DSpaceSwordException { WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
public void deleteMediaResource(Context context, Item item) throws SwordError, DSpaceSwordException { WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
public void addResourceContent(Context context, Item item) throws SwordError, DSpaceSwordException { WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
protected Map<String, String> getStates(Context context, Item item) throws DSpaceSwordException { SwordConfigurationDSpace config = new SwordConfigurationDSpace(); WorkflowTools wft = new WorkflowTools(); Map<String, String> states = new HashMap<String, String>(); if (item.isWithdrawn()) { String uri = config.getStateUri("withdrawn"); String desc = config.getStateDescription("withdrawn"); states.put(uri, desc); } else if (item.isArchived()) { String uri = config.getStateUri("archive"); String desc = config.getStateDescription("archive"); states.put(uri, desc); } else if (wft.isItemInWorkflow(context, item)) { String uri = config.getStateUri("workflow"); String desc = config.getStateDescription("workflow"); states.put(uri, desc); } else if (wft.isItemInWorkspace(context, item)) { String uri = config.getStateUri("workspace"); String desc = config.getStateDescription("workspace"); states.put(uri, desc); } return states; }
case Constants.ITEM: Item item = (Item) dso; if (item.isArchived() || item.isWithdrawn()) {
case Constants.ITEM: Item item = (Item) dso; if (item.isArchived() && !item.isWithdrawn()) {
public void replaceMetadata(Context context, Item item) throws SwordError, DSpaceSwordException { boolean allowUpdate = ConfigurationManager .getBooleanProperty("swordv2-server", "workflowmanagerdefault.always-update-metadata"); if (allowUpdate) { // all updates are allowed return; } // otherwise, go ahead and figure out the state WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
this.setArchived(Boolean.toString(item.isArchived())); this.setWithdrawn(Boolean.toString(item.isWithdrawn())); this.setLastModified(item.getLastModified().toString());
public void addMetadata(Context context, Item item) throws SwordError, DSpaceSwordException { boolean allowUpdate = ConfigurationManager .getBooleanProperty("swordv2-server", "workflowmanagerdefault.always-update-metadata"); if (allowUpdate) { // all updates are allowed return; } // otherwise, lookup the state of the item WorkflowTools wft = new WorkflowTools(); if (item.isArchived() || item.isWithdrawn()) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been archived, and can no longer be modified"); } if (wft.isItemInWorkflow(context, item)) { throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED, "The item has already been injected into the review workflow, and can no longer be " + "modified"); } }
@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 (dso instanceof Item) { Item item = (Item) dso; if (!item.isArchived()) { throw new ItemNotArchivedException();
if (item != null && item.isArchived()) { VersionHistory history = versionHistoryService.findByItem(ctx, item); if (history != null) {
if (item.isArchived() || item.isWithdrawn()) {
if (!item.isArchived()) { WorkspaceItem wsi = workspaceItemService.findByItem(c, item); if (wsi != null) {
boolean inarch = item.isArchived() || item.isWithdrawn();
boolean inarch = item.isArchived() || item.isWithdrawn();
} finally { if ((nextStep != null && currentStep != null && nextActionConfig != null) || (wfi.getItem() .isArchived() && currentStep != null)) { logWorkflowEvent(c, currentStep.getWorkflow().getID(), currentStep.getId(),