11-02-2017 07:48 AM
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 !
11-02-2017 08:16 AM
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.
11-02-2017 09:13 AM
Thanks axel. I'll check Activiti API.
Any plan to make this feature available in public API in a near feature ?
11-02-2017 10:26 AM
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....
11-02-2017 10:46 AM
OK, I do not have this kind of Customer on hand 🙂
11-02-2017 12:05 PM
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?)
Explore our Alfresco products with the links below. Use labels to filter content by product module.