Example usage for com.liferay.portal.kernel.dao.search SearchPaginationUtil calculateStartAndEnd

List of usage examples for com.liferay.portal.kernel.dao.search SearchPaginationUtil calculateStartAndEnd

Introduction

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

Prototype

public static int[] calculateStartAndEnd(int cur, int delta) 

Source Link

Usage

From source file:com.liferay.item.selector.taglib.servlet.taglib.GroupSelectorTag.java

License:Open Source License

protected List<Group> getGroups(HttpServletRequest request) {
    if (_groups != null) {
        return _groups;
    }/*from  ww w.  ja v a2 s  .  c  o m*/

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

    String keywords = ParamUtil.getString(request, "keywords");

    LinkedHashMap<String, Object> groupParams = new LinkedHashMap<>();

    groupParams.put("site", Boolean.TRUE);

    int cur = ParamUtil.getInteger(request, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_CUR);
    int delta = ParamUtil.getInteger(request, SearchContainer.DEFAULT_DELTA_PARAM,
            SearchContainer.DEFAULT_DELTA);

    int[] startAndEnd = SearchPaginationUtil.calculateStartAndEnd(cur, delta);

    return GroupLocalServiceUtil.search(themeDisplay.getCompanyId(), _CLASS_NAME_IDS, keywords, groupParams,
            startAndEnd[0], startAndEnd[1], null);
}