Package org.dspace.xmlworkflow
Class XmlWorkflowServiceImpl
java.lang.Object
org.dspace.xmlworkflow.XmlWorkflowServiceImpl
- All Implemented Interfaces:
WorkflowService<XmlWorkflowItem>,XmlWorkflowService
When an item is submitted and is somewhere in a workflow, it has a row in the
cwf_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
FieldsModifier and TypeFieldDescriptionprotected AuthorizeServiceprotected BitstreamFormatServiceprotected BitstreamServiceprotected BundleServiceprotected ClaimedTaskServiceprotected CollectionRoleServiceprotected ConfigurationServiceprotected GroupServiceprotected HandleServiceprotected InstallItemServiceprotected ItemServiceprotected PoolTaskServiceprotected WorkflowItemRoleServiceprotected WorkflowRequirementsServiceprotected WorkspaceItemServiceprotected XmlWorkflowCuratorServiceprotected XmlWorkflowFactoryprotected XmlWorkflowItemService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabort(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) Activate the first step in a workflow for a WorkflowItem.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) Send an email to some addresses, concerning a WorkflowItem, using a given template.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) Create a claim on a task action for a given EPerson.voidcreatePoolTasks(Context context, XmlWorkflowItem wi, RoleMembers assignees, Step step, WorkflowActionConfig action) Create the task pool for a given item and workflow step.createWorkflowRoleGroup(Context context, Collection collection, String roleName) This method will create the workflowRoleGroup for a collection and the given rolenamevoiddeleteAllPooledTasks(Context context, XmlWorkflowItem wi) Deletes all pooled tasks from a WorkflowItem.voiddeleteAllTasks(Context context, XmlWorkflowItem wi) WORKFLOW TASK MANAGEMENTvoiddeleteClaimedTask(Context c, XmlWorkflowItem wi, ClaimedTask task) Deletes a completed task of a step.voiddeleteCollection(Context context, Collection collection) voiddeletePooledTask(Context context, XmlWorkflowItem wi, PoolTask task) Deletes a pooled (uncompleted) task from the task pool of a step.voiddeleteWorkflowByWorkflowItem(Context context, XmlWorkflowItem wi, EPerson e) Deletes workflow task item in correct order.doState(Context c, EPerson user, jakarta.servlet.http.HttpServletRequest request, int workflowItemId, Workflow workflow, WorkflowActionConfig currentActionConfig) Executes a workflow action and returns the next.getEPersonDeleteConstraints(Context context, EPerson ePerson) getEPersonName(EPerson ePerson) Get a description of an EPerson.protected Stringprotected StringgetWorkflowRoleGroup(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) Grant a user full powers over an Item.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 archivedvoidnotifyOfCuration(Context c, XmlWorkflowItem wi, List<EPerson> ePeople, String taskName, String action, String message) Send email to interested parties when curation tasks run.protected voidnotifyOfReject(Context c, XmlWorkflowItem wi, EPerson e, String reason) protected WorkflowActionConfigprocessNextStep(Context c, EPerson user, Workflow workflow, ActionResult currentOutcome, XmlWorkflowItem wfi, Step nextStep) processOutcome(Context c, EPerson user, Workflow workflow, Step currentStep, WorkflowActionConfig currentActionConfig, ActionResult currentOutcome, XmlWorkflowItem wfi, boolean enteredNewStep) Select the next action based on the outcome of a current action.protected voidrecordStart(Context context, Item myitem, Action action) protected voidremoveGroupItemPolicies(Context context, Item item, Group e) voidremoveUserItemPolicies(Context context, Item item, EPerson e) voidrestartWorkflow(Context context, XmlWorkflowItem wi, EPerson decliner, String provenance) protected WorkspaceItemreturnToWorkspace(Context c, XmlWorkflowItem wfi) Return the workflow item to the workspace of the submitter.protected voidrevokeReviewerPolicies(Context context, Item item) sendWorkflowItemBackSubmission(Context context, XmlWorkflowItem wi, EPerson e, String provenance, String rejection_message) start(Context context, WorkspaceItem wsi) Move an Item from a submitter's workspace into a collection's workflow - in a single transaction do away with the WorkspaceItem and turn it into a WorkflowItem.startWithoutNotify(Context context, WorkspaceItem wsi) Start the workflow normally, but disable notifications for the first workflow step.
-
Field Details
-
noEMail
-
authorizeService
-
collectionRoleService
-
claimedTaskService
-
handleService
-
installItemService
-
itemService
-
poolTaskService
-
workflowItemRoleService
-
workflowRequirementsService
-
xmlWorkflowFactory
-
workspaceItemService
-
xmlWorkflowItemService
-
groupService
-
bundleService
-
bitstreamFormatService
-
bitstreamService
-
configurationService
-
xmlWorkflowCuratorService
-
-
Constructor Details
-
XmlWorkflowServiceImpl
protected XmlWorkflowServiceImpl()
-
-
Method Details
-
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
- Specified by:
getFlywayMigrationLocationsin interfaceWorkflowService<XmlWorkflowItem>
-
start
public XmlWorkflowItem start(Context context, WorkspaceItem wsi) throws SQLException, AuthorizeException, IOException, WorkflowException Description copied from interface:WorkflowServiceMove an Item from a submitter's workspace into a collection's workflow - in a single transaction do away with the WorkspaceItem and turn it into a WorkflowItem. The WorkspaceItem which wraps the submitted Item is deleted.- 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 Description copied from interface:WorkflowServiceStart the workflow normally, but disable notifications for the first workflow step. Subsequent notifications happen normally. Useful for large imports.- 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, jakarta.mail.MessagingException Description copied from interface:XmlWorkflowServiceSend an email to some addresses, concerning a WorkflowItem, using a given template.- Specified by:
alertUsersOnTaskActivationin interfaceXmlWorkflowService- Parameters:
c- current DSpace session.wfi- the workflow item.emailTemplate- name of the message template.epa- users to receive the message.arguments- to be substituted into the message template.- Throws:
IOException- passed through.SQLException- passed through.jakarta.mail.MessagingException- passed through.
-
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 Activate the first step in a workflow for a WorkflowItem. If the step has no UI then execute it as well.- Parameters:
context- current DSpace session.wf- workflow being traversed.firstStep- the step to be activated.wfi- the item upon which to activate the step.- Throws:
AuthorizeException- passed through.IOException- passed through.SQLException- passed through.WorkflowException- passed through.WorkflowConfigurationException- unused.
-
doState
public WorkflowActionConfig doState(Context c, EPerson user, jakarta.servlet.http.HttpServletRequest request, int workflowItemId, Workflow workflow, WorkflowActionConfig currentActionConfig) throws SQLException, AuthorizeException, IOException, jakarta.mail.MessagingException, WorkflowException Description copied from interface:XmlWorkflowServiceExecutes a workflow action and returns the next.- Specified by:
doStatein interfaceXmlWorkflowService- Parameters:
c- current DSpace session.user- user attempting the action.request- the current request.workflowItemId- the workflow item on which to take the action.workflow- the workflow holding the item.currentActionConfig- the requested action.- Returns:
- the next action to be executed.
- Throws:
SQLException- passed through.AuthorizeException- if the user may not take this action.IOException- passed through.jakarta.mail.MessagingException- unused.WorkflowException- if the action could not be executed.
-
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 Description copied from interface:XmlWorkflowServiceSelect the next action based on the outcome of a current action.- Specified by:
processOutcomein interfaceXmlWorkflowService- Parameters:
c- session context.user- current user.workflow- item is in this workflow.currentStep- workflow step being executed.currentActionConfig- describes the current step's action.currentOutcome- the result of executing the current step (accept/reject/etc).wfi- the Item being processed through workflow.enteredNewStep- is the Item advancing to a new workflow step?- Returns:
- the next step's action.
- Throws:
IOException- passed through.AuthorizeException- passed through.SQLException- passed through.WorkflowException- if the current step's outcome is unrecognized.
-
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.
-
notifyOfCuration
public void notifyOfCuration(Context c, XmlWorkflowItem wi, List<EPerson> ePeople, String taskName, String action, String message) throws SQLException, IOException Description copied from interface:XmlWorkflowServiceSend email to interested parties when curation tasks run.- Specified by:
notifyOfCurationin interfaceXmlWorkflowService- Parameters:
c- session context.wi- the item being curated.ePeople- the interested parties.taskName- the task that has been run.action- the action indicated by the task (reject, approve, etc.)message- anything the code wants to say about the task.- Throws:
SQLException- passed through.IOException- passed through.
-
getItemTitle
- Throws:
SQLException
-
getSubmitterName
- Throws:
SQLException
-
deleteAllTasks
public void deleteAllTasks(Context context, XmlWorkflowItem wi) throws SQLException, AuthorizeException WORKFLOW TASK MANAGEMENT- Specified by:
deleteAllTasksin interfaceXmlWorkflowService- Parameters:
context- current DSpace sessionwi- the workflow item for which we are to delete the tasks- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
deleteAllPooledTasks
public void deleteAllPooledTasks(Context context, XmlWorkflowItem wi) throws SQLException, AuthorizeException Description copied from interface:XmlWorkflowServiceDeletes all pooled tasks from a WorkflowItem.- Specified by:
deleteAllPooledTasksin interfaceXmlWorkflowService- Parameters:
context- current DSpace session.wi- the workflow item from which we are to delete the tasks.- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
deletePooledTask
public void deletePooledTask(Context context, XmlWorkflowItem wi, PoolTask task) throws SQLException, AuthorizeException Description copied from interface:XmlWorkflowServiceDeletes a pooled (uncompleted) task from the task pool of a step.- Specified by:
deletePooledTaskin interfaceXmlWorkflowService- Parameters:
context- current DSpace session.wi- the workflow item associated with the task.task- the task to be removed.- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
deleteClaimedTask
public void deleteClaimedTask(Context c, XmlWorkflowItem wi, ClaimedTask task) throws SQLException, AuthorizeException Description copied from interface:XmlWorkflowServiceDeletes a completed task of a step.- Specified by:
deleteClaimedTaskin interfaceXmlWorkflowService- Parameters:
c- current DSpace session.wi- the workflow item associated with the task.task- the task to be removed.- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
createPoolTasks
public void createPoolTasks(Context context, XmlWorkflowItem wi, RoleMembers assignees, Step step, WorkflowActionConfig action) throws SQLException, AuthorizeException Description copied from interface:XmlWorkflowServiceCreate the task pool for a given item and workflow step.- Specified by:
createPoolTasksin interfaceXmlWorkflowServicewi- Create tasks for this item.assignees- Role members for this step.step- Create tasks for this step.- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
createOwnedTask
public void createOwnedTask(Context context, XmlWorkflowItem wi, Step step, WorkflowActionConfig action, EPerson e) throws SQLException, AuthorizeException Description copied from interface:XmlWorkflowServiceCreate a claim on a task action for a given EPerson.- Specified by:
createOwnedTaskin interfaceXmlWorkflowService- Parameters:
context- current DSpace session.wi- Claim tasks of this item.step- Claim tasks from this step.action- the action being claimed.e- Claimant.- Throws:
SQLException- passed through.AuthorizeException- passed through.
-
grantUserAllItemPolicies
public void grantUserAllItemPolicies(Context context, Item item, EPerson epa, String policyType) throws AuthorizeException, SQLException Description copied from interface:XmlWorkflowServiceGrant a user full powers over an Item.- Specified by:
grantUserAllItemPoliciesin interfaceXmlWorkflowService- Parameters:
context- current DSpace session.item- grant powers over this item.epa- user to whom powers are granted.policyType- workflow, submission, etc.- Throws:
AuthorizeException- passed through.SQLException- passed through.
-
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
-
deleteWorkflowByWorkflowItem
public void deleteWorkflowByWorkflowItem(Context context, XmlWorkflowItem wi, EPerson e) throws SQLException, AuthorizeException, IOException Description copied from interface:WorkflowServiceDeletes workflow task item in correct order.- Specified by:
deleteWorkflowByWorkflowItemin interfaceWorkflowService<XmlWorkflowItem>- Parameters:
context- The relevant DSpace Context.wi- The WorkflowItem that shall be deleted.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.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.
-
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.
-
restartWorkflow
public void restartWorkflow(Context context, XmlWorkflowItem wi, EPerson decliner, String provenance) throws SQLException, AuthorizeException, IOException, WorkflowException - Specified by:
restartWorkflowin interfaceWorkflowService<XmlWorkflowItem>- Throws:
SQLExceptionAuthorizeExceptionIOExceptionWorkflowException
-
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
Description copied from interface:XmlWorkflowServiceGet a description of an EPerson.- Specified by:
getEPersonNamein interfaceXmlWorkflowService- Parameters:
ePerson- the EPerson to be described.- Returns:
- the EPerson's full name and email address.
-
recordStart
protected void recordStart(Context context, Item myitem, Action action) throws SQLException, IOException, AuthorizeException -
notifyOfReject
-
getMyDSpaceLink
- Specified by:
getMyDSpaceLinkin interfaceWorkflowService<XmlWorkflowItem>
-
revokeReviewerPolicies
protected void revokeReviewerPolicies(Context context, Item item) throws SQLException, AuthorizeException - Throws:
SQLExceptionAuthorizeException
-