Search in sources :

Example 1 with GetCollectionItemsResult

use of edu.stanford.bmir.protege.web.shared.collection.GetCollectionItemsResult in project webprotege by protegeproject.

the class GetCollectionItemsActionHandler method execute.

@Nonnull
@Override
public GetCollectionItemsResult execute(@Nonnull GetCollectionItemsAction action, @Nonnull ExecutionContext executionContext) {
    PageRequest pageRequest = action.getPageRequest();
    List<CollectionItem> elementIdList = repository.list(action.getCollectionId(), pageRequest.getSkip(), pageRequest.getPageSize());
    long totalItemsCount = repository.count(action.getCollectionId());
    int pageCount = (int) (totalItemsCount / pageRequest.getPageSize()) + 1;
    return new GetCollectionItemsResult(new Page<>(pageRequest.getPageNumber(), pageCount, elementIdList, elementIdList.size()), pageRequest);
}
Also used : PageRequest(edu.stanford.bmir.protege.web.shared.pagination.PageRequest) GetCollectionItemsResult(edu.stanford.bmir.protege.web.shared.collection.GetCollectionItemsResult) CollectionItem(edu.stanford.bmir.protege.web.shared.collection.CollectionItem) Nonnull(javax.annotation.Nonnull)

Aggregations

CollectionItem (edu.stanford.bmir.protege.web.shared.collection.CollectionItem)1 GetCollectionItemsResult (edu.stanford.bmir.protege.web.shared.collection.GetCollectionItemsResult)1 PageRequest (edu.stanford.bmir.protege.web.shared.pagination.PageRequest)1 Nonnull (javax.annotation.Nonnull)1