cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove a completed workflow

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

I use this to delete some workflows :
// Delete workflow
      workflowService.deleteWorkflow(workflowId);

All is working if the workflow is not completed. I get an error if I try to remove a completed workflow…

2012-02-24 14:58:31,336  ERROR [extensions.webscripts.AbstractRuntime] [http-8080-1] Exception from executeScript - redirecting to status template error: 01240005 Wrapped Exception (with status template): 01240076 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/module/custom/modifydocument/modifyDocument.get.js': 01240075 Failed to delete unexisting workflow instance {0}.
org.springframework.extensions.webscripts.WebScriptException: 01240005 Wrapped Exception (with status template): 01240076 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/module/custom/modifydocument/modifyDocument.get.js': 01240075 Failed to delete unexisting workflow instance {0}.
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:970)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
        at org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:400)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:462)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:500)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:316)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:372)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.alfresco.scripts.ScriptException: 01240076 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/module/custom/modifydocument/modifyDocument.get.js': 01240075 Failed to delete unexisting workflow instance {0}.
        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:195)
        at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
        at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
        at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
        at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1193)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
        … 25 more
Caused by: org.alfresco.service.cmr.workflow.WorkflowException: 01240075 Failed to delete unexisting workflow instance {0}.
        at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.deleteWorkflow(ActivitiWorkflowEngine.java:271)
        at org.alfresco.repo.workflow.WorkflowServiceImpl.deleteWorkflow(WorkflowServiceImpl.java:575)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:147)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy71.deleteWorkflow(Unknown Source)
        at ch.custom.manageoffice.workers.WorkflowManager.deleteWorklowAndAnnexe(WorkflowManager.java:473)
        at ch.custom.manageoffice.actionswebscripts.WebscriptsHelper.deleteWorkflows(WebscriptsHelper.java:153)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c2._c0(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/modifydocument/modifyDocument.get.js:133)
        at org.mozilla.javascript.gen.c2.call(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/modifydocument/modifyDocument.get.js)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
        at org.mozilla.javascript.gen.c2.call(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/modifydocument/modifyDocument.get.js)
        at org.mozilla.javascript.gen.c2.exec(file:/opt/alfresco-4.0.d/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/custom/modifydocument/modifyDocument.get.js)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:483)
        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:191)
        … 30 more


How can I delete a completed workflow (in Java code) ?

(Alfresco 4.0D, Activiti)

Thank you.
4 REPLIES 4

jpotts
World-Class Innovator
World-Class Innovator
Once the workflow is complete there is nothing to delete. That's why the error message is telling you that it cannot delete a workflow instance that does not exist.

Jeff

dranakan
Champ on-the-rise
Champ on-the-rise
Thank you Jeff,

I hope you have given a lot of Alfresco T-Shirt during theses months:-)

Once the workflow is complete there is nothing to delete. That's why the error message is telling you that it cannot delete a workflow instance that does not exist.
I can still access the workflow when it's ended (with the id : activiti$12345). But in some cases, I would like to remove them.
How can I delete a completed workflow ? Alfresco forbidden it ?

Thank you.

jpotts
World-Class Innovator
World-Class Innovator
I see what you mean. I think this might be a bug. It is also strange that you can get a handle to the completed workflow but if you go into the workflow console and do a "show workflows all" the workflow will not show up.

I've created a Jira for this:
https://issues.alfresco.com/jira/browse/ALF-13113

Jeff

dranakan
Champ on-the-rise
Champ on-the-rise
Thank you. I follow on JIRA…