Search in sources :

Example 1 with PagedResult

use of com.epam.pipeline.controller.PagedResult in project cloud-pipeline by epam.

the class PipelineRunManager method loadActiveServices.

/**
 * Method that will return all active runs for which current users is owner or is listed in run sids - a list of
 * identities (user names or groups) that have access to run
 * @param filter - filter containing a page and page size
 * @return list of active runs which available for current user
 */
@Transactional(propagation = Propagation.SUPPORTS)
public PagedResult<List<PipelineRun>> loadActiveServices(PagingRunFilterVO filter) {
    Assert.isTrue(filter.getPage() > 0, messageHelper.getMessage(MessageConstants.ERROR_PAGE_INDEX));
    Assert.isTrue(filter.getPageSize() > 0, messageHelper.getMessage(MessageConstants.ERROR_PAGE_SIZE));
    PipelineUser user = authManager.getCurrentUser();
    List<PipelineRun> runs = pipelineRunDao.loadActiveServices(filter, user);
    int count = pipelineRunDao.countActiveServices(user);
    return new PagedResult<>(runs, count);
}
Also used : PipelineRun(com.epam.pipeline.entity.pipeline.PipelineRun) PipelineUser(com.epam.pipeline.entity.user.PipelineUser) PagedResult(com.epam.pipeline.controller.PagedResult) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PagedResult (com.epam.pipeline.controller.PagedResult)1 PipelineRun (com.epam.pipeline.entity.pipeline.PipelineRun)1 PipelineUser (com.epam.pipeline.entity.user.PipelineUser)1 Transactional (org.springframework.transaction.annotation.Transactional)1