Package org.dspace.xmlworkflow
Class XmlWorkflowServiceImpl
- java.lang.Object
-
- org.dspace.xmlworkflow.XmlWorkflowServiceImpl
-
- All Implemented Interfaces:
WorkflowService<XmlWorkflowItem>,XmlWorkflowService
public class XmlWorkflowServiceImpl extends Object implements XmlWorkflowService
When an item is submitted and is somewhere in a workflow, it has a row in the WorkflowItem table pointing to it. Once the item has completed the workflow it will be archived- Author:
- Bram De Schouwer (bram.deschouwer at dot com), Kevin Van de Velde (kevin at atmire dot com), Ben Bosman (ben at atmire dot com), Mark Diggory (markd at atmire dot com)
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected BitstreamFormatServicebitstreamFormatServiceprotected BitstreamServicebitstreamServiceprotected BundleServicebundleServiceprotected ClaimedTaskServiceclaimedTaskServiceprotected CollectionRoleServicecollectionRoleServiceprotected GroupServicegroupServiceprotected HandleServicehandleServiceprotected InstallItemServiceinstallItemServiceprotected ItemServiceitemServiceprotected Map<UUID,Boolean>noEMailprotected PoolTaskServicepoolTaskServiceprotected WorkflowItemRoleServiceworkflowItemRoleServiceprotected WorkflowRequirementsServiceworkflowRequirementsServiceprotected WorkspaceItemServiceworkspaceItemServiceprotected XmlWorkflowFactoryxmlWorkflowFactoryprotected XmlWorkflowItemServicexmlWorkflowItemService
-
Constructor Summary
Constructors Modifier Constructor Description protectedXmlWorkflowServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkspaceItemabort(Context c, XmlWorkflowItem wi, EPerson e)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 PersonalWorkspaceprotected voidactivateFirstStep(Context context, Workflow wf, Step firstStep, XmlWorkflowItem wfi)protected voidaddGroupPolicyToItem(Context context, Item item, int action, Group group, String policyType)protected voidaddPolicyToItem(Context context, Item item, int action, EPerson epa, String policyType)voidalertUsersOnTaskActivation(Context c, XmlWorkflowItem wfi, String emailTemplate, List<EPerson> epa, String... arguments)protected Itemarchive(Context context, XmlWorkflowItem wfi)Commit the contained item to the main archive.voidcreateOwnedTask(Context context, XmlWorkflowItem wi, Step step, WorkflowActionConfig action, EPerson e)voidcreatePoolTasks(Context context, XmlWorkflowItem wi, RoleMembers assignees, Step step, WorkflowActionConfig action)GroupcreateWorkflowRoleGroup(Context context, Collection collection, String roleName)This method will create the workflowRoleGroup for a collection and the given rolenamevoiddeleteAllPooledTasks(Context context, XmlWorkflowItem wi)voiddeleteAllTasks(Context context, XmlWorkflowItem wi)Deletes all tasks from this workflowflowitemvoiddeleteClaimedTask(Context c, XmlWorkflowItem wi, ClaimedTask task)voiddeleteCollection(Context context, Collection collection)voiddeletePooledTask(Context context, XmlWorkflowItem wi, PoolTask task)WorkflowActionConfigdoState(Context c, EPerson user, javax.servlet.http.HttpServletRequest request, int workflowItemId, Workflow workflow, WorkflowActionConfig currentActionConfig)List<String>getEPersonDeleteConstraints(Context context, EPerson ePerson)StringgetEPersonName(EPerson ePerson)List<String>getFlywayMigrationLocations()StringgetMyDSpaceLink()GroupgetWorkflowRoleGroup(Context context, Collection collection, String roleName, Group roleGroup)protected voidgrantGroupAllItemPolicies(Context context, Item item, Group group, String policyType)protected voidgrantSubmitterReadPolicies(Context context, Item item)voidgrantUserAllItemPolicies(Context context, Item item, EPerson epa, String policyType)protected voidlogWorkflowEvent(Context c, String workflowId, String previousStepId, String previousActionConfigId, XmlWorkflowItem wfi, EPerson actor, Step newStep, WorkflowActionConfig newActionConfig)protected voidnotifyOfArchive(Context context, Item item, Collection coll)notify the submitter that the item is archivedprotected voidnotifyOfReject(Context c, XmlWorkflowItem wi, EPerson e, String reason)protected WorkflowActionConfigprocessNextStep(Context c, EPerson user, Workflow workflow, ActionResult currentOutcome, XmlWorkflowItem wfi, Step nextStep)WorkflowActionConfigprocessOutcome(Context c, EPerson user, Workflow workflow, Step currentStep, WorkflowActionConfig currentActionConfig, ActionResult currentOutcome, XmlWorkflowItem wfi, boolean enteredNewStep)protected voidrecordStart(Context context, Item myitem, Action action)protected voidremoveGroupItemPolicies(Context context, Item item, Group e)voidremoveUserItemPolicies(Context context, Item item, EPerson e)protected WorkspaceItemreturnToWorkspace(Context c, XmlWorkflowItem wfi)Return the workflow item to the workspace of the submitter.protected voidrevokeReviewerPolicies(Context context, Item item)WorkspaceItemsendWorkflowItemBackSubmission(Context context, XmlWorkflowItem wi, EPerson e, String provenance, String rejection_message)XmlWorkflowItemstart(Context context, WorkspaceItem wsi)startWorkflow() begins a workflow - in a single transaction do away with the PersonalWorkspace entry and turn it into a WorkflowItem.XmlWorkflowItemstartWithoutNotify(Context context, WorkspaceItem wsi)startWithoutNotify() starts the workflow normally, but disables notifications (useful for large imports,) for the first workflow step - subsequent notifications happen normally
-
-
-
Field Detail
-
authorizeService
@Autowired(required=true) protected AuthorizeService authorizeService
-
collectionRoleService
@Autowired(required=true) protected CollectionRoleService collectionRoleService
-
claimedTaskService
@Autowired(required=true) protected ClaimedTaskService claimedTaskService
-
handleService
@Autowired(required=true) protected HandleService handleService
-
installItemService
@Autowired(required=true) protected InstallItemService installItemService
-
itemService
@Autowired(required=true) protected ItemService itemService
-
poolTaskService
@Autowired(required=true) protected PoolTaskService poolTaskService
-
workflowItemRoleService
@Autowired(required=true) protected WorkflowItemRoleService workflowItemRoleService
-
workflowRequirementsService
@Autowired(required=true) protected WorkflowRequirementsService workflowRequirementsService
-
xmlWorkflowFactory
@Autowired(required=true) protected XmlWorkflowFactory xmlWorkflowFactory
-
workspaceItemService
@Autowired(required=true) protected WorkspaceItemService workspaceItemService
-
xmlWorkflowItemService
@Autowired(required=true) protected XmlWorkflowItemService xmlWorkflowItemService
-
groupService
@Autowired(required=true) protected GroupService groupService
-
bundleService
@Autowired(required=true) protected BundleService bundleService
-
bitstreamFormatService
@Autowired(required=true) protected BitstreamFormatService bitstreamFormatService
-
bitstreamService
@Autowired(required=true) protected BitstreamService bitstreamService
-
-
Method Detail
-
deleteCollection
public void deleteCollection(Context context, Collection collection) throws SQLException, IOException, AuthorizeException
- Specified by:
deleteCollectionin interfaceWorkflowService<XmlWorkflowItem>- Throws:
SQLExceptionIOExceptionAuthorizeException
-
getEPersonDeleteConstraints
public List<String> getEPersonDeleteConstraints(Context context, EPerson ePerson) throws SQLException
- Specified by:
getEPersonDeleteConstraintsin interfaceWorkflowService<XmlWorkflowItem>- Throws:
SQLException
-
getWorkflowRoleGroup
public Group getWorkflowRoleGroup(Context context, Collection collection, String roleName, Group roleGroup) throws SQLException, IOException, WorkflowException, AuthorizeException
- Specified by:
getWorkflowRoleGroupin interfaceWorkflowService<XmlWorkflowItem>- Throws:
SQLExceptionIOExceptionWorkflowExceptionAuthorizeException
-
createWorkflowRoleGroup
public Group createWorkflowRoleGroup(Context context, Collection collection, String roleName) throws AuthorizeException, SQLException, IOException, WorkflowConfigurationException
Description copied from interface:WorkflowServiceThis method will create the workflowRoleGroup for a collection and the given rolename- Specified by:
createWorkflowRoleGroupin interfaceWorkflowService<XmlWorkflowItem>- Parameters:
context- The relevant DSpace contextcollection- The collectionroleName- The rolename- Returns:
- The created Group
- Throws:
AuthorizeException- If something goes wrongSQLException- If something goes wrongIOException- If something goes wrongWorkflowConfigurationException- If something goes wrong
-
getFlywayMigrationLocations
public List<String> getFlywayMigrationLocations()
- Specified by:
getFlywayMigrationLocationsin interfaceWorkflowService<XmlWorkflowItem>
-
start
public XmlWorkflowItem start(Context context, WorkspaceItem wsi) throws SQLException, AuthorizeException, IOException, WorkflowException
Description copied from interface:WorkflowServicestartWorkflow() begins a workflow - in a single transaction do away with the PersonalWorkspace entry and turn it into a WorkflowItem.- Specified by:
startin interfaceWorkflowService<XmlWorkflowItem>- Parameters:
context- The relevant DSpace Context.wsi- The WorkspaceItem to convert to a workflow item- Returns:
- The resulting workflow item
- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.IOException- A general class of exceptions produced by failed or interrupted I/O operations.WorkflowException- if workflow error
-
startWithoutNotify
public XmlWorkflowItem startWithoutNotify(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- Specified by:
startWithoutNotifyin interfaceWorkflowService<XmlWorkflowItem>- Parameters:
context- The relevant DSpace Context.wsi- workspace item- Returns:
- the resulting workflow item.
- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.IOException- A general class of exceptions produced by failed or interrupted I/O operations.WorkflowException- if workflow error
-
alertUsersOnTaskActivation
public void alertUsersOnTaskActivation(Context c, XmlWorkflowItem wfi, String emailTemplate, List<EPerson> epa, String... arguments) throws IOException, SQLException, javax.mail.MessagingException
- Specified by:
alertUsersOnTaskActivationin interfaceXmlWorkflowService- Throws:
IOExceptionSQLExceptionjavax.mail.MessagingException
-
grantSubmitterReadPolicies
protected void grantSubmitterReadPolicies(Context context, Item item) throws SQLException, AuthorizeException
- Throws:
SQLExceptionAuthorizeException
-
activateFirstStep
protected void activateFirstStep(Context context, Workflow wf, Step firstStep, XmlWorkflowItem wfi) throws AuthorizeException, IOException, SQLException, WorkflowException, WorkflowConfigurationException
-
doState
public WorkflowActionConfig doState(Context c, EPerson user, javax.servlet.http.HttpServletRequest request, int workflowItemId, Workflow workflow, WorkflowActionConfig currentActionConfig) throws SQLException, AuthorizeException, IOException, WorkflowException
- Specified by:
doStatein interfaceXmlWorkflowService- Throws:
SQLExceptionAuthorizeExceptionIOExceptionWorkflowException
-
processOutcome
public WorkflowActionConfig processOutcome(Context c, EPerson user, Workflow workflow, Step currentStep, WorkflowActionConfig currentActionConfig, ActionResult currentOutcome, XmlWorkflowItem wfi, boolean enteredNewStep) throws IOException, AuthorizeException, SQLException, WorkflowException
- Specified by:
processOutcomein interfaceXmlWorkflowService- Throws:
IOExceptionAuthorizeExceptionSQLExceptionWorkflowException
-
logWorkflowEvent
protected void logWorkflowEvent(Context c, String workflowId, String previousStepId, String previousActionConfigId, XmlWorkflowItem wfi, EPerson actor, Step newStep, WorkflowActionConfig newActionConfig) throws SQLException
- Throws:
SQLException
-
processNextStep
protected WorkflowActionConfig processNextStep(Context c, EPerson user, Workflow workflow, ActionResult currentOutcome, XmlWorkflowItem wfi, Step nextStep) throws SQLException, IOException, AuthorizeException, WorkflowException, WorkflowConfigurationException
-
archive
protected Item archive(Context context, XmlWorkflowItem wfi) throws SQLException, IOException, AuthorizeException
Commit the contained item to the main archive. The item is associated with the relevant collection, added to the search index, and any other tasks such as assigning dates are performed.- Parameters:
context- The relevant DSpace Context.wfi- workflow item- Returns:
- the fully archived item.
- Throws:
IOException- A general class of exceptions produced by failed or interrupted I/O operations.SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
notifyOfArchive
protected void notifyOfArchive(Context context, Item item, Collection coll) throws SQLException, IOException
notify the submitter that the item is archived- Parameters:
context- The relevant DSpace Context.item- which item was archivedcoll- collection name to display in template- Throws:
SQLException- An exception that provides information on a database access error or other errors.IOException- A general class of exceptions produced by failed or interrupted I/O operations.
-
deleteAllTasks
public void deleteAllTasks(Context context, XmlWorkflowItem wi) throws SQLException, AuthorizeException
Deletes all tasks from this workflowflowitem- Specified by:
deleteAllTasksin interfaceXmlWorkflowService- Parameters:
context- the dspace contextwi- the workflow item for which we are to delete the tasks- Throws:
SQLException- An exception that provides information on a database access error or other errors.AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.
-
deleteAllPooledTasks
public void deleteAllPooledTasks(Context context, XmlWorkflowItem wi) throws SQLException, AuthorizeException
- Specified by:
deleteAllPooledTasksin interfaceXmlWorkflowService- Throws:
SQLExceptionAuthorizeException
-
deletePooledTask
public void deletePooledTask(Context context, XmlWorkflowItem wi, PoolTask task) throws SQLException, AuthorizeException
- Specified by:
deletePooledTaskin interfaceXmlWorkflowService- Throws:
SQLExceptionAuthorizeException
-
deleteClaimedTask
public void deleteClaimedTask(Context c, XmlWorkflowItem wi, ClaimedTask task) throws SQLException, AuthorizeException
- Specified by:
deleteClaimedTaskin interfaceXmlWorkflowService- Throws:
SQLExceptionAuthorizeException
-
createPoolTasks
public void createPoolTasks(Context context, XmlWorkflowItem wi, RoleMembers assignees, Step step, WorkflowActionConfig action) throws SQLException, AuthorizeException
- Specified by:
createPoolTasksin interfaceXmlWorkflowService- Throws:
SQLExceptionAuthorizeException
-
createOwnedTask
public void createOwnedTask(Context context, XmlWorkflowItem wi, Step step, WorkflowActionConfig action, EPerson e) throws SQLException, AuthorizeException
- Specified by:
createOwnedTaskin interfaceXmlWorkflowService- Throws:
SQLExceptionAuthorizeException
-
grantUserAllItemPolicies
public void grantUserAllItemPolicies(Context context, Item item, EPerson epa, String policyType) throws AuthorizeException, SQLException
- Specified by:
grantUserAllItemPoliciesin interfaceXmlWorkflowService- Throws:
AuthorizeExceptionSQLException
-
grantGroupAllItemPolicies
protected void grantGroupAllItemPolicies(Context context, Item item, Group group, String policyType) throws AuthorizeException, SQLException
- Throws:
AuthorizeExceptionSQLException
-
addPolicyToItem
protected void addPolicyToItem(Context context, Item item, int action, EPerson epa, String policyType) throws AuthorizeException, SQLException
- Throws:
AuthorizeExceptionSQLException
-
addGroupPolicyToItem
protected void addGroupPolicyToItem(Context context, Item item, int action, Group group, String policyType) throws AuthorizeException, SQLException
- Throws:
AuthorizeExceptionSQLException
-
removeUserItemPolicies
public void removeUserItemPolicies(Context context, Item item, EPerson e) throws SQLException, AuthorizeException
- Specified by:
removeUserItemPoliciesin interfaceXmlWorkflowService- Throws:
SQLExceptionAuthorizeException
-
removeGroupItemPolicies
protected void removeGroupItemPolicies(Context context, Item item, Group e) throws SQLException, AuthorizeException
- Throws:
SQLExceptionAuthorizeException
-
sendWorkflowItemBackSubmission
public WorkspaceItem sendWorkflowItemBackSubmission(Context context, XmlWorkflowItem wi, EPerson e, String provenance, String rejection_message) throws SQLException, AuthorizeException, IOException
- Specified by:
sendWorkflowItemBackSubmissionin interfaceWorkflowService<XmlWorkflowItem>- Throws:
SQLExceptionAuthorizeExceptionIOException
-
abort
public WorkspaceItem abort(Context c, XmlWorkflowItem wi, EPerson e) throws AuthorizeException, SQLException, IOException
Description copied from interface:WorkflowServiceabort() 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- Specified by:
abortin interfaceWorkflowService<XmlWorkflowItem>- Parameters:
c- The relevant DSpace Context.wi- WorkflowItem to operate one- EPerson doing the operation- Returns:
- workspace item returned to workspace
- Throws:
AuthorizeException- Exception indicating the current user of the context does not have permission to perform a particular action.SQLException- An exception that provides information on a database access error or other errors.IOException- A general class of exceptions produced by failed or interrupted I/O operations.
-
returnToWorkspace
protected WorkspaceItem returnToWorkspace(Context c, XmlWorkflowItem wfi) throws SQLException, IOException, AuthorizeException
Return the workflow item to the workspace of the submitter. The workflow item is removed, and a workspace item created.- Parameters:
c- Contextwfi- WorkflowItem to be 'dismantled'- Returns:
- the workspace item
- Throws:
IOException- ...SQLException- ...AuthorizeException- ...
-
getEPersonName
public String getEPersonName(EPerson ePerson)
- Specified by:
getEPersonNamein interfaceXmlWorkflowService
-
recordStart
protected void recordStart(Context context, Item myitem, Action action) throws SQLException, IOException, AuthorizeException
-
notifyOfReject
protected void notifyOfReject(Context c, XmlWorkflowItem wi, EPerson e, String reason)
-
getMyDSpaceLink
public String getMyDSpaceLink()
- Specified by:
getMyDSpaceLinkin interfaceWorkflowService<XmlWorkflowItem>
-
revokeReviewerPolicies
protected void revokeReviewerPolicies(Context context, Item item) throws SQLException, AuthorizeException
- Throws:
SQLExceptionAuthorizeException
-
-