Example usage for com.liferay.portal.kernel.dao.search SearchContainer getStart

List of usage examples for com.liferay.portal.kernel.dao.search SearchContainer getStart

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.search SearchContainer getStart.

Prototype

public int getStart() 

Source Link

Usage

From source file:com.liferay.alloy.mvc.BaseAlloyControllerImpl.java

License:Open Source License

protected AlloySearchResult search(Indexer indexer, AlloyServiceInvoker alloyServiceInvoker,
        HttpServletRequest request, PortletRequest portletRequest,
        SearchContainer<? extends BaseModel<?>> searchContainer, Map<String, Serializable> attributes,
        String keywords, Sort[] sorts) throws Exception {

    if (indexer == null) {
        throw new Exception("No indexer found for " + controllerPath);
    }/*ww  w . j a va 2s  .  c  om*/

    AlloySearchResult alloySearchResult = new AlloySearchResult();

    alloySearchResult.setAlloyServiceInvoker(alloyServiceInvoker);

    if (searchContainer == null) {
        searchContainer = new SearchContainer<BaseModel<?>>(portletRequest, portletURL, null, null);
    }

    SearchContext searchContext = SearchContextFactory.getInstance(request);

    boolean andOperator = ParamUtil.getBoolean(request, "andOperator");

    searchContext.setAndSearch(andOperator);

    if ((attributes != null) && !attributes.isEmpty()) {
        searchContext.setAttributes(attributes);
    }

    searchContext.setEnd(searchContainer.getEnd());

    Class<?> indexerClass = Class.forName(indexer.getClassNames()[0]);

    if (!GroupedModel.class.isAssignableFrom(indexerClass)) {
        searchContext.setGroupIds(null);
    } else if (searchContext.getAttribute(Field.GROUP_ID) != null) {
        long groupId = GetterUtil.getLong(searchContext.getAttribute(Field.GROUP_ID));

        searchContext.setGroupIds(new long[] { groupId });
    }

    if (Validator.isNotNull(keywords)) {
        searchContext.setKeywords(keywords);
    }

    if (ArrayUtil.isNotEmpty(sorts)) {
        searchContext.setSorts(sorts);
    }

    searchContext.setStart(searchContainer.getStart());

    Hits hits = indexer.search(searchContext);

    alloySearchResult.setHits(hits);

    alloySearchResult.setPortletURL(portletURL, searchContext.getAttributes());

    alloySearchResult.afterPropertiesSet();

    return alloySearchResult;
}

From source file:com.liferay.asset.categories.admin.web.internal.display.context.AssetCategoriesDisplayContext.java

License:Open Source License

public SearchContainer getCategoriesSearchContainer() throws PortalException {

    if (_categoriesSearchContainer != null) {
        return _categoriesSearchContainer;
    }/*w  ww. j  a  v a2 s.  co  m*/

    SearchContainer categoriesSearchContainer = new SearchContainer(_renderRequest, getIteratorURL(), null,
            "there-are-no-categories");

    if (Validator.isNull(getKeywords())) {
        if (isShowCategoriesAddButton()) {
            categoriesSearchContainer
                    .setEmptyResultsMessageCssClass("there-are-no-categories.-you-can-add-a-category-by-"
                            + "clicking-the-plus-button-on-the-bottom-right-corner");
            categoriesSearchContainer
                    .setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn");
        }
    } else {
        categoriesSearchContainer.setSearch(true);
    }

    categoriesSearchContainer.setOrderByCol(getOrderByCol());

    boolean orderByAsc = false;

    String orderByType = getOrderByType();

    if (orderByType.equals("asc")) {
        orderByAsc = true;
    }

    OrderByComparator<AssetCategory> orderByComparator = new AssetCategoryCreateDateComparator(orderByAsc);

    categoriesSearchContainer.setOrderByComparator(orderByComparator);

    categoriesSearchContainer.setOrderByType(orderByType);

    EmptyOnClickRowChecker emptyOnClickRowChecker = new EmptyOnClickRowChecker(_renderResponse);

    StringBundler sb = new StringBundler(7);

    sb.append("^(?!.*");
    sb.append(_renderResponse.getNamespace());
    sb.append("redirect).*(/vocabulary/");
    sb.append(getVocabularyId());
    sb.append("/category/");
    sb.append(getCategoryId());
    sb.append(")");

    emptyOnClickRowChecker.setRememberCheckBoxStateURLRegex(sb.toString());

    categoriesSearchContainer.setRowChecker(emptyOnClickRowChecker);

    List<AssetCategory> categories = null;
    int categoriesCount = 0;

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    long scopeGroupId = themeDisplay.getScopeGroupId();

    if (Validator.isNotNull(getKeywords())) {
        AssetCategoryDisplay assetCategoryDisplay = null;

        Sort sort = null;

        if (isFlattenedNavigationAllowed()) {
            sort = new Sort("leftCategoryId", Sort.INT_TYPE, orderByAsc);
        } else {
            sort = new Sort("createDate", Sort.LONG_TYPE, orderByAsc);
        }

        assetCategoryDisplay = AssetCategoryServiceUtil.searchCategoriesDisplay(new long[] { scopeGroupId },
                getKeywords(), new long[] { getVocabularyId() }, new long[0],
                categoriesSearchContainer.getStart(), categoriesSearchContainer.getEnd(), sort);

        categoriesCount = assetCategoryDisplay.getTotal();

        categoriesSearchContainer.setTotal(categoriesCount);

        categories = assetCategoryDisplay.getCategories();
    } else if (isFlattenedNavigationAllowed()) {
        AssetCategory category = getCategory();

        if (Validator.isNull(category)) {
            categoriesCount = AssetCategoryServiceUtil
                    .getVocabularyCategoriesCount(themeDisplay.getScopeGroupId(), getVocabularyId());

            categories = AssetCategoryServiceUtil.getVocabularyCategories(getVocabularyId(),
                    categoriesSearchContainer.getStart(), categoriesSearchContainer.getEnd(),
                    new AssetCategoryLeftCategoryIdComparator(orderByAsc));
        } else {
            categoriesCount = AssetCategoryServiceUtil.getVocabularyCategoriesCount(
                    themeDisplay.getScopeGroupId(), category.getCategoryId(), getVocabularyId());

            categories = AssetCategoryServiceUtil.getVocabularyCategories(category.getCategoryId(),
                    getVocabularyId(), categoriesSearchContainer.getStart(), categoriesSearchContainer.getEnd(),
                    new AssetCategoryLeftCategoryIdComparator(orderByAsc));
        }

        categoriesSearchContainer.setTotal(categoriesCount);
    } else {
        categoriesCount = AssetCategoryServiceUtil.getVocabularyCategoriesCount(scopeGroupId, getCategoryId(),
                getVocabularyId());

        categoriesSearchContainer.setTotal(categoriesCount);

        categories = AssetCategoryServiceUtil.getVocabularyCategories(scopeGroupId, getCategoryId(),
                getVocabularyId(), categoriesSearchContainer.getStart(), categoriesSearchContainer.getEnd(),
                categoriesSearchContainer.getOrderByComparator());
    }

    categoriesSearchContainer.setResults(categories);

    _categoriesSearchContainer = categoriesSearchContainer;

    return _categoriesSearchContainer;
}

From source file:com.liferay.asset.categories.admin.web.internal.display.context.AssetCategoriesDisplayContext.java

License:Open Source License

public SearchContainer getVocabulariesSearchContainer() throws PortalException {

    if (_vocabulariesSearchContainer != null) {
        return _vocabulariesSearchContainer;
    }//  w w w . ja v  a 2s. co  m

    SearchContainer vocabulariesSearchContainer = new SearchContainer(_renderRequest,
            _renderResponse.createRenderURL(), null, "there-are-no-vocabularies");

    String keywords = getKeywords();

    if (Validator.isNull(keywords)) {
        if (isShowVocabulariesAddButton()) {
            vocabulariesSearchContainer
                    .setEmptyResultsMessage("there-are-no-vocabularies.-you-can-add-a-vocabulary-by-"
                            + "clicking-the-plus-button-on-the-bottom-right-corner");
            vocabulariesSearchContainer
                    .setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn");
        }
    } else {
        vocabulariesSearchContainer.setSearch(true);
    }

    vocabulariesSearchContainer.setOrderByCol(getOrderByCol());

    String orderByType = getOrderByType();

    boolean orderByAsc = false;

    if (orderByType.equals("asc")) {
        orderByAsc = true;
    }

    OrderByComparator<AssetVocabulary> orderByComparator = new AssetVocabularyCreateDateComparator(orderByAsc);

    vocabulariesSearchContainer.setOrderByComparator(orderByComparator);

    vocabulariesSearchContainer.setOrderByType(orderByType);

    EmptyOnClickRowChecker emptyOnClickRowChecker = new EmptyOnClickRowChecker(_renderResponse);

    StringBundler sb = new StringBundler(5);

    sb.append("^(?!.*");
    sb.append(_renderResponse.getNamespace());
    sb.append("redirect).*(/vocabulary/");
    sb.append(getVocabularyId());
    sb.append(")");

    emptyOnClickRowChecker.setRememberCheckBoxStateURLRegex(sb.toString());

    vocabulariesSearchContainer.setRowChecker(emptyOnClickRowChecker);

    List<AssetVocabulary> vocabularies = null;
    int vocabulariesCount = 0;

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    long scopeGroupId = themeDisplay.getScopeGroupId();

    if (Validator.isNotNull(keywords)) {
        Sort sort = new Sort("createDate", Sort.LONG_TYPE, orderByAsc);

        AssetVocabularyDisplay assetVocabularyDisplay = AssetVocabularyServiceUtil.searchVocabulariesDisplay(
                scopeGroupId, keywords, true, vocabulariesSearchContainer.getStart(),
                vocabulariesSearchContainer.getEnd(), sort);

        vocabulariesCount = assetVocabularyDisplay.getTotal();

        vocabulariesSearchContainer.setTotal(vocabulariesCount);

        vocabularies = assetVocabularyDisplay.getVocabularies();
    } else {
        vocabulariesCount = AssetVocabularyServiceUtil.getGroupVocabulariesCount(scopeGroupId);

        vocabulariesSearchContainer.setTotal(vocabulariesCount);

        vocabularies = AssetVocabularyServiceUtil.getGroupVocabularies(scopeGroupId, true,
                vocabulariesSearchContainer.getStart(), vocabulariesSearchContainer.getEnd(),
                vocabulariesSearchContainer.getOrderByComparator());

        if (vocabulariesCount == 0) {
            vocabulariesCount = AssetVocabularyServiceUtil.getGroupVocabulariesCount(scopeGroupId);

            vocabulariesSearchContainer.setTotal(vocabulariesCount);
        }
    }

    vocabulariesSearchContainer.setResults(vocabularies);

    _vocabulariesSearchContainer = vocabulariesSearchContainer;

    return _vocabulariesSearchContainer;
}

From source file:com.liferay.asset.display.template.web.internal.display.context.AssetDisplayTemplateDisplayContext.java

License:Open Source License

public SearchContainer getSearchContainer() throws PortalException {
    if (_searchContainer != null) {
        return _searchContainer;
    }//w  w  w.ja  va 2 s  .  co  m

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    SearchContainer searchContainer = new SearchContainer(_renderRequest, _renderResponse.createRenderURL(),
            null, "there-are-no-asset-display-templates");

    if (!isSearch()) {
        if (isShowAddButton()) {
            searchContainer.setEmptyResultsMessage("there-are-no-asset-display-templates-you-can-add-an-"
                    + "asset-display-template-by-clicking-plus-button-on-" + "the-bottom-right-corner");
            searchContainer.setEmptyResultsMessageCssClass("taglib-empty-result-message-header-has-plus-btn");
        }
    } else {
        searchContainer.setSearch(true);
    }

    searchContainer.setRowChecker(new EmptyOnClickRowChecker(_renderResponse));
    searchContainer.setOrderByCol(getOrderByCol());

    OrderByComparator<AssetDisplayTemplate> orderByComparator = _getOrderByComparator(getOrderByCol(),
            getOrderByType());

    searchContainer.setOrderByComparator(orderByComparator);

    searchContainer.setOrderByType(getOrderByType());

    int assetDisplayTemplatesCount = 0;
    List<AssetDisplayTemplate> assetDisplayTemplates = null;

    if (isSearch()) {
        assetDisplayTemplatesCount = AssetDisplayTemplateLocalServiceUtil
                .getAssetDisplayTemplatesCount(themeDisplay.getScopeGroupId(), getKeywords());

        assetDisplayTemplates = AssetDisplayTemplateLocalServiceUtil.getAssetDisplayTemplates(
                themeDisplay.getScopeGroupId(), getKeywords(), searchContainer.getStart(),
                searchContainer.getEnd(), orderByComparator);
    } else {
        assetDisplayTemplatesCount = AssetDisplayTemplateLocalServiceUtil
                .getAssetDisplayTemplatesCount(themeDisplay.getScopeGroupId());

        assetDisplayTemplates = AssetDisplayTemplateLocalServiceUtil.getAssetDisplayTemplates(
                themeDisplay.getScopeGroupId(), searchContainer.getStart(), searchContainer.getEnd(),
                orderByComparator);
    }

    searchContainer.setTotal(assetDisplayTemplatesCount);
    searchContainer.setResults(assetDisplayTemplates);

    _searchContainer = searchContainer;

    return _searchContainer;
}

From source file:com.liferay.asset.publisher.internal.util.AssetPublisherHelperImpl.java

License:Open Source License

private List<AssetEntryResult> _getAssetEntryResultsByClassName(SearchContainer searchContainer,
        AssetEntryQuery assetEntryQuery, Layout layout, PortletPreferences portletPreferences,
        String portletName, Locale locale, TimeZone timeZone, long companyId, long scopeGroupId, long userId,
        long[] classNameIds, Map<String, Serializable> attributes) throws Exception {

    List<AssetEntryResult> assetEntryResults = new ArrayList<>();

    int end = searchContainer.getEnd();
    int start = searchContainer.getStart();

    int total = 0;

    for (long classNameId : classNameIds) {
        assetEntryQuery.setClassNameIds(new long[] { classNameId });

        BaseModelSearchResult<AssetEntry> baseModelSearchResult = getAssetEntries(assetEntryQuery, layout,
                portletPreferences, portletName, locale, timeZone, companyId, scopeGroupId, userId, attributes,
                start, end);//from   w w w . j  ava 2  s.  c  o m

        int groupTotal = baseModelSearchResult.getLength();

        total += groupTotal;

        List<AssetEntry> assetEntries = baseModelSearchResult.getBaseModels();

        if (!assetEntries.isEmpty() && (start < groupTotal)) {
            AssetRendererFactory<?> groupAssetRendererFactory = AssetRendererFactoryRegistryUtil
                    .getAssetRendererFactoryByClassNameId(classNameId);

            String title = ResourceActionsUtil.getModelResource(locale,
                    groupAssetRendererFactory.getClassName());

            assetEntryResults.add(new AssetEntryResult(title, assetEntries));
        }

        if (!portletName.equals(AssetPublisherPortletKeys.RECENT_CONTENT)) {
            if (groupTotal > 0) {
                if ((end > 0) && (end > groupTotal)) {
                    end -= groupTotal;
                } else {
                    end = 0;
                }

                if ((start > 0) && (start > groupTotal)) {
                    start -= groupTotal;
                } else {
                    start = 0;
                }
            }

            assetEntryQuery.setEnd(QueryUtil.ALL_POS);
            assetEntryQuery.setStart(QueryUtil.ALL_POS);
        }
    }

    searchContainer.setTotal(total);

    return assetEntryResults;
}

From source file:com.liferay.asset.publisher.internal.util.AssetPublisherHelperImpl.java

License:Open Source License

private List<AssetEntryResult> _getAssetEntryResultsByDefault(SearchContainer searchContainer,
        AssetEntryQuery assetEntryQuery, Layout layout, PortletPreferences portletPreferences,
        String portletName, Locale locale, TimeZone timeZone, long companyId, long scopeGroupId, long userId,
        long[] classNameIds, Map<String, Serializable> attributes) throws Exception {

    List<AssetEntryResult> assetEntryResults = new ArrayList<>();

    int end = searchContainer.getEnd();
    int start = searchContainer.getStart();

    assetEntryQuery.setClassNameIds(classNameIds);

    BaseModelSearchResult<AssetEntry> baseModelSearchResult = getAssetEntries(assetEntryQuery, layout,
            portletPreferences, portletName, locale, timeZone, companyId, scopeGroupId, userId, attributes,
            start, end);/* w  w  w .  j a v a  2s.  c o  m*/

    int total = baseModelSearchResult.getLength();

    searchContainer.setTotal(total);

    List<AssetEntry> assetEntries = baseModelSearchResult.getBaseModels();

    if (!assetEntries.isEmpty() && (start < total)) {
        assetEntryResults.add(new AssetEntryResult(assetEntries));
    }

    return assetEntryResults;
}

From source file:com.liferay.asset.publisher.internal.util.AssetPublisherHelperImpl.java

License:Open Source License

private List<AssetEntryResult> _getAssetEntryResultsByVocabulary(SearchContainer searchContainer,
        AssetEntryQuery assetEntryQuery, Layout layout, PortletPreferences portletPreferences,
        String portletName, Locale locale, TimeZone timeZone, long companyId, long scopeGroupId, long userId,
        long[] classNameIds, long assetVocabularyId, Map<String, Serializable> attributes) throws Exception {

    List<AssetEntryResult> assetEntryResults = new ArrayList<>();

    List<AssetCategory> assetCategories = _assetCategoryLocalService
            .getVocabularyRootCategories(assetVocabularyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    assetEntryQuery.setClassNameIds(classNameIds);

    int end = searchContainer.getEnd();
    int start = searchContainer.getStart();

    int total = 0;

    for (AssetCategory assetCategory : assetCategories) {
        long[] oldAllCategoryIds = assetEntryQuery.getAllCategoryIds();

        long[] newAllAssetCategoryIds = ArrayUtil.append(oldAllCategoryIds, assetCategory.getCategoryId());

        assetEntryQuery.setAllCategoryIds(newAllAssetCategoryIds);

        BaseModelSearchResult<AssetEntry> baseModelSearchResult = getAssetEntries(assetEntryQuery, layout,
                portletPreferences, portletName, locale, timeZone, companyId, scopeGroupId, userId, attributes,
                start, end);//from  w w  w .  j a v  a2s.co m

        int groupTotal = baseModelSearchResult.getLength();

        total += groupTotal;

        List<AssetEntry> assetEntries = baseModelSearchResult.getBaseModels();

        if (!assetEntries.isEmpty() && (start < groupTotal)) {
            String title = assetCategory.getTitle(locale);

            assetEntryResults.add(new AssetEntryResult(title, assetEntries));
        }

        if (groupTotal > 0) {
            if ((end > 0) && (end > groupTotal)) {
                end -= groupTotal;
            } else {
                end = 0;
            }

            if ((start > 0) && (start > groupTotal)) {
                start -= groupTotal;
            } else {
                start = 0;
            }
        }

        assetEntryQuery.setAllCategoryIds(oldAllCategoryIds);
        assetEntryQuery.setEnd(QueryUtil.ALL_POS);
        assetEntryQuery.setStart(QueryUtil.ALL_POS);
    }

    searchContainer.setTotal(total);

    return assetEntryResults;
}

From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java

License:Open Source License

protected static List<AssetEntryResult> getAssetEntryResultsByClassName(SearchContainer searchContainer,
        AssetEntryQuery assetEntryQuery, Layout layout, PortletPreferences portletPreferences,
        String portletName, Locale locale, TimeZone timeZone, long companyId, long scopeGroupId, long userId,
        long[] classNameIds, Map<String, Serializable> attributes) throws Exception {

    List<AssetEntryResult> assetEntryResults = new ArrayList<>();

    int end = searchContainer.getEnd();
    int start = searchContainer.getStart();

    int total = 0;

    for (long classNameId : classNameIds) {
        assetEntryQuery.setClassNameIds(new long[] { classNameId });

        BaseModelSearchResult<AssetEntry> baseModelSearchResult = getAssetEntries(assetEntryQuery, layout,
                portletPreferences, portletName, locale, timeZone, companyId, scopeGroupId, userId, attributes,
                start, end);//from  w  w  w.ja v a  2  s. co m

        int groupTotal = baseModelSearchResult.getLength();

        total += groupTotal;

        List<AssetEntry> assetEntries = baseModelSearchResult.getBaseModels();

        if (!assetEntries.isEmpty() && (start < groupTotal)) {
            AssetRendererFactory<?> groupAssetRendererFactory = AssetRendererFactoryRegistryUtil
                    .getAssetRendererFactoryByClassNameId(classNameId);

            String title = ResourceActionsUtil.getModelResource(locale,
                    groupAssetRendererFactory.getClassName());

            assetEntryResults.add(new AssetEntryResult(title, assetEntries));
        }

        if (!portletName.equals(AssetPublisherPortletKeys.RECENT_CONTENT)) {
            if (groupTotal > 0) {
                if ((end > 0) && (end > groupTotal)) {
                    end -= groupTotal;
                } else {
                    end = 0;
                }

                if ((start > 0) && (start > groupTotal)) {
                    start -= groupTotal;
                } else {
                    start = 0;
                }
            }

            assetEntryQuery.setEnd(QueryUtil.ALL_POS);
            assetEntryQuery.setStart(QueryUtil.ALL_POS);
        }
    }

    searchContainer.setTotal(total);

    return assetEntryResults;
}

From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java

License:Open Source License

protected static List<AssetEntryResult> getAssetEntryResultsByDefault(SearchContainer searchContainer,
        AssetEntryQuery assetEntryQuery, Layout layout, PortletPreferences portletPreferences,
        String portletName, Locale locale, TimeZone timeZone, long companyId, long scopeGroupId, long userId,
        long[] classNameIds, Map<String, Serializable> attributes) throws Exception {

    List<AssetEntryResult> assetEntryResults = new ArrayList<>();

    int end = searchContainer.getEnd();
    int start = searchContainer.getStart();

    assetEntryQuery.setClassNameIds(classNameIds);

    BaseModelSearchResult<AssetEntry> baseModelSearchResult = getAssetEntries(assetEntryQuery, layout,
            portletPreferences, portletName, locale, timeZone, companyId, scopeGroupId, userId, attributes,
            start, end);/*from  w ww.  ja  v a 2s .  c o m*/

    int total = baseModelSearchResult.getLength();

    searchContainer.setTotal(total);

    List<AssetEntry> assetEntries = baseModelSearchResult.getBaseModels();

    if (!assetEntries.isEmpty() && (start < total)) {
        assetEntryResults.add(new AssetEntryResult(assetEntries));
    }

    return assetEntryResults;
}

From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java

License:Open Source License

protected static List<AssetEntryResult> getAssetEntryResultsByVocabulary(SearchContainer searchContainer,
        AssetEntryQuery assetEntryQuery, Layout layout, PortletPreferences portletPreferences,
        String portletName, Locale locale, TimeZone timeZone, long companyId, long scopeGroupId, long userId,
        long[] classNameIds, long assetVocabularyId, Map<String, Serializable> attributes) throws Exception {

    List<AssetEntryResult> assetEntryResults = new ArrayList<>();

    List<AssetCategory> assetCategories = _assetCategoryLocalService
            .getVocabularyRootCategories(assetVocabularyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    assetEntryQuery.setClassNameIds(classNameIds);

    int end = searchContainer.getEnd();
    int start = searchContainer.getStart();

    int total = 0;

    for (AssetCategory assetCategory : assetCategories) {
        long[] oldAllCategoryIds = assetEntryQuery.getAllCategoryIds();

        long[] newAllAssetCategoryIds = ArrayUtil.append(oldAllCategoryIds, assetCategory.getCategoryId());

        assetEntryQuery.setAllCategoryIds(newAllAssetCategoryIds);

        BaseModelSearchResult<AssetEntry> baseModelSearchResult = getAssetEntries(assetEntryQuery, layout,
                portletPreferences, portletName, locale, timeZone, companyId, scopeGroupId, userId, attributes,
                start, end);//from  ww w .ja v a 2s.  c  o m

        int groupTotal = baseModelSearchResult.getLength();

        total += groupTotal;

        List<AssetEntry> assetEntries = baseModelSearchResult.getBaseModels();

        if (!assetEntries.isEmpty() && (start < groupTotal)) {
            String title = assetCategory.getTitle(locale);

            assetEntryResults.add(new AssetEntryResult(title, assetEntries));
        }

        if (groupTotal > 0) {
            if ((end > 0) && (end > groupTotal)) {
                end -= groupTotal;
            } else {
                end = 0;
            }

            if ((start > 0) && (start > groupTotal)) {
                start -= groupTotal;
            } else {
                start = 0;
            }
        }

        assetEntryQuery.setAllCategoryIds(oldAllCategoryIds);
        assetEntryQuery.setEnd(QueryUtil.ALL_POS);
        assetEntryQuery.setStart(QueryUtil.ALL_POS);
    }

    searchContainer.setTotal(total);

    return assetEntryResults;
}