From e64357dd45bc20b271c2c0132eebfe67d8f11005 Mon Sep 17 00:00:00 2001 From: Frederik Heremans Date: Mon, 30 Apr 2012 12:07:23 +0000 Subject: [PATCH] ALF-13474 possibility of deleting compleded workflows + explorer ui cancel action fix git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@35900 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../bean/workflow/CancelWorkflowDialog.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java b/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java index 1428be8584..38d742f0f0 100644 --- a/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java +++ b/source/java/org/alfresco/web/bean/workflow/CancelWorkflowDialog.java @@ -72,13 +72,21 @@ public class CancelWorkflowDialog extends BaseDialogBean throws Exception { if (logger.isDebugEnabled()) - logger.debug("Cancelling workflow with id: " + this.getWorkflowInstance().id); + logger.debug("Cancelling workflow with id: " + this.getWorkflowInstance().getId()); - // cancel the workflow - this.getWorkflowService().cancelWorkflow(this.getWorkflowInstance().id); + WorkflowInstance instance = this.getWorkflowInstance(); + if(instance.isActive()) { + // cancel the workflow + this.getWorkflowService().cancelWorkflow(this.getWorkflowInstance().getId()); + } + else + { + // delete the workflow + this.getWorkflowService().deleteWorkflow(this.getWorkflowInstance().getId()); + } if (logger.isDebugEnabled()) - logger.debug("Cancelled workflow with id: " + this.getWorkflowInstance().id); + logger.debug("Cancelled workflow with id: " + this.getWorkflowInstance().getId()); return outcome; } @@ -120,10 +128,10 @@ public class CancelWorkflowDialog extends BaseDialogBean String confirmMsg = Application.getMessage(FacesContext.getCurrentInstance(), "cancel_workflow_confirm"); - String workflowLabel = this.getWorkflowInstance().definition.title; - if (this.getWorkflowInstance().description != null && this.getWorkflowInstance().description.length() > 0) + String workflowLabel = this.getWorkflowInstance().getDefinition().getTitle(); + if (this.getWorkflowInstance().getDescription() != null && this.getWorkflowInstance().getDescription().length() > 0) { - workflowLabel = workflowLabel + " (" + this.getWorkflowInstance().description + ")"; + workflowLabel = workflowLabel + " (" + this.getWorkflowInstance().getDescription() + ")"; } return MessageFormat.format(confirmMsg, new Object[] {workflowLabel});