Search in sources :

Example 1 with PaginatedProcessInfoList

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PaginatedProcessInfoList in project carbon-business-process by wso2.

the class ProcessManagementServiceSkeleton method getPaginatedProcessList.

public PaginatedProcessInfoList getPaginatedProcessList(String processListFilter, String processListOrderByKey, int page) throws ProcessManagementException {
    int tPage = page;
    PaginatedProcessInfoList processList = new PaginatedProcessInfoList();
    TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
    if (tPage < 0 || tPage == Integer.MAX_VALUE) {
        tPage = 0;
    }
    Integer itemsPerPage = 10;
    Integer startIndexForCurrentPage = tPage * itemsPerPage;
    Integer endIndexForCurrentPage = (tPage + 1) * itemsPerPage;
    final ProcessFilter processFilter = new ProcessFilter(processListFilter, processListOrderByKey);
    Collection<ProcessConf> processListForCurrentPage = processQuery(processFilter, tenantProcessStore);
    Integer processListSize = processListForCurrentPage.size();
    Integer pages = (int) Math.ceil((double) processListSize / itemsPerPage);
    processList.setPages(pages);
    ProcessConf[] processConfigurations = processListForCurrentPage.toArray(new ProcessConf[processListSize]);
    for (int i = startIndexForCurrentPage; (i < endIndexForCurrentPage && i < processListSize); i++) {
        processList.addProcessInfo(AdminServiceUtils.createLimitedProcessInfoObject(processConfigurations[i]));
    }
    return processList;
}
Also used : ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) ProcessFilter(org.apache.ode.bpel.common.ProcessFilter) PaginatedProcessInfoList(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PaginatedProcessInfoList) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)

Aggregations

ProcessFilter (org.apache.ode.bpel.common.ProcessFilter)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)1 PaginatedProcessInfoList (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PaginatedProcessInfoList)1