Remove Traditional/Basic Workflow from codebase and database - restore in-between layer

This commit is contained in:
Samuel
2021-02-24 15:31:29 +01:00
parent a752f7638e
commit b779b91e54
48 changed files with 483 additions and 336 deletions

View File

@@ -64,9 +64,9 @@ import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.utils.DSpace; import org.dspace.utils.DSpace;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.factory.WorkflowServiceFactory;
/** /**
* Metadata importer to allow the batch import of metadata from a file * Metadata importer to allow the batch import of metadata from a file
@@ -370,7 +370,7 @@ public class MetadataImport extends DSpaceRunnable<MetadataImportScriptConfigura
} }
WorkspaceItem wsItem = null; WorkspaceItem wsItem = null;
XmlWorkflowItem wfItem = null; WorkflowItem wfItem = null;
Item item = null; Item item = null;
// Is this an existing item? // Is this an existing item?
@@ -570,8 +570,7 @@ public class MetadataImport extends DSpaceRunnable<MetadataImportScriptConfigura
// Should the workflow be used? // Should the workflow be used?
if (useWorkflow) { if (useWorkflow) {
XmlWorkflowService workflowService WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
= XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
if (workflowNotify) { if (workflowNotify) {
wfItem = workflowService.start(c, wsItem); wfItem = workflowService.start(c, wsItem);
} else { } else {

View File

@@ -97,8 +97,8 @@ import org.dspace.eperson.service.GroupService;
import org.dspace.handle.service.HandleService; import org.dspace.handle.service.HandleService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.utils.DSpace; import org.dspace.utils.DSpace;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowService;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@@ -156,7 +156,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
@Autowired(required = true) @Autowired(required = true)
protected WorkspaceItemService workspaceItemService; protected WorkspaceItemService workspaceItemService;
@Autowired(required = true) @Autowired(required = true)
protected XmlWorkflowService workflowService; protected WorkflowService workflowService;
@Autowired(required = true) @Autowired(required = true)
protected ConfigurationService configurationService; protected ConfigurationService configurationService;
@@ -498,7 +498,7 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
// create workspace item // create workspace item
Item myitem = null; Item myitem = null;
WorkspaceItem wi = null; WorkspaceItem wi = null;
XmlWorkflowItem wfi = null; WorkflowItem wfi = null;
if (!isTest) { if (!isTest) {
wi = workspaceItemService.create(c, mycollections.iterator().next(), template); wi = workspaceItemService.create(c, mycollections.iterator().next(), template);

View File

@@ -33,7 +33,7 @@ import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.eperson.service.GroupService; import org.dspace.eperson.service.GroupService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.WorkflowItemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
@@ -63,7 +63,7 @@ public class AuthorizeServiceImpl implements AuthorizeService {
@Autowired(required = true) @Autowired(required = true)
protected WorkspaceItemService workspaceItemService; protected WorkspaceItemService workspaceItemService;
@Autowired(required = true) @Autowired(required = true)
protected XmlWorkflowItemService workflowItemService; protected WorkflowItemService workflowItemService;
protected AuthorizeServiceImpl() { protected AuthorizeServiceImpl() {

View File

@@ -57,9 +57,9 @@ import org.dspace.harvest.service.HarvestedCollectionService;
import org.dspace.identifier.IdentifierException; import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService; import org.dspace.identifier.service.IdentifierService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.dspace.xmlworkflow.WorkflowConfigurationException; import org.dspace.xmlworkflow.WorkflowConfigurationException;
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory; import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
import org.dspace.xmlworkflow.state.Workflow; import org.dspace.xmlworkflow.state.Workflow;
import org.dspace.xmlworkflow.storedcomponents.CollectionRole; import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService; import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
@@ -748,8 +748,8 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
} }
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService().deleteCollection(context, collection); WorkflowServiceFactory.getInstance().getWorkflowService().deleteCollection(context, collection);
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService().deleteByCollection(context, collection); WorkflowServiceFactory.getInstance().getWorkflowItemService().deleteByCollection(context, collection);
// get rid of the content count cache if it exists // get rid of the content count cache if it exists
// Remove any Handle // Remove any Handle

View File

@@ -55,8 +55,8 @@ import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService; import org.dspace.identifier.service.IdentifierService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.versioning.service.VersioningService; import org.dspace.versioning.service.VersioningService;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItemService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
@@ -106,7 +106,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
@Autowired(required = true) @Autowired(required = true)
protected WorkspaceItemService workspaceItemService; protected WorkspaceItemService workspaceItemService;
@Autowired(required = true) @Autowired(required = true)
protected XmlWorkflowItemService workflowItemService; protected WorkflowItemService workflowItemService;
@Autowired(required = true) @Autowired(required = true)
protected RelationshipService relationshipService; protected RelationshipService relationshipService;
@@ -1138,8 +1138,7 @@ prevent the generation of resource policy entry values with null dspace_object a
.findByItem(context, .findByItem(context,
item); item);
if (inprogress == null) { if (inprogress == null) {
inprogress inprogress = WorkflowServiceFactory.getInstance().getWorkflowItemService().findByItem(context, item);
= XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService().findByItem(context, item);
} }
if (inprogress != null) { if (inprogress != null) {

View File

@@ -28,7 +28,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItem;
import org.hibernate.proxy.HibernateProxyHelper; import org.hibernate.proxy.HibernateProxyHelper;
/** /**
@@ -90,7 +90,7 @@ public class WorkspaceItem
* Protected constructor, create object using: * Protected constructor, create object using:
* {@link org.dspace.content.service.WorkspaceItemService#create(Context, Collection, boolean)} * {@link org.dspace.content.service.WorkspaceItemService#create(Context, Collection, boolean)}
* or * or
* {@link org.dspace.content.service.WorkspaceItemService#create(Context, XmlWorkflowItem)} * {@link org.dspace.content.service.WorkspaceItemService#create(Context, WorkflowItem)}
*/ */
protected WorkspaceItem() { protected WorkspaceItem() {

View File

@@ -28,8 +28,8 @@ import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.event.Event; import org.dspace.event.Event;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
@@ -53,7 +53,7 @@ public class WorkspaceItemServiceImpl implements WorkspaceItemService {
@Autowired(required = true) @Autowired(required = true)
protected ItemService itemService; protected ItemService itemService;
@Autowired(required = true) @Autowired(required = true)
protected XmlWorkflowService workflowService; protected WorkflowService workflowService;
protected WorkspaceItemServiceImpl() { protected WorkspaceItemServiceImpl() {
@@ -138,7 +138,7 @@ public class WorkspaceItemServiceImpl implements WorkspaceItemService {
} }
@Override @Override
public WorkspaceItem create(Context c, XmlWorkflowItem workflowItem) throws SQLException, AuthorizeException { public WorkspaceItem create(Context c, WorkflowItem workflowItem) throws SQLException, AuthorizeException {
WorkspaceItem workspaceItem = workspaceItemDAO.create(c, new WorkspaceItem()); WorkspaceItem workspaceItem = workspaceItemDAO.create(c, new WorkspaceItem());
workspaceItem.setItem(workflowItem.getItem()); workspaceItem.setItem(workflowItem.getItem());
workspaceItem.setCollection(workflowItem.getCollection()); workspaceItem.setCollection(workflowItem.getCollection());

View File

@@ -34,7 +34,7 @@ import org.dspace.content.service.SiteService;
import org.dspace.content.service.SupervisedItemService; import org.dspace.content.service.SupervisedItemService;
import org.dspace.content.service.WorkspaceItemService; import org.dspace.content.service.WorkspaceItemService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
/** /**
* Abstract factory to get services for the content package, use ContentServiceFactory.getInstance() to retrieve an * Abstract factory to get services for the content package, use ContentServiceFactory.getInstance() to retrieve an
@@ -109,7 +109,7 @@ public abstract class ContentServiceFactory {
if (inProgressSubmission instanceof WorkspaceItem) { if (inProgressSubmission instanceof WorkspaceItem) {
return getWorkspaceItemService(); return getWorkspaceItemService();
} else { } else {
return XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService(); return WorkflowServiceFactory.getInstance().getWorkflowItemService();
} }
} }

View File

@@ -49,7 +49,7 @@ import org.dspace.handle.service.HandleService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.jdom.Element; import org.jdom.Element;
/** /**
@@ -628,7 +628,7 @@ public abstract class AbstractMETSIngester extends AbstractPackageIngester {
//We are probably dealing with an item that isn't archived yet //We are probably dealing with an item that isn't archived yet
InProgressSubmission inProgressSubmission = workspaceItemService.findByItem(context, item); InProgressSubmission inProgressSubmission = workspaceItemService.findByItem(context, item);
if (inProgressSubmission == null) { if (inProgressSubmission == null) {
inProgressSubmission = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService() inProgressSubmission = WorkflowServiceFactory.getInstance().getWorkflowItemService()
.findByItem(context, item); .findByItem(context, item);
} }
owningCollection = inProgressSubmission.getCollection(); owningCollection = inProgressSubmission.getCollection();

View File

@@ -52,8 +52,8 @@ import org.dspace.handle.factory.HandleServiceFactory;
import org.dspace.handle.service.HandleService; import org.dspace.handle.service.HandleService;
import org.dspace.license.service.CreativeCommonsService; import org.dspace.license.service.CreativeCommonsService;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.factory.WorkflowServiceFactory;
/** /**
* Container class for code that is useful to many packagers. * Container class for code that is useful to many packagers.
@@ -520,7 +520,7 @@ public class PackageUtils {
} else if (params.workflowEnabled()) { } else if (params.workflowEnabled()) {
// if we are treating package as a SIP, and we are told to respect workflows // if we are treating package as a SIP, and we are told to respect workflows
XmlWorkflowService workflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService(); WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
// Start an item workflow // Start an item workflow
// (NOTICE: The specified handle is ignored, as Workflows *always* end in a new handle being assigned) // (NOTICE: The specified handle is ignored, as Workflows *always* end in a new handle being assigned)
return workflowService.startWithoutNotify(context, wsi).getItem(); return workflowService.startWithoutNotify(context, wsi).getItem();

View File

@@ -18,7 +18,7 @@ import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem; import org.dspace.content.WorkspaceItem;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItem;
/** /**
* Service interface class for the WorkspaceItem object. * Service interface class for the WorkspaceItem object.
@@ -55,7 +55,7 @@ public interface WorkspaceItemService extends InProgressSubmissionService<Worksp
public WorkspaceItem create(Context context, Collection collection, boolean template) public WorkspaceItem create(Context context, Collection collection, boolean template)
throws AuthorizeException, SQLException; throws AuthorizeException, SQLException;
public WorkspaceItem create(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException; public WorkspaceItem create(Context c, WorkflowItem wfi) throws SQLException, AuthorizeException;
/** /**

View File

@@ -22,7 +22,7 @@ import org.dspace.discovery.configuration.DiscoveryConfiguration;
import org.dspace.discovery.configuration.DiscoveryConfigurationService; import org.dspace.discovery.configuration.DiscoveryConfigurationService;
import org.dspace.kernel.ServiceManager; import org.dspace.kernel.ServiceManager;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItem;
/** /**
* Util methods used by discovery * Util methods used by discovery
@@ -140,8 +140,7 @@ public class SearchUtils {
* @return a list of discovery configuration * @return a list of discovery configuration
* @throws SQLException * @throws SQLException
*/ */
public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(XmlWorkflowItem witem) public static List<DiscoveryConfiguration> getAllDiscoveryConfigurations(WorkflowItem witem) throws SQLException {
throws SQLException {
List<Collection> collections = new ArrayList<Collection>(); List<Collection> collections = new ArrayList<Collection>();
collections.add(witem.getCollection()); collections.add(witem.getCollection());
return getAllDiscoveryConfigurations("workflow", collections, witem.getItem()); return getAllDiscoveryConfigurations("workflow", collections, witem.getItem());

View File

@@ -49,6 +49,8 @@ import org.dspace.versioning.dao.VersionDAO;
import org.dspace.versioning.factory.VersionServiceFactory; import org.dspace.versioning.factory.VersionServiceFactory;
import org.dspace.versioning.service.VersionHistoryService; import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService; import org.dspace.versioning.service.VersioningService;
import org.dspace.workflow.WorkflowService;
import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.dspace.xmlworkflow.WorkflowConfigurationException; import org.dspace.xmlworkflow.WorkflowConfigurationException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
import org.dspace.xmlworkflow.service.WorkflowRequirementsService; import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
@@ -518,7 +520,7 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
tableList.add("resourcepolicy"); tableList.add("resourcepolicy");
} }
XmlWorkflowService workflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService(); WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
List<String> workflowConstraints = workflowService.getEPersonDeleteConstraints(context, ePerson); List<String> workflowConstraints = workflowService.getEPersonDeleteConstraints(context, ePerson);
tableList.addAll(workflowConstraints); tableList.addAll(workflowConstraints);

View File

@@ -19,7 +19,7 @@ import org.dspace.identifier.DOIIdentifierProvider;
import org.dspace.identifier.IdentifierException; import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.IdentifierNotFoundException; import org.dspace.identifier.IdentifierNotFoundException;
import org.dspace.utils.DSpace; import org.dspace.utils.DSpace;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
/** /**
* @author Pascal-Nicolas Becker (p dot becker at tu hyphen berlin dot de) * @author Pascal-Nicolas Becker (p dot becker at tu hyphen berlin dot de)
@@ -64,7 +64,7 @@ public class DOIConsumer implements Consumer {
Item item = (Item) dso; Item item = (Item) dso;
if (ContentServiceFactory.getInstance().getWorkspaceItemService().findByItem(ctx, item) != null if (ContentServiceFactory.getInstance().getWorkspaceItemService().findByItem(ctx, item) != null
|| XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService().findByItem(ctx, item) != null) { || WorkflowServiceFactory.getInstance().getWorkflowItemService().findByItem(ctx, item) != null) {
// ignore workflow and workspace items, DOI will be minted when item is installed // ignore workflow and workspace items, DOI will be minted when item is installed
return; return;
} }

View File

@@ -33,8 +33,8 @@ import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.event.Consumer; import org.dspace.event.Consumer;
import org.dspace.event.Event; import org.dspace.event.Event;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItemService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.factory.WorkflowServiceFactory;
/** /**
* @author Pascal-Nicolas Becker (dspace -at- pascal -hyphen- becker -dot- de) * @author Pascal-Nicolas Becker (dspace -at- pascal -hyphen- becker -dot- de)
@@ -49,7 +49,7 @@ public class RDFConsumer implements Consumer {
protected BundleService bundleService; protected BundleService bundleService;
protected SiteService siteService; protected SiteService siteService;
protected WorkspaceItemService workspaceItemService; protected WorkspaceItemService workspaceItemService;
protected XmlWorkflowItemService workflowItemService; protected WorkflowItemService workflowItemService;
@Override @Override
public void initialize() throws Exception { public void initialize() throws Exception {
@@ -57,7 +57,7 @@ public class RDFConsumer implements Consumer {
bundleService = ContentServiceFactory.getInstance().getBundleService(); bundleService = ContentServiceFactory.getInstance().getBundleService();
siteService = ContentServiceFactory.getInstance().getSiteService(); siteService = ContentServiceFactory.getInstance().getSiteService();
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService(); workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
workflowItemService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService(); workflowItemService = WorkflowServiceFactory.getInstance().getWorkflowItemService();
} }
@Override @Override

View File

@@ -32,7 +32,7 @@ import org.dspace.discovery.IndexingService;
import org.dspace.discovery.SearchServiceException; import org.dspace.discovery.SearchServiceException;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.flywaydb.core.Flyway; import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.FlywayException; import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.api.MigrationInfo; import org.flywaydb.core.api.MigrationInfo;
@@ -557,8 +557,8 @@ public class DatabaseUtils {
scriptLocations.add("classpath:org/dspace/storage/rdbms/migration"); scriptLocations.add("classpath:org/dspace/storage/rdbms/migration");
//Add all potential workflow migration paths //Add all potential workflow migration paths
List<String> workflowFlywayMigrationLocations = XmlWorkflowServiceFactory.getInstance() List<String> workflowFlywayMigrationLocations = WorkflowServiceFactory.getInstance()
.getXmlWorkflowService() .getWorkflowService()
.getFlywayMigrationLocations(); .getFlywayMigrationLocations();
scriptLocations.addAll(workflowFlywayMigrationLocations); scriptLocations.addAll(workflowFlywayMigrationLocations);

View File

@@ -22,7 +22,7 @@ import org.dspace.identifier.IdentifierException;
import org.dspace.identifier.service.IdentifierService; import org.dspace.identifier.service.IdentifierService;
import org.dspace.versioning.service.VersionHistoryService; import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService; import org.dspace.versioning.service.VersioningService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.WorkflowItemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
@@ -37,7 +37,7 @@ public class DefaultItemVersionProvider extends AbstractVersionProvider implemen
@Autowired(required = true) @Autowired(required = true)
protected WorkspaceItemService workspaceItemService; protected WorkspaceItemService workspaceItemService;
@Autowired(required = true) @Autowired(required = true)
protected XmlWorkflowItemService workflowItemService; protected WorkflowItemService workflowItemService;
@Autowired(required = true) @Autowired(required = true)
protected VersionHistoryService versionHistoryService; protected VersionHistoryService versionHistoryService;
@Autowired(required = true) @Autowired(required = true)

View File

@@ -21,8 +21,8 @@ import org.dspace.core.Context;
import org.dspace.versioning.dao.VersionDAO; import org.dspace.versioning.dao.VersionDAO;
import org.dspace.versioning.service.VersionHistoryService; import org.dspace.versioning.service.VersionHistoryService;
import org.dspace.versioning.service.VersioningService; import org.dspace.versioning.service.VersioningService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.WorkflowItemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
/** /**
@@ -42,7 +42,7 @@ public class VersioningServiceImpl implements VersioningService {
@Autowired(required = true) @Autowired(required = true)
private WorkspaceItemService workspaceItemService; private WorkspaceItemService workspaceItemService;
@Autowired(required = true) @Autowired(required = true)
protected XmlWorkflowItemService workflowItemService; protected WorkflowItemService workflowItemService;
private DefaultItemVersionProvider provider; private DefaultItemVersionProvider provider;
@@ -139,7 +139,7 @@ public class VersioningServiceImpl implements VersioningService {
if (wsi != null) { if (wsi != null) {
workspaceItemService.deleteAll(c, wsi); workspaceItemService.deleteAll(c, wsi);
} else { } else {
XmlWorkflowItem wfi = workflowItemService.findByItem(c, item); WorkflowItem wfi = workflowItemService.findByItem(c, item);
if (wfi != null) { if (wfi != null) {
workflowItemService.delete(c, wfi); workflowItemService.delete(c, wfi);
} }

View File

@@ -0,0 +1,19 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.workflow;
import org.dspace.content.InProgressSubmission;
/**
* Interface representing a workflowitem, each workflowItem implementation must implement this interface.
*
* @author kevinvandevelde at atmire.com
*/
public interface WorkflowItem extends InProgressSubmission {
}

View File

@@ -0,0 +1,109 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.workflow;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.content.Item;
import org.dspace.content.service.InProgressSubmissionService;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
/**
* Service interface class for the Workflow items.
* All WorkflowItem service classes should implement this class since it offers some basic methods which all
* WorkflowItems
* are required to have.
*
* @author kevinvandevelde at atmire.com
*/
public interface WorkflowItemService<T extends WorkflowItem> extends InProgressSubmissionService<T> {
public T create(Context context, Item item, Collection collection) throws SQLException, AuthorizeException;
/**
* Get a workflow item from the database.
*
* @param context The relevant DSpace Context.
* @param id ID of the workflow item
* @return the workflow item, or null if the ID is invalid.
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public T find(Context context, int id) throws SQLException;
/**
* return all workflowitems
*
* @param context The relevant DSpace Context.
* @return List of all workflowItems in system
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public List<T> findAll(Context context) throws SQLException;
/**
* Get all workflow items for a particular collection.
*
* @param context The relevant DSpace Context.
* @param collection the collection
* @return array of the corresponding workflow items
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public List<T> findByCollection(Context context, Collection collection) throws SQLException;
/**
* Check to see if a particular item is currently under Workflow.
* If so, its WorkflowItem is returned. If not, null is returned
*
* @param context The relevant DSpace Context.
* @param item the item
* @return workflow item corresponding to the item, or null
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public T findByItem(Context context, Item item) throws SQLException;
/**
* Get all workflow items that were original submissions by a particular
* e-person.
*
* @param context The relevant DSpace Context.
* @param ep the eperson
* @return the corresponding workflow items
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public List<T> findBySubmitter(Context context, EPerson ep) throws SQLException;
/**
* Delete all workflow items present in the specified collection.
*
* @param context The relevant DSpace Context.
* @param collection the containing collection
* @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.
*/
public void deleteByCollection(Context context, Collection collection)
throws SQLException, IOException, AuthorizeException;
/**
* Delete the specified workflow item.
*
* @param context The relevant DSpace Context.
* @param workflowItem which workflow item to delete
* @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.
*/
public void delete(Context context, T workflowItem) throws SQLException, AuthorizeException, IOException;
}

View File

@@ -0,0 +1,126 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.workflow;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.content.WorkspaceItem;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.dspace.xmlworkflow.WorkflowConfigurationException;
/**
* Service interface class for the WorkflowService framework.
* All WorkflowServices service classes should implement this class since it offers some basic methods which all
* Workflows
* are required to have.
*
* @param <T> some implementation of workflow item.
* @author kevinvandevelde at atmire.com
*/
public interface WorkflowService<T extends WorkflowItem> {
/**
* startWorkflow() begins a workflow - in a single transaction do away with
* the PersonalWorkspace entry and turn it into a WorkflowItem.
*
* @param context The relevant DSpace Context.
* @param wsi The WorkspaceItem to convert to a workflow item
* @return The resulting workflow item
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
* @throws WorkflowException if workflow error
*/
public T start(Context context, WorkspaceItem wsi)
throws SQLException, AuthorizeException, IOException, WorkflowException;
/**
* startWithoutNotify() starts the workflow normally, but disables
* notifications (useful for large imports,) for the first workflow step -
* subsequent notifications happen normally
*
* @param c The relevant DSpace Context.
* @param wsi workspace item
* @return the resulting workflow item.
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
* @throws WorkflowException if workflow error
*/
public T startWithoutNotify(Context c, WorkspaceItem wsi)
throws SQLException, AuthorizeException, IOException, WorkflowException;
/**
* abort() aborts a workflow, completely deleting it (administrator do this)
* (it will basically do a reject from any state - the item ends up back in
* the user's PersonalWorkspace
*
* @param c The relevant DSpace Context.
* @param wi WorkflowItem to operate on
* @param e EPerson doing the operation
* @return workspace item returned to workspace
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
*/
public WorkspaceItem abort(Context c, T wi, EPerson e) throws SQLException, AuthorizeException, IOException;
/**
* Deletes workflow task item in correct order.
*
* @param c The relevant DSpace Context.
* @param wi The WorkflowItem that shall be deleted.
* @param e Admin that deletes this workflow task and item (for logging
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
*/
public void deleteWorkflowByWorkflowItem(Context c, T wi, EPerson e)
throws SQLException, AuthorizeException, IOException;
public WorkspaceItem sendWorkflowItemBackSubmission(Context c, T workflowItem, EPerson e, String provenance,
String rejection_message)
throws SQLException, AuthorizeException, IOException;
public String getMyDSpaceLink();
public void deleteCollection(Context context, Collection collection)
throws SQLException, IOException, AuthorizeException;
public List<String> getEPersonDeleteConstraints(Context context, EPerson ePerson) throws SQLException;
public Group getWorkflowRoleGroup(Context context, Collection collection, String roleName, Group roleGroup)
throws SQLException, IOException, WorkflowConfigurationException, AuthorizeException, WorkflowException;
/**
* This method will create the workflowRoleGroup for a collection and the given rolename
* @param context The relevant DSpace context
* @param collection The collection
* @param roleName The rolename
* @return The created Group
* @throws AuthorizeException If something goes wrong
* @throws SQLException If something goes wrong
* @throws IOException If something goes wrong
* @throws WorkflowConfigurationException If something goes wrong
*/
public Group createWorkflowRoleGroup(Context context, Collection collection, String roleName)
throws AuthorizeException, SQLException, IOException, WorkflowConfigurationException;
public List<String> getFlywayMigrationLocations();
}

View File

@@ -0,0 +1,30 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.workflow.factory;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.workflow.WorkflowItemService;
import org.dspace.workflow.WorkflowService;
/**
* Abstract factory to get services for the workflow package, use WorkflowServiceFactory.getInstance() to retrieve an
* implementation
*
* @author kevinvandevelde at atmire.com
*/
public abstract class WorkflowServiceFactory {
public abstract WorkflowService getWorkflowService();
public abstract WorkflowItemService getWorkflowItemService();
public static WorkflowServiceFactory getInstance() {
return DSpaceServicesFactory.getInstance().getServiceManager()
.getServiceByName("workflowServiceFactory", WorkflowServiceFactory.class);
}
}

View File

@@ -0,0 +1,41 @@
<!--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
Author: dstuve
Version: $Id$
Date: $Date$
-->
</head>
<body bgcolor="white">
<p>DSpace's workflow system</p>
<p>
DSpace has a simple workflow system, which models the workflows
as 5 steps: SUBMIT, three intermediate steps (STEP1, STEP2, STEP3), and ARCHIVE.
When an item is submitted to DSpace, it is in the SUBMIT state. If there
are no intermediate states defined, then it proceeds directly to ARCHIVE and
is put into the main DSpace archive.
</p>
<p>
EPerson groups may be assigned to the three possible intermediate steps,
where they are expected to act on the item at those steps. For example,
if a Collection's owners desire a review step, they would create a Group
of reviewers, and assign that Group to step 1. The members of step 1's
Group will receive emails asking them to review the submission, and
will need to perform an action on the item before it can be rejected
back to the submitter or placed in the archive.
</p>
</body>
</html>

View File

@@ -8,6 +8,7 @@
package org.dspace.xmlworkflow.factory; package org.dspace.xmlworkflow.factory;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.dspace.xmlworkflow.service.WorkflowRequirementsService; import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.xmlworkflow.service.XmlWorkflowService;
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService; import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
@@ -23,7 +24,7 @@ import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
* *
* @author kevinvandevelde at atmire.com * @author kevinvandevelde at atmire.com
*/ */
public abstract class XmlWorkflowServiceFactory { public abstract class XmlWorkflowServiceFactory extends WorkflowServiceFactory {
public abstract XmlWorkflowFactory getWorkflowFactory(); public abstract XmlWorkflowFactory getWorkflowFactory();

View File

@@ -7,6 +7,8 @@
*/ */
package org.dspace.xmlworkflow.factory; package org.dspace.xmlworkflow.factory;
import org.dspace.workflow.WorkflowItemService;
import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.service.WorkflowRequirementsService; import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.xmlworkflow.service.XmlWorkflowService;
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService; import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
@@ -88,4 +90,14 @@ public class XmlWorkflowServiceFactoryImpl extends XmlWorkflowServiceFactory {
public XmlWorkflowItemService getXmlWorkflowItemService() { public XmlWorkflowItemService getXmlWorkflowItemService() {
return xmlWorkflowItemService; return xmlWorkflowItemService;
} }
@Override
public WorkflowService getWorkflowService() {
return getXmlWorkflowService();
}
@Override
public WorkflowItemService getWorkflowItemService() {
return getXmlWorkflowItemService();
}
} }

View File

@@ -23,9 +23,9 @@ import org.dspace.core.LogManager;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.factory.EPersonServiceFactory; import org.dspace.eperson.factory.EPersonServiceFactory;
import org.dspace.eperson.service.EPersonService; import org.dspace.eperson.service.EPersonService;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.factory.WorkflowServiceFactory;
/** /**
* A utility class that will send all the worklfow items * A utility class that will send all the worklfow items
@@ -114,11 +114,11 @@ public class RestartWorkflow {
System.out.println("Sending all workflow items back to the workspace"); System.out.println("Sending all workflow items back to the workspace");
XmlWorkflowServiceFactory workflowServiceFactory = XmlWorkflowServiceFactory.getInstance(); WorkflowServiceFactory workflowServiceFactory = WorkflowServiceFactory.getInstance();
List<XmlWorkflowItem> workflowItems = workflowServiceFactory.getXmlWorkflowItemService().findAll(context); List<WorkflowItem> workflowItems = workflowServiceFactory.getWorkflowItemService().findAll(context);
XmlWorkflowService workflowService = workflowServiceFactory.getXmlWorkflowService(); WorkflowService workflowService = workflowServiceFactory.getWorkflowService();
int i = 0; int i = 0;
for (XmlWorkflowItem workflowItem : workflowItems) { for (WorkflowItem workflowItem : workflowItems) {
System.out.println("Processing workflow item " + i + " of " + workflowItems.size()); System.out.println("Processing workflow item " + i + " of " + workflowItems.size());
System.out.println("Removing pooled tasks"); System.out.println("Removing pooled tasks");

View File

@@ -14,15 +14,12 @@ import javax.mail.MessagingException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.RoleMembers; import org.dspace.xmlworkflow.RoleMembers;
import org.dspace.xmlworkflow.WorkflowConfigurationException;
import org.dspace.xmlworkflow.state.Step; import org.dspace.xmlworkflow.state.Step;
import org.dspace.xmlworkflow.state.Workflow; import org.dspace.xmlworkflow.state.Workflow;
import org.dspace.xmlworkflow.state.actions.ActionResult; import org.dspace.xmlworkflow.state.actions.ActionResult;
@@ -33,7 +30,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
/** /**
* When an item is submitted and is somewhere in a workflow, it has a row in the * When an item is submitted and is somewhere in a workflow, it has a row in the
* cwf_workflowitem table pointing to it. * WorkflowItem table pointing to it.
* *
* Once the item has completed the workflow it will be archived * Once the item has completed the workflow it will be archived
* *
@@ -42,101 +39,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
* @author Ben Bosman (ben at atmire dot com) * @author Ben Bosman (ben at atmire dot com)
* @author Mark Diggory (markd at atmire dot com) * @author Mark Diggory (markd at atmire dot com)
*/ */
public interface XmlWorkflowService { public interface XmlWorkflowService extends WorkflowService<XmlWorkflowItem> {
/**
* startWorkflow() begins a workflow - in a single transaction do away with
* the PersonalWorkspace entry and turn it into a WorkflowItem.
*
* @param context The relevant DSpace Context.
* @param wsi The WorkspaceItem to convert to a workflow item
* @return The resulting workflow item
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
* @throws WorkflowException if workflow error
*/
public XmlWorkflowItem start(Context context, WorkspaceItem wsi)
throws SQLException, AuthorizeException, IOException, WorkflowException;
/**
* startWithoutNotify() starts the workflow normally, but disables
* notifications (useful for large imports,) for the first workflow step -
* subsequent notifications happen normally
*
* @param c The relevant DSpace Context.
* @param wsi workspace item
* @return the resulting workflow item.
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
* @throws WorkflowException if workflow error
*/
public XmlWorkflowItem startWithoutNotify(Context c, WorkspaceItem wsi)
throws SQLException, AuthorizeException, IOException, WorkflowException;
/**
* abort() aborts a workflow, completely deleting it (administrator do this)
* (it will basically do a reject from any state - the item ends up back in
* the user's PersonalWorkspace
*
* @param c The relevant DSpace Context.
* @param wi WorkflowItem to operate on
* @param e EPerson doing the operation
* @return workspace item returned to workspace
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
*/
public WorkspaceItem abort(Context c, XmlWorkflowItem wi, EPerson e)
throws SQLException, AuthorizeException, IOException;
/**
* Deletes workflow task item in correct order.
*
* @param c The relevant DSpace Context.
* @param wi The WorkflowItem that shall be deleted.
* @param e Admin that deletes this workflow task and item (for logging
* @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.
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
*/
public void deleteWorkflowByWorkflowItem(Context c, XmlWorkflowItem wi, EPerson e)
throws SQLException, AuthorizeException, IOException;
public WorkspaceItem sendWorkflowItemBackSubmission(Context c, XmlWorkflowItem workflowItem, EPerson e,
String provenance,
String rejection_message)
throws SQLException, AuthorizeException, IOException;
public String getMyDSpaceLink();
public void deleteCollection(Context context, Collection collection)
throws SQLException, IOException, AuthorizeException;
public List<String> getEPersonDeleteConstraints(Context context, EPerson ePerson) throws SQLException;
public Group getWorkflowRoleGroup(Context context, Collection collection, String roleName, Group roleGroup)
throws SQLException, IOException, WorkflowConfigurationException, AuthorizeException, WorkflowException;
/**
* This method will create the workflowRoleGroup for a collection and the given rolename
* @param context The relevant DSpace context
* @param collection The collection
* @param roleName The rolename
* @return The created Group
* @throws AuthorizeException If something goes wrong
* @throws SQLException If something goes wrong
* @throws IOException If something goes wrong
* @throws WorkflowConfigurationException If something goes wrong
*/
public Group createWorkflowRoleGroup(Context context, Collection collection, String roleName)
throws AuthorizeException, SQLException, IOException, WorkflowConfigurationException;
public List<String> getFlywayMigrationLocations();
public void alertUsersOnTaskActivation(Context c, XmlWorkflowItem wfi, String emailTemplate, List<EPerson> epa, public void alertUsersOnTaskActivation(Context c, XmlWorkflowItem wfi, String emailTemplate, List<EPerson> epa,
String... arguments) throws IOException, SQLException, MessagingException; String... arguments) throws IOException, SQLException, MessagingException;

View File

@@ -20,10 +20,10 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table; import javax.persistence.Table;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.InProgressSubmission;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
/** /**
@@ -36,7 +36,7 @@ import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
*/ */
@Entity @Entity
@Table(name = "cwf_workflowitem") @Table(name = "cwf_workflowitem")
public class XmlWorkflowItem implements InProgressSubmission { public class XmlWorkflowItem implements WorkflowItem {
@Id @Id
@Column(name = "workflowitem_id") @Column(name = "workflowitem_id")

View File

@@ -7,16 +7,13 @@
*/ */
package org.dspace.xmlworkflow.storedcomponents.service; package org.dspace.xmlworkflow.storedcomponents.service;
import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.List;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Item;
import org.dspace.content.service.InProgressSubmissionService;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.workflow.WorkflowItemService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
/** /**
@@ -26,87 +23,7 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
* *
* @author kevinvandevelde at atmire.com * @author kevinvandevelde at atmire.com
*/ */
public interface XmlWorkflowItemService extends InProgressSubmissionService<XmlWorkflowItem> { public interface XmlWorkflowItemService extends WorkflowItemService<XmlWorkflowItem> {
public XmlWorkflowItem create(Context context, Item item, Collection collection) throws SQLException,
AuthorizeException;
/**
* Get a workflow item from the database.
*
* @param context The relevant DSpace Context.
* @param id ID of the workflow item
* @return the workflow item, or null if the ID is invalid.
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public XmlWorkflowItem find(Context context, int id) throws SQLException;
/**
* return all workflowitems
*
* @param context The relevant DSpace Context.
* @return List of all workflowItems in system
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public List<XmlWorkflowItem> findAll(Context context) throws SQLException;
/**
* Get all workflow items for a particular collection.
*
* @param context The relevant DSpace Context.
* @param collection the collection
* @return array of the corresponding workflow items
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public List<XmlWorkflowItem> findByCollection(Context context, Collection collection) throws SQLException;
/**
* Check to see if a particular item is currently under Workflow.
* If so, its WorkflowItem is returned. If not, null is returned
*
* @param context The relevant DSpace Context.
* @param item the item
* @return workflow item corresponding to the item, or null
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public XmlWorkflowItem findByItem(Context context, Item item) throws SQLException;
/**
* Get all workflow items that were original submissions by a particular
* e-person.
*
* @param context The relevant DSpace Context.
* @param ep the eperson
* @return the corresponding workflow items
* @throws SQLException An exception that provides information on a database access error or other errors.
*/
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException;
/**
* Delete all workflow items present in the specified collection.
*
* @param context The relevant DSpace Context.
* @param collection the containing collection
* @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.
*/
public void deleteByCollection(Context context, Collection collection)
throws SQLException, IOException, AuthorizeException;
/**
* Delete the specified workflow item.
*
* @param context The relevant DSpace Context.
* @param workflowItem which workflow item to delete
* @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.
*/
public void delete(Context context, XmlWorkflowItem workflowItem)
throws SQLException, AuthorizeException, IOException;
/** /**
* return all workflowitems for a certain page * return all workflowitems for a certain page

View File

@@ -38,10 +38,10 @@ import org.dspace.eperson.factory.EPersonServiceFactory;
import org.dspace.eperson.service.EPersonService; import org.dspace.eperson.service.EPersonService;
import org.dspace.eperson.service.GroupService; import org.dspace.eperson.service.GroupService;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowItemService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -50,24 +50,16 @@ import org.junit.Test;
*/ */
public class EPersonTest extends AbstractUnitTest { public class EPersonTest extends AbstractUnitTest {
protected EPersonService ePersonService protected EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
= EPersonServiceFactory.getInstance().getEPersonService(); protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
protected GroupService groupService protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
= EPersonServiceFactory.getInstance().getGroupService(); protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
protected CommunityService communityService protected ItemService itemService = ContentServiceFactory.getInstance().getItemService();
= ContentServiceFactory.getInstance().getCommunityService(); protected InstallItemService installItemService = ContentServiceFactory.getInstance().getInstallItemService();
protected CollectionService collectionService protected WorkflowItemService workflowItemService = WorkflowServiceFactory.getInstance().getWorkflowItemService();
= ContentServiceFactory.getInstance().getCollectionService(); protected WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
protected ItemService itemService protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance()
= ContentServiceFactory.getInstance().getItemService(); .getWorkspaceItemService();
protected InstallItemService installItemService
= ContentServiceFactory.getInstance().getInstallItemService();
protected XmlWorkflowItemService workflowItemService
= XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService();
protected XmlWorkflowService workflowService
= XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
protected WorkspaceItemService workspaceItemService
= ContentServiceFactory.getInstance().getWorkspaceItemService();
private Community community = null; private Community community = null;
private Collection collection = null; private Collection collection = null;
@@ -1034,7 +1026,7 @@ public class EPersonTest extends AbstractUnitTest {
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
// check whether the workflow item still exists. // check whether the workflow item still exists.
XmlWorkflowItem wfi = workflowItemService.find(context, wfiID); WorkflowItem wfi = workflowItemService.find(context, wfiID);
assertNotNull("Could not load WorkflowItem after cascading deletion of the submitter.", wfi); assertNotNull("Could not load WorkflowItem after cascading deletion of the submitter.", wfi);
assertNull("Cascading deletion of an EPerson did not set the submitter of an submitted WorkflowItem null.", assertNull("Cascading deletion of an EPerson did not set the submitter of an submitted WorkflowItem null.",
wfi.getSubmitter()); wfi.getSubmitter());

View File

@@ -45,8 +45,8 @@ import org.dspace.identifier.service.DOIService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -166,7 +166,7 @@ public class DOIIdentifierProviderTest
WorkspaceItem wsItem = workspaceItemService.create(context, collection, false); WorkspaceItem wsItem = workspaceItemService.create(context, collection, false);
XmlWorkflowItem wfItem = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService().start(context, wsItem); WorkflowItem wfItem = WorkflowServiceFactory.getInstance().getWorkflowService().start(context, wsItem);
Item item = wfItem.getItem(); Item item = wfItem.getItem();
itemService.addMetadata(context, item, "dc", "contributor", "author", null, "Author, A. N."); itemService.addMetadata(context, item, "dc", "contributor", "author", null, "Author, A. N.");

View File

@@ -39,8 +39,8 @@ import org.dspace.identifier.ezid.Transform;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
@@ -124,7 +124,7 @@ public class EZIDIdentifierProviderTest
WorkspaceItem wsItem = workspaceItemService.create(context, collection, false); WorkspaceItem wsItem = workspaceItemService.create(context, collection, false);
XmlWorkflowItem wfItem = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService().start(context, wsItem); WorkflowItem wfItem = WorkflowServiceFactory.getInstance().getWorkflowService().start(context, wsItem);
item = wfItem.getItem(); item = wfItem.getItem();

View File

@@ -24,14 +24,13 @@ import org.dspace.content.service.CollectionService;
import org.dspace.content.service.CommunityService; import org.dspace.content.service.CommunityService;
import org.dspace.utils.DSpace; import org.dspace.utils.DSpace;
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory; import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactoryImpl;
import org.dspace.xmlworkflow.state.Workflow; import org.dspace.xmlworkflow.state.Workflow;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/** /**
* Tests that check that the spring bean {@link XmlWorkflowServiceFactoryImpl} * Tests that check that the spring bean {@link org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactoryImpl}
* in workflow.xml gets created correctly * in workflow.xml gets created correctly
* *
* @author Maria Verdonck (Atmire) on 19/12/2019 * @author Maria Verdonck (Atmire) on 19/12/2019

View File

@@ -51,8 +51,8 @@ import org.dspace.rest.common.Item;
import org.dspace.rest.common.MetadataEntry; import org.dspace.rest.common.MetadataEntry;
import org.dspace.rest.exceptions.ContextException; import org.dspace.rest.exceptions.ContextException;
import org.dspace.usage.UsageEvent; import org.dspace.usage.UsageEvent;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.factory.WorkflowServiceFactory;
/** /**
* This class provides all CRUD operation over collections. * This class provides all CRUD operation over collections.
@@ -65,7 +65,7 @@ public class CollectionsResource extends Resource {
protected ItemService itemService = ContentServiceFactory.getInstance().getItemService(); protected ItemService itemService = ContentServiceFactory.getInstance().getItemService();
protected AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService(); protected AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService(); protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
protected XmlWorkflowService workflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService(); protected WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(CollectionsResource.class); private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(CollectionsResource.class);

View File

@@ -31,8 +31,8 @@ import org.dspace.content.service.CollectionService;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.WorkflowUtils; import org.dspace.xmlworkflow.WorkflowUtils;
import org.dspace.xmlworkflow.service.XmlWorkflowService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.ControllerUtils; import org.springframework.data.rest.webmvc.ControllerUtils;
import org.springframework.data.rest.webmvc.ResourceNotFoundException; import org.springframework.data.rest.webmvc.ResourceNotFoundException;
@@ -69,7 +69,7 @@ public class CollectionGroupRestController {
private AuthorizeService authorizeService; private AuthorizeService authorizeService;
@Autowired @Autowired
private XmlWorkflowService workflowService; private WorkflowService workflowService;
/** /**
* This method creates and returns an AdminGroup object for the given collection * This method creates and returns an AdminGroup object for the given collection

View File

@@ -57,9 +57,9 @@ import org.dspace.discovery.indexobject.IndexableCollection;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.eperson.service.GroupService; import org.dspace.eperson.service.GroupService;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.WorkflowConfigurationException; import org.dspace.xmlworkflow.WorkflowConfigurationException;
import org.dspace.xmlworkflow.WorkflowUtils; import org.dspace.xmlworkflow.WorkflowUtils;
import org.dspace.xmlworkflow.service.XmlWorkflowService;
import org.dspace.xmlworkflow.storedcomponents.CollectionRole; import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService; import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService; import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
@@ -104,7 +104,7 @@ public class CollectionRestRepository extends DSpaceObjectRestRepository<Collect
private AuthorizeService authorizeService; private AuthorizeService authorizeService;
@Autowired @Autowired
private XmlWorkflowService workflowService; private WorkflowService workflowService;
@Autowired @Autowired
private PoolTaskService poolTaskService; private PoolTaskService poolTaskService;

View File

@@ -45,9 +45,9 @@ import org.dspace.eperson.EPerson;
import org.dspace.eperson.EPersonServiceImpl; import org.dspace.eperson.EPersonServiceImpl;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.WorkflowConfigurationException; import org.dspace.xmlworkflow.WorkflowConfigurationException;
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory; import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
import org.dspace.xmlworkflow.service.XmlWorkflowService;
import org.dspace.xmlworkflow.state.Step; import org.dspace.xmlworkflow.state.Step;
import org.dspace.xmlworkflow.state.Workflow; import org.dspace.xmlworkflow.state.Workflow;
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig; import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
@@ -99,7 +99,7 @@ public class WorkflowItemRestRepository extends DSpaceRestRepository<WorkflowIte
EPersonServiceImpl epersonService; EPersonServiceImpl epersonService;
@Autowired @Autowired
XmlWorkflowService wfs; WorkflowService<XmlWorkflowItem> wfs;
@Autowired @Autowired
AuthorizeService authorizeService; AuthorizeService authorizeService;

View File

@@ -47,14 +47,14 @@ public class WorkflowItemStepLinkRepository extends AbstractDSpaceRestRepository
private XmlWorkflowFactory xmlWorkflowFactory; private XmlWorkflowFactory xmlWorkflowFactory;
/** /**
* This method will retrieve the {@link WorkflowStepRest} object for the {@link XmlWorkflowItem} * This method will retrieve the {@link WorkflowStepRest} object for the {@link org.dspace.workflow.WorkflowItem}
* with the given id * with the given id
* @param request The current request * @param request The current request
* @param workflowItemId The id for the WorkflowItem to be used * @param workflowItemId The id for the WorkflowItem to be used
* @param optionalPageable The pageable if relevant * @param optionalPageable The pageable if relevant
* @param projection The Projection * @param projection The Projection
* @return The {@link WorkflowStepRest} object related to the * @return The {@link WorkflowStepRest} object related to the
* {@link XmlWorkflowItem} specified by the given ID * {@link org.dspace.workflow.WorkflowItem} specified by the given ID
*/ */
public WorkflowStepRest getStep(@Nullable HttpServletRequest request, public WorkflowStepRest getStep(@Nullable HttpServletRequest request,
Integer workflowItemId, Integer workflowItemId,

View File

@@ -49,9 +49,9 @@ import org.dspace.services.ConfigurationService;
import org.dspace.services.RequestService; import org.dspace.services.RequestService;
import org.dspace.services.model.Request; import org.dspace.services.model.Request;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowItemService;
import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.init.UncategorizedScriptException; import org.springframework.jdbc.datasource.init.UncategorizedScriptException;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -75,9 +75,9 @@ public class SubmissionService {
@Autowired @Autowired
protected WorkspaceItemService workspaceItemService; protected WorkspaceItemService workspaceItemService;
@Autowired @Autowired
protected XmlWorkflowItemService workflowItemService; protected WorkflowItemService<XmlWorkflowItem> workflowItemService;
@Autowired @Autowired
protected XmlWorkflowService workflowService; protected WorkflowService<XmlWorkflowItem> workflowService;
@Autowired @Autowired
protected CreativeCommonsService creativeCommonsService; protected CreativeCommonsService creativeCommonsService;
@Autowired @Autowired

View File

@@ -33,7 +33,7 @@ import org.dspace.content.service.CollectionService;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.eperson.service.GroupService; import org.dspace.eperson.service.GroupService;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowService;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -51,7 +51,7 @@ public class CollectionGroupRestControllerIT extends AbstractControllerIntegrati
private AuthorizeService authorizeService; private AuthorizeService authorizeService;
@Autowired @Autowired
private XmlWorkflowService workflowService; private WorkflowService workflowService;
Collection collection; Collection collection;

View File

@@ -75,7 +75,7 @@ import org.dspace.eperson.service.AccountService;
import org.dspace.eperson.service.EPersonService; import org.dspace.eperson.service.EPersonService;
import org.dspace.eperson.service.RegistrationDataService; import org.dspace.eperson.service.RegistrationDataService;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowService;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -93,7 +93,7 @@ public class EPersonRestRepositoryIT extends AbstractControllerIntegrationTest {
private EPersonService ePersonService; private EPersonService ePersonService;
@Autowired @Autowired
private XmlWorkflowService workflowService; private WorkflowService workflowService;
@Autowired @Autowired
private RegistrationDataDAO registrationDataDAO; private RegistrationDataDAO registrationDataDAO;

View File

@@ -995,7 +995,7 @@ public class StatisticsRestRepositoryIT extends AbstractControllerIntegrationTes
// ** THEN ** // ** THEN **
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.usagereports", not(empty()))) .andExpect(jsonPath("$._embedded.usagereports", not(empty())))
.andExpect(jsonPath("$._embedded.usagereports", Matchers.hasItems( .andExpect(jsonPath("$._embedded.usagereports", Matchers.containsInAnyOrder(
UsageReportMatcher UsageReportMatcher
.matchUsageReport(collectionNotVisited.getID() + "_" + TOTAL_VISITS_REPORT_ID, .matchUsageReport(collectionNotVisited.getID() + "_" + TOTAL_VISITS_REPORT_ID,
TOTAL_VISITS_REPORT_ID, TOTAL_VISITS_REPORT_ID,
@@ -1007,8 +1007,7 @@ public class StatisticsRestRepositoryIT extends AbstractControllerIntegrationTes
UsageReportMatcher.matchUsageReport(collectionNotVisited.getID() + "_" + TOP_CITIES_REPORT_ID, UsageReportMatcher.matchUsageReport(collectionNotVisited.getID() + "_" + TOP_CITIES_REPORT_ID,
TOP_CITIES_REPORT_ID, new ArrayList<>()), TOP_CITIES_REPORT_ID, new ArrayList<>()),
UsageReportMatcher.matchUsageReport(collectionNotVisited.getID() + "_" + TOP_COUNTRIES_REPORT_ID, UsageReportMatcher.matchUsageReport(collectionNotVisited.getID() + "_" + TOP_COUNTRIES_REPORT_ID,
TOP_COUNTRIES_REPORT_ID, new ArrayList<>()) TOP_COUNTRIES_REPORT_ID, new ArrayList<>()))));
)));
} }
@Test @Test

View File

@@ -7,7 +7,6 @@
*/ */
package org.dspace.app.rest.authorization; package org.dspace.app.rest.authorization;
import static org.dspace.builder.WorkflowItemBuilder.createWorkflowItem;
import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -24,13 +23,14 @@ import org.dspace.app.rest.utils.Utils;
import org.dspace.builder.CollectionBuilder; import org.dspace.builder.CollectionBuilder;
import org.dspace.builder.CommunityBuilder; import org.dspace.builder.CommunityBuilder;
import org.dspace.builder.ItemBuilder; import org.dspace.builder.ItemBuilder;
import org.dspace.builder.WorkflowItemBuilder;
import org.dspace.builder.WorkspaceItemBuilder; import org.dspace.builder.WorkspaceItemBuilder;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem; import org.dspace.content.WorkspaceItem;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItem;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -239,7 +239,7 @@ public class ReinstateFeatureRestIT extends AbstractControllerIntegrationTest {
Item archivedItem = ItemBuilder.createItem(context, col).withTitle("Item already in archive").build(); Item archivedItem = ItemBuilder.createItem(context, col).withTitle("Item already in archive").build();
WorkspaceItem wsItem = WorkspaceItemBuilder.createWorkspaceItem(context, col).withTitle("A workspace item") WorkspaceItem wsItem = WorkspaceItemBuilder.createWorkspaceItem(context, col).withTitle("A workspace item")
.build(); .build();
XmlWorkflowItem wfItem = createWorkflowItem(context, col).withTitle("A workflow item").build(); WorkflowItem wfItem = WorkflowItemBuilder.createWorkflowItem(context, col).withTitle("A workflow item").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
ItemRest archivedItemRest = itemConverter.convert(archivedItem, Projection.DEFAULT); ItemRest archivedItemRest = itemConverter.convert(archivedItem, Projection.DEFAULT);

View File

@@ -7,7 +7,6 @@
*/ */
package org.dspace.app.rest.authorization; package org.dspace.app.rest.authorization;
import static org.dspace.builder.WorkflowItemBuilder.createWorkflowItem;
import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -24,13 +23,14 @@ import org.dspace.app.rest.utils.Utils;
import org.dspace.builder.CollectionBuilder; import org.dspace.builder.CollectionBuilder;
import org.dspace.builder.CommunityBuilder; import org.dspace.builder.CommunityBuilder;
import org.dspace.builder.ItemBuilder; import org.dspace.builder.ItemBuilder;
import org.dspace.builder.WorkflowItemBuilder;
import org.dspace.builder.WorkspaceItemBuilder; import org.dspace.builder.WorkspaceItemBuilder;
import org.dspace.content.Collection; import org.dspace.content.Collection;
import org.dspace.content.Community; import org.dspace.content.Community;
import org.dspace.content.Item; import org.dspace.content.Item;
import org.dspace.content.WorkspaceItem; import org.dspace.content.WorkspaceItem;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItem;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -240,7 +240,7 @@ public class WithdrawFeatureRestIT extends AbstractControllerIntegrationTest {
.build(); .build();
WorkspaceItem wsItem = WorkspaceItemBuilder.createWorkspaceItem(context, col).withTitle("A workspace item") WorkspaceItem wsItem = WorkspaceItemBuilder.createWorkspaceItem(context, col).withTitle("A workspace item")
.build(); .build();
XmlWorkflowItem wfItem = createWorkflowItem(context, col).withTitle("A workflow item").build(); WorkflowItem wfItem = WorkflowItemBuilder.createWorkflowItem(context, col).withTitle("A workflow item").build();
context.restoreAuthSystemState(); context.restoreAuthSystemState();
ItemRest withdrawnItemRest = itemConverter.convert(withdrawnItem, Projection.DEFAULT); ItemRest withdrawnItemRest = itemConverter.convert(withdrawnItem, Projection.DEFAULT);

View File

@@ -24,9 +24,9 @@ import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.WorkspaceItemService; import org.dspace.content.service.WorkspaceItemService;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.eperson.EPerson; import org.dspace.eperson.EPerson;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItemService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.swordapp.server.AuthCredentials; import org.swordapp.server.AuthCredentials;
import org.swordapp.server.CollectionListManager; import org.swordapp.server.CollectionListManager;
import org.swordapp.server.SwordAuthException; import org.swordapp.server.SwordAuthException;
@@ -39,8 +39,8 @@ public class CollectionListManagerDSpace extends DSpaceSwordAPI
protected WorkspaceItemService workspaceItemService = ContentServiceFactory protected WorkspaceItemService workspaceItemService = ContentServiceFactory
.getInstance().getWorkspaceItemService(); .getInstance().getWorkspaceItemService();
protected XmlWorkflowItemService workflowItemService = XmlWorkflowServiceFactory protected WorkflowItemService workflowItemService = WorkflowServiceFactory
.getInstance().getXmlWorkflowItemService(); .getInstance().getWorkflowItemService();
@Override @Override
public Feed listCollectionContents(IRI colIRI, public Feed listCollectionContents(IRI colIRI,
@@ -144,8 +144,8 @@ public class CollectionListManagerDSpace extends DSpaceSwordAPI
List wfis = workflowItemService.findBySubmitter(sc.getContext(), List wfis = workflowItemService.findBySubmitter(sc.getContext(),
person); person);
for (Object found : wfis) { for (Object found : wfis) {
if (found instanceof XmlWorkflowItem) { if (found instanceof WorkflowItem) {
XmlWorkflowItem wfi = (XmlWorkflowItem) found; WorkflowItem wfi = (WorkflowItem) found;
Item item = wfi.getItem(); Item item = wfi.getItem();
// check for the wfi collection // check for the wfi collection

View File

@@ -25,9 +25,9 @@ import org.dspace.content.service.WorkspaceItemService;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.core.Context; import org.dspace.core.Context;
import org.dspace.core.LogManager; import org.dspace.core.LogManager;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowItemService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.swordapp.server.AuthCredentials; import org.swordapp.server.AuthCredentials;
import org.swordapp.server.ContainerManager; import org.swordapp.server.ContainerManager;
import org.swordapp.server.Deposit; import org.swordapp.server.Deposit;
@@ -44,8 +44,8 @@ public class ContainerManagerDSpace extends DSpaceSwordAPI
protected AuthorizeService authorizeService = protected AuthorizeService authorizeService =
AuthorizeServiceFactory.getInstance().getAuthorizeService(); AuthorizeServiceFactory.getInstance().getAuthorizeService();
protected XmlWorkflowItemService workflowItemService = protected WorkflowItemService workflowItemService =
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService(); WorkflowServiceFactory.getInstance().getWorkflowItemService();
protected WorkspaceItemService workspaceItemService = protected WorkspaceItemService workspaceItemService =
ContentServiceFactory.getInstance().getWorkspaceItemService(); ContentServiceFactory.getInstance().getWorkspaceItemService();
@@ -757,7 +757,7 @@ public class ContainerManagerDSpace extends DSpaceSwordAPI
WorkspaceItem wsi = wft.getWorkspaceItem(context, item); WorkspaceItem wsi = wft.getWorkspaceItem(context, item);
workspaceItemService.deleteAll(context, wsi); workspaceItemService.deleteAll(context, wsi);
} else if (wft.isItemInWorkflow(context, item)) { } else if (wft.isItemInWorkflow(context, item)) {
XmlWorkflowItem wfi = wft.getWorkflowItem(context, item); WorkflowItem wfi = wft.getWorkflowItem(context, item);
workflowItemService.deleteWrapper(context, wfi); workflowItemService.deleteWrapper(context, wfi);
} }

View File

@@ -19,20 +19,20 @@ import org.dspace.core.Context;
import org.dspace.services.ConfigurationService; import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.workflow.WorkflowException; import org.dspace.workflow.WorkflowException;
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory; import org.dspace.workflow.WorkflowItem;
import org.dspace.xmlworkflow.service.XmlWorkflowService; import org.dspace.workflow.WorkflowItemService;
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem; import org.dspace.workflow.WorkflowService;
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService; import org.dspace.workflow.factory.WorkflowServiceFactory;
public class WorkflowTools { public class WorkflowTools {
protected WorkspaceItemService workspaceItemService = protected WorkspaceItemService workspaceItemService =
ContentServiceFactory.getInstance().getWorkspaceItemService(); ContentServiceFactory.getInstance().getWorkspaceItemService();
protected XmlWorkflowItemService workflowItemService = protected WorkflowItemService workflowItemService =
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService(); WorkflowServiceFactory.getInstance().getWorkflowItemService();
protected XmlWorkflowService workflowService = protected WorkflowService workflowService =
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService(); WorkflowServiceFactory.getInstance().getWorkflowService();
protected ConfigurationService configurationService protected ConfigurationService configurationService
= DSpaceServicesFactory.getInstance().getConfigurationService(); = DSpaceServicesFactory.getInstance().getConfigurationService();
@@ -88,7 +88,7 @@ public class WorkflowTools {
* @return workflow item * @return workflow item
* @throws DSpaceSwordException can be thrown by the internals of the DSpace SWORD implementation * @throws DSpaceSwordException can be thrown by the internals of the DSpace SWORD implementation
*/ */
public XmlWorkflowItem getWorkflowItem(Context context, Item item) public WorkflowItem getWorkflowItem(Context context, Item item)
throws DSpaceSwordException { throws DSpaceSwordException {
try { try {
return workflowItemService.findByItem(context, item); return workflowItemService.findByItem(context, item);
@@ -154,7 +154,7 @@ public class WorkflowTools {
throws DSpaceSwordException { throws DSpaceSwordException {
try { try {
// find the item in the workflow if it exists // find the item in the workflow if it exists
XmlWorkflowItem wfi = this.getWorkflowItem(context, item); WorkflowItem wfi = this.getWorkflowItem(context, item);
// abort the workflow // abort the workflow
if (wfi != null) { if (wfi != null) {