DS-2713: Cleanup. Remove unnecessary "workflow.framework" config. Comment cleanup. Make easier to enable in Spring configs

This commit is contained in:
Tim Donohue
2016-07-21 09:38:51 -05:00
parent 977b49907a
commit 855cbbcac3
12 changed files with 55 additions and 41 deletions

View File

@@ -15,6 +15,8 @@ import org.dspace.administer.RegistryLoader;
import org.dspace.core.Context; 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.factory.WorkflowServiceFactory;
import org.dspace.xmlworkflow.service.XmlWorkflowService;
import org.flywaydb.core.api.MigrationInfo; import org.flywaydb.core.api.MigrationInfo;
import org.flywaydb.core.api.callback.FlywayCallback; import org.flywaydb.core.api.callback.FlywayCallback;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -74,8 +76,7 @@ public class DatabaseRegistryUpdater implements FlywayCallback
MetadataImporter.loadRegistry(base + "sword-metadata.xml", true); MetadataImporter.loadRegistry(base + "sword-metadata.xml", true);
// Check if XML Workflow is enabled in workflow.cfg // Check if XML Workflow is enabled in workflow.cfg
String framework = config.getProperty("workflow.framework"); if (WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService)
if (framework!=null && framework.equals("xmlworkflow"))
{ {
// If so, load in the workflow metadata types as well // If so, load in the workflow metadata types as well
MetadataImporter.loadRegistry(base + "workflow-types.xml", true); MetadataImporter.loadRegistry(base + "workflow-types.xml", true);

View File

@@ -7,7 +7,6 @@
*/ */
package org.dspace.storage.rdbms.xmlworkflow; package org.dspace.storage.rdbms.xmlworkflow;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants; import org.dspace.core.Constants;
import org.dspace.storage.rdbms.DatabaseUtils; import org.dspace.storage.rdbms.DatabaseUtils;
import org.dspace.workflow.factory.WorkflowServiceFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
@@ -19,6 +18,18 @@ import org.flywaydb.core.internal.util.scanner.classpath.ClassPathResource;
import java.sql.Connection; import java.sql.Connection;
/** /**
* This class automatically migrates your DSpace Database to use the
* XML-based Configurable Workflow system whenever it is enabled.
* <P>
* Because XML-based Configurable Workflow existed prior to our migration, this
* class first checks for the existence of the "cwf_workflowitem" table before
* running any migrations.
* <P>
* This class represents a Flyway DB Java Migration
* http://flywaydb.org/documentation/migration/java.html
* <P>
* It can upgrade a 6.0 version of DSpace to use the XMLWorkflow.
*
* User: kevin (kevin at atmire.com) * User: kevin (kevin at atmire.com)
* Date: 1/09/15 * Date: 1/09/15
* Time: 11:34 * Time: 11:34

View File

@@ -17,7 +17,7 @@
-- --
-- This script is called automatically by the following -- This script is called automatically by the following
-- Flyway Java migration class: -- Flyway Java migration class:
-- org.dspace.storage.rdbms.migration.V5_0_2014_01_01__XMLWorkflow_Migration -- org.dspace.storage.rdbms.xmlworkflow.V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration
---------------------------------------------------- ----------------------------------------------------
-- Convert workflow groups: -- Convert workflow groups:

View File

@@ -7,7 +7,7 @@
-- --
---------------------------------------------------- ----------------------------------------------------
-- Database Schema Update for XML/Configurable Workflow -- Database Schema Update for XML/Configurable Workflow (for DSpace 6.0)
-- --
-- This file will automatically create/update your -- This file will automatically create/update your
-- DSpace Database tables to support XML/Configurable workflows. -- DSpace Database tables to support XML/Configurable workflows.
@@ -17,7 +17,7 @@
-- --
-- This script is called automatically by the following -- This script is called automatically by the following
-- Flyway Java migration class: -- Flyway Java migration class:
-- org.dspace.storage.rdbms.migration.V5_0_2014_01_01__XMLWorkflow_Migration -- org.dspace.storage.rdbms.xmlworkflow.V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration
---------------------------------------------------- ----------------------------------------------------
CREATE SEQUENCE cwf_workflowitem_seq; CREATE SEQUENCE cwf_workflowitem_seq;

View File

@@ -17,7 +17,7 @@
-- --
-- This script is called automatically by the following -- This script is called automatically by the following
-- Flyway Java migration class: -- Flyway Java migration class:
-- org.dspace.storage.rdbms.migration.V5_0_2014_01_01__XMLWorkflow_Migration -- org.dspace.storage.rdbms.xmlworkflow.V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration
---------------------------------------------------- ----------------------------------------------------
-- Convert workflow groups: -- Convert workflow groups:

View File

@@ -17,7 +17,7 @@
-- --
-- This script is called automatically by the following -- This script is called automatically by the following
-- Flyway Java migration class: -- Flyway Java migration class:
-- org.dspace.storage.rdbms.migration.V5_0_2014_01_01__XMLWorkflow_Migration -- org.dspace.storage.rdbms.xmlworkflow.V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration
---------------------------------------------------- ----------------------------------------------------
CREATE SEQUENCE cwf_workflowitem_seq; CREATE SEQUENCE cwf_workflowitem_seq;

View File

@@ -9,7 +9,6 @@ package org.dspace.app.xmlui.aspect.administrative;
import org.apache.cocoon.environment.Request; import org.apache.cocoon.environment.Request;
import org.apache.cocoon.servlet.multipart.Part; import org.apache.cocoon.servlet.multipart.Part;
import org.apache.commons.lang.StringUtils;
import org.dspace.app.xmlui.utils.UIException; import org.dspace.app.xmlui.utils.UIException;
import org.dspace.app.xmlui.wing.Message; import org.dspace.app.xmlui.wing.Message;
import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeException;
@@ -43,6 +42,7 @@ import org.dspace.workflow.WorkflowService;
import org.dspace.workflow.factory.WorkflowServiceFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
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.jdom.JDOMException; import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder; import org.jdom.input.SAXBuilder;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@@ -59,6 +59,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
/** /**
* Utility methods to processes actions on Communities and Collections. * Utility methods to processes actions on Communities and Collections.
* *
@@ -540,7 +541,7 @@ public class FlowContainerUtils
collectionService.removeSubmitters(context, collection); collectionService.removeSubmitters(context, collection);
} }
else{ else{
if(StringUtils.equals(DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("workflow.framework"), "xmlworkflow")) if(WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService)
{ {
WorkflowUtils.deleteRoleGroup(context, collection, roleName); WorkflowUtils.deleteRoleGroup(context, collection, roleName);
}else{ }else{

View File

@@ -25,10 +25,11 @@ import org.dspace.core.LogManager;
import org.dspace.eperson.Group; import org.dspace.eperson.Group;
import org.dspace.eperson.factory.EPersonServiceFactory; import org.dspace.eperson.factory.EPersonServiceFactory;
import org.dspace.eperson.service.GroupService; import org.dspace.eperson.service.GroupService;
import org.dspace.services.factory.DSpaceServicesFactory; import org.dspace.workflow.factory.WorkflowServiceFactory;
import org.dspace.xmlworkflow.Role; import org.dspace.xmlworkflow.Role;
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 java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
@@ -247,7 +248,7 @@ public class AssignCollectionRoles extends AbstractDSpaceTransformer
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_default_read); tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_default_read);
if(StringUtils.equals(DSpaceServicesFactory.getInstance().getConfigurationService().getProperty("workflow.framework"), "xmlworkflow")) { if(WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService) {
try{ try{
HashMap<String, Role> roles = WorkflowUtils.getAllExternalRoles(thisCollection); HashMap<String, Role> roles = WorkflowUtils.getAllExternalRoles(thisCollection);
addXMLWorkflowRoles(thisCollection, baseURL, roles, rolesTable); addXMLWorkflowRoles(thisCollection, baseURL, roles, rolesTable);

View File

@@ -29,7 +29,10 @@ importClass(Packages.org.dspace.eperson.EPerson);
importClass(Packages.org.dspace.eperson.Group); importClass(Packages.org.dspace.eperson.Group);
importClass(Packages.org.dspace.app.util.Util); importClass(Packages.org.dspace.app.util.Util);
importClass(Packages.org.dspace.workflow.factory.WorkflowServiceFactory);
importClass(Packages.org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory); importClass(Packages.org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory);
importClass(Packages.org.dspace.xmlworkflow.service.XmlWorkflowService);
importClass(Packages.java.util.Set); importClass(Packages.java.util.Set);
importClass(Packages.org.dspace.app.xmlui.utils.FlowscriptUtils); importClass(Packages.org.dspace.app.xmlui.utils.FlowscriptUtils);
@@ -45,7 +48,6 @@ importClass(Packages.org.dspace.app.xmlui.aspect.administrative.FlowCurationUtil
importClass(Packages.org.dspace.app.xmlui.aspect.administrative.FlowMetadataImportUtils); importClass(Packages.org.dspace.app.xmlui.aspect.administrative.FlowMetadataImportUtils);
importClass(Packages.org.dspace.app.xmlui.aspect.administrative.FlowBatchImportUtils); importClass(Packages.org.dspace.app.xmlui.aspect.administrative.FlowBatchImportUtils);
importClass(Packages.java.lang.System); importClass(Packages.java.lang.System);
importClass(Packages.org.dspace.core.ConfigurationManager);
/** /**
* Simple access method to access the current cocoon object model. * Simple access method to access the current cocoon object model.
@@ -2698,7 +2700,7 @@ function doAssignCollectionRoles(collectionID)
{ {
result = doDeleteCollectionRole(collectionID, "DEFAULT_READ"); result = doDeleteCollectionRole(collectionID, "DEFAULT_READ");
}else{ }else{
if(StringUtils.equals(ConfigurationManager.getProperty("workflow.framework"), "xmlworkflow")){ if(WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService){
if(workflow == null){ if(workflow == null){
var collection = getCollectionService().find(getDSContext(),collectionID); var collection = getCollectionService().find(getDSContext(),collectionID);
workflow = getXmlWorkflowFactory().getWorkflow(collection); workflow = getXmlWorkflowFactory().getWorkflow(collection);

View File

@@ -64,17 +64,19 @@
<mapping class="org.dspace.versioning.Version"/> <mapping class="org.dspace.versioning.Version"/>
<mapping class="org.dspace.versioning.VersionHistory"/> <mapping class="org.dspace.versioning.VersionHistory"/>
<mapping class="org.dspace.app.requestitem.RequestItem"/>
<!--Basic workflow services, comment or remove when switching to the configurable workflow -->
<mapping class="org.dspace.workflowbasic.BasicWorkflowItem"/> <mapping class="org.dspace.workflowbasic.BasicWorkflowItem"/>
<mapping class="org.dspace.workflowbasic.TaskListItem"/> <mapping class="org.dspace.workflowbasic.TaskListItem"/>
<mapping class="org.dspace.app.requestitem.RequestItem"/> <!--Configurable workflow services, uncomment the xml workflow classes below to enable the configurable workflow-->
<!--<mapping class="org.dspace.xmlworkflow.storedcomponents.ClaimedTask"/>
<!--<mapping class="org.dspace.xmlworkflow.storedcomponents.ClaimedTask"/>--> <mapping class="org.dspace.xmlworkflow.storedcomponents.CollectionRole"/>
<!--<mapping class="org.dspace.xmlworkflow.storedcomponents.CollectionRole"/>--> <mapping class="org.dspace.xmlworkflow.storedcomponents.InProgressUser"/>
<!--<mapping class="org.dspace.xmlworkflow.storedcomponents.InProgressUser"/>--> <mapping class="org.dspace.xmlworkflow.storedcomponents.PoolTask"/>
<!--<mapping class="org.dspace.xmlworkflow.storedcomponents.PoolTask"/>--> <mapping class="org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole"/>
<!--<mapping class="org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole"/>--> <mapping class="org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem"/>-->
<!--<mapping class="org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem"/>-->
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>

View File

@@ -4,12 +4,12 @@
# Configuration properties used solely by the Configurable # # Configuration properties used solely by the Configurable #
# Reviewer Workflow (XMLUI only) # # Reviewer Workflow (XMLUI only) #
#---------------------------------------------------------------# #---------------------------------------------------------------#
#Selection of workflow framework that will be used in DSpace #
# Possible values: # Workflow framework used by DSpace is now determined by the configured
# originalworkflow = Traditional DSpace Workflow # WorkflowService implementation in [dspace.dir]/config/spring/api/core-services.xml
# xmlworkflow = New (as of 1.8.0) Configurable Reviewer Workflow # One of two WorkflowServices should be enabled in that file:
workflow.framework=originalworkflow # org.dspace.workflowbasic.BasicWorkflowServiceImpl = Traditional DSpace Workflow
#workflow.framework=xmlworkflow # org.dspace.xmlworkflow.XmlWorkflowServiceImpl = Configurable (XML) Workflow
#Allow the reviewers to add/edit/remove files from the submission #Allow the reviewers to add/edit/remove files from the submission
#When changing this property you might want to alert submitters in the license that reviewers can alter their files #When changing this property you might want to alert submitters in the license that reviewers can alter their files

View File

@@ -103,19 +103,15 @@
<bean class="org.dspace.workflowbasic.BasicWorkflowItemServiceImpl"/> <bean class="org.dspace.workflowbasic.BasicWorkflowItemServiceImpl"/>
<bean class="org.dspace.workflowbasic.BasicWorkflowServiceImpl"/> <bean class="org.dspace.workflowbasic.BasicWorkflowServiceImpl"/>
<!--<bean class="org.dspace.xmlworkflow.storedcomponents.ClaimedTaskServiceImpl"/>-->
<!--<bean class="org.dspace.xmlworkflow.storedcomponents.CollectionRoleServiceImpl"/>-->
<!--<bean class="org.dspace.xmlworkflow.storedcomponents.InProgressUserServiceImpl"/>-->
<!--<bean class="org.dspace.xmlworkflow.storedcomponents.PoolTaskServiceImpl"/>-->
<!--<bean class="org.dspace.xmlworkflow.storedcomponents.WorkflowItemRoleServiceImpl"/>-->
<!--<bean class="org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItemServiceImpl"/>-->
<!--Configurable workflow services, uncomment the xml workflow beans below to enable the configurable workflow--> <!--Configurable workflow services, uncomment the xml workflow beans below to enable the configurable workflow-->
<!--<bean class="org.dspace.xmlworkflow.XmlWorkflowServiceImpl"/>--> <!--<bean class="org.dspace.xmlworkflow.storedcomponents.ClaimedTaskServiceImpl"/>
<!--<bean class="org.dspace.xmlworkflow.WorkflowRequirementsServiceImpl"/>--> <bean class="org.dspace.xmlworkflow.storedcomponents.CollectionRoleServiceImpl"/>
<!--<bean class="org.dspace.xmlworkflow.XmlWorkflowFactoryImpl"/>--> <bean class="org.dspace.xmlworkflow.storedcomponents.InProgressUserServiceImpl"/>
<bean class="org.dspace.xmlworkflow.storedcomponents.PoolTaskServiceImpl"/>
<bean class="org.dspace.xmlworkflow.storedcomponents.WorkflowItemRoleServiceImpl"/>
<bean class="org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItemServiceImpl"/>
<bean class="org.dspace.xmlworkflow.XmlWorkflowServiceImpl"/>
<bean class="org.dspace.xmlworkflow.WorkflowRequirementsServiceImpl"/>
<bean class="org.dspace.xmlworkflow.XmlWorkflowFactoryImpl"/>-->
</beans> </beans>