page = new ListPage<ProcessDefinition>();
ProcessDefinitionQuery query = repositoryService
.createProcessDefinitionQuery().latestVersion();
OrderBy orderBy = page.getOrderBy();
if( orderBy != null ){
if( "name".equals(orderBy.getProperty()) )
query.orderByProcessDefinitionName();
else if( "key".equals(orderBy.getProperty()) )
query.orderByProcessDefinitionKey();
else if( "id".equals(orderBy.getProperty()) )
query.orderByProcessDefinitionId();
else if( "category".equals(orderBy.getProperty()) )
query.orderByProcessDefinitionCategory();
else if( "version".equals(orderBy.getProperty()) )
query.orderByProcessDefinitionVersion();
else if( "deploymentId".equals(orderBy.getProperty()) )
query.orderByDeploymentId();
}
return (ListPage<ProcessDefinition>)query(query,page);
}