Dear all,
I'm using the WorkflowService JAVA API to write a web service that returns a list of workflow instances matching a set of criterias. The response is displayed in an aikau page using traditional paginated list components.
I note that WorkflowService has a method "getWorflows" accepting 'maxItems' and 'skipCount' as parameters for pagination, but no 'sortBy' criteria (how to build a paginated list without being able to sort the results ?).
My questions:
- What is the default sortOrder internally used by 'getWorflows' method ?
- Is there any way to change this sortOrder using public API ?
Thanks !
Using the Alfresco API you cannot sort the workflows. You'd have to circumvent it and use Activiti API directly (which of course is not recommended by Alfresco). The default sort order is by process instance duration, so the time that the workflow has been running, but only if a maxItems higher than 0 has been specified.
Thanks axel. I'll check Activiti API.
Any plan to make this feature available in public API in a near feature ?
I am not an Alfresco Engineer, so I can't give a reliable / official answer. But considering that Alfresco is considering to move the workflow engine completely out of the Repository at some point in the future, I would not bet on it. It has also been this way for years, so you'd have to find an extremely influential, paying customer to convince Alfresco to change it now....
OK, I do not have this kind of Customer on hand :-)
For those who are interested in, the code is here:
org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine, method 'getWorkflowsInternal'
...
query.orderByProcessInstanceDuration().desc().listPage(skipCount, maxItems);
...
and doc: https://www.activiti.org/javadocs/org/activiti/engine/history/HistoricProcessInstanceQuery.html
But I can't see the default sortOrder where no pagination is requested... ?
And what would be the correct way to write a new implementation of WorkflowEngine with additional sorting capabilities ? (how to make it working with current wf services?)
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.