Alfresco Content Services - Blog - Page 13

cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Content Services - Blog - Page 13

angelborroy
Alfresco Employee

This year was the second fully virtual edition of FOSDEM, the Free & Open Source Software meeting that takes place in Brussels yearly.

This edition gathered thousands of FOSS enthusiasts from all around the world, making it the perfect event for anyone interested in learning about open-source projects and communities.

Read more...

Read more
0 4 1,972
menczingerm
Active Member

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

  • Workflow Console "delete all worfklows imeanit" command only delete active tasks and workflows
  • Trying to undeploy and redeploy a workflow definistion name with workflow conolse will delete completed workflows related to that workflow definition but it will not remove the completed tasks - undeploying a workflow definition will cause you a problem - completed task without deployed definition  (link
    Exception (with status template): 01030136 Failed to execute script 'Javascript Console Script': null
    org.springframework.extensions.webscripts.WebScriptException: 01030006 Wrapped Exception (with status template): 01030136 Failed to execute script 'Javascript Console Script': null
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1139)
  • With Alfresco RestApi you are not able to manage completed tasks/workflows only active tasks/workflows
  • I also found out someone managed to delete completed task/workflows with deleting records directly in the DB, how ever i did not investigate this deeply.

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.

Read more
2 1 2,322
angelborroy
Alfresco Employee

FOSDEM 2022, the biggest Open Source Software and Hardware event in Europe, will be online on February 5th and February 6th.

Read more...

Read more
1 0 1,302
angelborroy
Alfresco Employee

Alfresco provides by default an Auto-Suggest feature that returns term suggestions.

Read more...

Read more
5 5 5,150
tpage
Alfresco Employee

We all know that the best way to store cat videos is using Alfresco Content Services, but wouldn't it be great if we could easily convert our libraries of cat videos into animated gifs? With the Community Hackathon there was an opportunity to try this out and investigate integrating ffmpeg with Alfresco.
 
Read more...

Read more
2 0 1,912
Alfresco Content Services Blog