List of usage examples for com.liferay.portal.atom AtomPager AtomPager
public AtomPager(int page, int elementsPerPage, int totalElements)
From source file:com.liferay.blogs.internal.atom.BlogsEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected Iterable<BlogsEntry> doGetFeedEntries(AtomRequestContext atomRequestContext) throws Exception { long groupId = atomRequestContext.getLongParameter("groupId"); int status = WorkflowConstants.STATUS_APPROVED; int max = atomRequestContext.getIntParameter("max", SearchContainer.DEFAULT_DELTA); if (groupId > 0) { int page = atomRequestContext.getIntParameter("page"); if (page == 0) { return _blogsEntryService.getGroupEntries(groupId, status, max); }//from w w w . java2 s . com int count = _blogsEntryService.getGroupEntriesCount(groupId, new Date(), status); AtomPager atomPager = new AtomPager(page, max, count); AtomUtil.saveAtomPagerInRequest(atomRequestContext, atomPager); return _blogsEntryService.getGroupEntries(groupId, new Date(), status, atomPager.getStart(), atomPager.getEnd() + 1); } long organizationId = atomRequestContext.getLongParameter("organizationId"); if (organizationId > 0) { return _blogsEntryService.getOrganizationEntries(organizationId, new Date(), status, max); } long companyId = CompanyThreadLocal.getCompanyId(); if (companyId > 0) { return _blogsEntryService.getCompanyEntries(companyId, new Date(), status, max); } return Collections.emptyList(); }
From source file:com.liferay.portlet.blogs.atom.BlogsEntryAtomCollectionAdapter.java
License:Open Source License
@Override protected Iterable<BlogsEntry> doGetFeedEntries(AtomRequestContext atomRequestContext) throws Exception { long groupId = atomRequestContext.getLongParameter("groupId"); int status = WorkflowConstants.STATUS_APPROVED; int max = atomRequestContext.getIntParameter("max", SearchContainer.DEFAULT_DELTA); if (groupId > 0) { int page = atomRequestContext.getIntParameter("page"); if (page == 0) { return BlogsEntryServiceUtil.getGroupEntries(groupId, status, max); }/*from w w w .ja va 2 s .c o m*/ int count = BlogsEntryServiceUtil.getGroupEntriesCount(groupId, new Date(), status); AtomPager atomPager = new AtomPager(page, max, count); AtomUtil.saveAtomPagerInRequest(atomRequestContext, atomPager); return BlogsEntryServiceUtil.getGroupEntries(groupId, new Date(), status, atomPager.getStart(), atomPager.getEnd() + 1); } long organizationId = atomRequestContext.getLongParameter("organizationId"); if (organizationId > 0) { return BlogsEntryServiceUtil.getOrganizationEntries(organizationId, new Date(), status, max); } long companyId = CompanyThreadLocal.getCompanyId(); if (companyId > 0) { return BlogsEntryServiceUtil.getCompanyEntries(companyId, new Date(), status, max); } return Collections.emptyList(); }