public static List<AssetEntry> getAssetEntries( long[] groupIds, long[] classNameIds, long[] assetTagIds, long resourcePrimKey, int start, int end, String orderByColumn) throws PortalException { AssetEntryQuery assetEntryQuery = new AssetEntryQuery(); assetEntryQuery.setAnyTagIds(assetTagIds); assetEntryQuery.setClassNameIds(classNameIds); assetEntryQuery.setEnd(end + 1); assetEntryQuery.setGroupIds(groupIds); assetEntryQuery.setOrderByCol1(orderByColumn); assetEntryQuery.setStart(start); List<AssetEntry> assetEntries = ListUtil.copy(AssetEntryServiceUtil.getEntries(assetEntryQuery)); AssetEntry assetEntry = null; for (AssetEntry curAssetEntry : assetEntries) { if (curAssetEntry.getClassPK() == resourcePrimKey) { assetEntry = curAssetEntry; } } assetEntries.remove(assetEntry); return ListUtil.subList(assetEntries, 0, 10); }
public static List<SchedulerJobBean> subList( List<SchedulerJobBean> list, Integer start, Integer end) { if (list != null) { return ListUtil.subList(list, start, end); } else { return new ArrayList<SchedulerJobBean>(); } }
private <T, V extends T> List<T> _subList( List<V> list, int start, int end, OrderByComparator<T> obc) { if (obc != null) { list = ListUtil.sort(list, obc); } return (List<T>) ListUtil.toList(ListUtil.subList(list, start, end)); }
protected List<TaskInstance> getTasksInstancesBySubmittingUser( long companyId, long userId, Boolean completed, int start, int end, OrderByComparator orderByComparator) { List<TaskInstance> taskInstances = new ArrayList<TaskInstance>(); try { Criteria criteria = _session.createCriteria(TaskInstance.class); criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); if (completed != null) { if (completed.booleanValue()) { criteria.add(Restrictions.isNotNull("end")); } else { criteria.add(Restrictions.isNull("end")); } } addOrder(criteria, orderByComparator); for (TaskInstance taskInstance : (List<TaskInstance>) criteria.list()) { ProcessInstance processInstance = taskInstance.getProcessInstance(); ContextInstance contextInstance = processInstance.getContextInstance(); long taskInstanceUserId = GetterUtil.getLong((String) contextInstance.getVariable("userId")); if (userId == taskInstanceUserId) { taskInstances.add(taskInstance); } } } catch (Exception e) { throw new JbpmException(e); } if ((end != QueryUtil.ALL_POS) && (taskInstances.size() > end)) { taskInstances = ListUtil.subList(taskInstances, start, end); } return taskInstances; }
@Override public List<Tuple> getClassTypeFieldNames(long classTypeId, Locale locale, int start, int end) throws Exception { List<Tuple> classTypeFieldNames = new ArrayList<Tuple>(); DLFileEntryType dlFileEntryType = DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classTypeId); List<DDMStructure> ddmStructures = dlFileEntryType.getDDMStructures(); for (DDMStructure ddmStructure : ddmStructures) { classTypeFieldNames.addAll(getDDMStructureFieldNames(ddmStructure, locale)); } return ListUtil.subList(classTypeFieldNames, start, end); }
public GroupSearch getGroupSearch(PortletRequest portletRequest, PortletURL portletURL) throws PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); GroupSearch groupSearch = new GroupSearch(portletRequest, portletURL); GroupSearchTerms searchTerms = (GroupSearchTerms) groupSearch.getSearchTerms(); if (!searchTerms.isSearch()) { groupSearch.setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn"); } else { groupSearch.setSearch(true); } long parentGroupId = getParentGroupId(portletRequest); Company company = themeDisplay.getCompany(); List results = null; if (!searchTerms.hasSearchTerms() && isFilterManageableGroups(portletRequest) && (parentGroupId <= 0)) { List<Group> groups = getAllGroups(portletRequest); groupSearch.setTotal(groups.size()); results = ListUtil.subList(groups, groupSearch.getStart(), groupSearch.getEnd()); } else if (searchTerms.hasSearchTerms()) { int total = _groupLocalService.searchCount( company.getCompanyId(), _classNameIds, searchTerms.getKeywords(), getGroupParams(portletRequest, searchTerms, parentGroupId)); groupSearch.setTotal(total); results = _groupLocalService.search( company.getCompanyId(), _classNameIds, searchTerms.getKeywords(), getGroupParams(portletRequest, searchTerms, parentGroupId), groupSearch.getStart(), groupSearch.getEnd(), groupSearch.getOrderByComparator()); } else { long groupId = ParamUtil.getLong(portletRequest, "groupId", GroupConstants.DEFAULT_PARENT_GROUP_ID); int total = _groupLocalService.searchCount( company.getCompanyId(), _classNameIds, groupId, searchTerms.getKeywords(), getGroupParams(portletRequest, searchTerms, parentGroupId)); groupSearch.setTotal(total); results = _groupLocalService.search( company.getCompanyId(), _classNameIds, groupId, searchTerms.getKeywords(), getGroupParams(portletRequest, searchTerms, parentGroupId), groupSearch.getStart(), groupSearch.getEnd(), groupSearch.getOrderByComparator()); } groupSearch.setResults(results); return groupSearch; }
public List<ConfigurationModel> getResults(int start, int end) { return ListUtil.subList(_configurationModels, start, end); }