Description:
My goal was to delete all active and completed tasks and workflows in ACS and here is some information what i found out untill i could reach my goal.
Conclusions
Solution:
So the solution what worked for me is to write a custom javascript code what i could run with javascript console to remove completed task and workflows in the repository.
Here is the script:
var ctxt = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var service = ctxt.getBean('WorkflowService', Packages.org.alfresco.service.cmr.workflow.WorkflowService);
var activitiProcessEngine = ctxt.getBean('activitiProcessEngine', Packages.org.activiti.engine.impl.ProcessEngineImpl);
var activitiUtil = new org.alfresco.repo.workflow.activiti.ActivitiUtil(activitiProcessEngine, false);
var historyService = activitiUtil.getHistoryService();
var completedWorkflows = service.getCompletedWorkflows();
while(completedWorkflows.size() > 0){
var wfToDelete = completedWorkflows.remove(0);
var id = wfToDelete.getId();
historyService.deleteHistoricProcessInstance(id.substr(9));
logger.log("WF deleted: " + id);
completedWorkflows = service.getCompletedWorkflows();
}
The script tested with ACS 5.2 CE AND ACS 6.2 CE
I would like to thank my colleagues at BroadBit Hungary and @angelborroy @openpj for their help
Ps.: If you have any comment or suggestion please dont hasitate to post it.