use of org.alfresco.rest.workflow.api.model.Activity in project alfresco-remote-api by Alfresco.
the class ActivitiesImpl method getActivities.
@Override
public CollectionWithPagingInfo<Activity> getActivities(String processId, Parameters parameters) {
Paging paging = parameters.getPaging();
String status = parameters.getParameter("status");
validateIfUserAllowedToWorkWithProcess(processId);
HistoricActivityInstanceQuery query = activitiProcessEngine.getHistoryService().createHistoricActivityInstanceQuery();
if (STATUS_ACTIVE.equals(status))
query.unfinished();
else if (STATUS_COMPLETED.equals(status))
query.finished();
query.processInstanceId(processId);
query.orderByExecutionId().asc();
List<HistoricActivityInstance> activities = query.listPage(paging.getSkipCount(), paging.getMaxItems());
List<Activity> page = new ArrayList<Activity>(activities.size());
for (HistoricActivityInstance activityInstance : activities) {
Activity activity = new Activity(activityInstance);
page.add(activity);
}
return CollectionWithPagingInfo.asPaged(paging, page, false, page.size());
}
Aggregations