List of usage examples for com.liferay.portal.kernel.dao.search SearchContainer DEFAULT_DELTA
int DEFAULT_DELTA
To view the source code for com.liferay.portal.kernel.dao.search SearchContainer DEFAULT_DELTA.
Click Source Link
From source file:com.liferay.faces.demos.bean.DocLibModelBean.java
License:Open Source License
public DocumentDataModel getDocumentDataModel(long nodeId) { DLFolder dlFolder = ((PrimefacesFolder) treeNodeListHm.get(nodeId).getData()).getDlFolder(); int rowsPerPage = liferayFacesContext.getPortletPreferenceAsInt("rowsPerPage", SearchContainer.DEFAULT_DELTA); ThemeDisplay themeDisplay = liferayFacesContext.getThemeDisplay(); String portalURL = themeDisplay.getPortalURL(); String pathContext = themeDisplay.getPathContext(); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); documentDataModel = new DocumentDataModel(dlFolder, rowsPerPage, portalURL, pathContext, permissionChecker); return documentDataModel; }
From source file:com.liferay.faces.demos.bean.UsersModelBean.java
License:Open Source License
public UserLazyDataModel getDataModel() { if (userDataModel == null) { LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance(); int rowsPerPage = liferayFacesContext.getPortletPreferenceAsInt("rowsPerPage", SearchContainer.DEFAULT_DELTA); userDataModel = new UserLazyDataModel(liferayFacesContext.getCompanyId(), rowsPerPage); }// w w w. j av a 2 s . c o m return userDataModel; }
From source file:com.liferay.flickr.item.selector.web.FlickrItemSelectorView.java
License:Open Source License
@Override public void renderHTML(ServletRequest request, ServletResponse response, ImageItemSelectorCriterion imageItemSelectorCriterion, PortletURL portletURL, String itemSelectedEventName, boolean search) throws IOException, ServletException { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); List<FlickrPhoto> flickrPhotos = new ArrayList<>(); PhotoList<Photo> photoList = null; int delta = GetterUtil.getInteger(request.getParameter(SearchContainer.DEFAULT_DELTA_PARAM), SearchContainer.DEFAULT_DELTA); int cur = GetterUtil.getInteger(request.getParameter(SearchContainer.DEFAULT_CUR_PARAM), SearchContainer.DEFAULT_CUR); Set<String> extras = new HashSet<>(); extras.add(Extras.OWNER_NAME);/*from w w w.jav a2 s . co m*/ Flickr flickr = new Flickr(_flickrItemSelectorConfiguration.apiKey(), _flickrItemSelectorConfiguration.sharedSecret(), new REST()); try { if (search) { String keywords = GetterUtil.getString(request.getParameter("keywords")); photoList = getSearchPhotoList(flickr, keywords, delta, cur); } else { photoList = getInterestingPhotoList(flickr, delta, cur); } populateFlickrPhotos(flickr, photoList, themeDisplay.getLocale(), flickrPhotos); } catch (FlickrException e) { e.printStackTrace(); } request.setAttribute("total", photoList.getTotal()); request.setAttribute("flickrPhotos", flickrPhotos); request.setAttribute("portletURL", portletURL); request.setAttribute("itemSelectedEventName", itemSelectedEventName); ServletContext servletContext = getServletContext(); RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher("/flickr.jsp"); requestDispatcher.include(request, response); }
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 w ww . ja v a2 s .c om*/ 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); }
From source file:com.liferay.journal.content.search.web.internal.display.context.JournalContentSearchDisplayContext.java
License:Open Source License
public SearchContainer getSearchContainer() throws Exception { if (_searchContainer != null) { return _searchContainer; }/* ww w .ja v a2 s. com*/ ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); PortletURL renderURL = _liferayPortletResponse.createRenderURL(); renderURL.setParameter("mvcPath", "/search.jsp"); renderURL.setParameter("keywords", getKeywords()); String originalKeywords = ParamUtil.getString(_request, "keywords", getKeywords()); _searchContainer = new SearchContainer(_liferayPortletRequest, null, null, SearchContainer.DEFAULT_CUR_PARAM, SearchContainer.DEFAULT_DELTA, renderURL, null, LanguageUtil.format(_request, "no-pages-were-found-that-matched-the-keywords-x", "<strong>" + HtmlUtil.escape(originalKeywords) + "</strong>", false)); Hits hits = getHits(); ContentHits contentHits = new ContentHits(); contentHits.setShowListed(_journalContentSearchPortletInstanceConfiguration.showListed()); contentHits.recordHits(hits, layout.getGroupId(), layout.isPrivateLayout(), _searchContainer.getStart(), _searchContainer.getEnd()); _searchContainer.setTotal(hits.getLength()); _searchContainer.setResults(ListUtil.toList(hits.getDocs())); return _searchContainer; }
From source file:com.liferay.message.boards.web.internal.portlet.action.RSSAction.java
License:Open Source License
@Override protected byte[] getRSS(HttpServletRequest request) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); long plid = ParamUtil.getLong(request, "p_l_id"); if (plid == LayoutConstants.DEFAULT_PLID) { plid = themeDisplay.getPlid();// w w w. j a va 2 s . c o m } long companyId = ParamUtil.getLong(request, "companyId"); long groupId = ParamUtil.getLong(request, "groupId"); long userId = ParamUtil.getLong(request, "userId"); long categoryId = ParamUtil.getLong(request, "mbCategoryId"); long threadId = ParamUtil.getLong(request, "threadId"); int max = ParamUtil.getInteger(request, "max", SearchContainer.DEFAULT_DELTA); String type = ParamUtil.getString(request, "type", RSSUtil.FORMAT_DEFAULT); double version = ParamUtil.getDouble(request, "version", RSSUtil.VERSION_DEFAULT); String displayStyle = ParamUtil.getString(request, "displayStyle", RSSUtil.DISPLAY_STYLE_DEFAULT); String entryURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_message?p_l_id=" + plid; String rss = StringPool.BLANK; if (companyId > 0) { String feedURL = StringPool.BLANK; rss = _mbMessageService.getCompanyMessagesRSS(companyId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else if (groupId > 0) { String mvcRenderCommandName = ParamUtil.getString(request, "mvcRenderCommandName"); String feedURL = null; if (mvcRenderCommandName.equals("/message_boards/view_recent_posts")) { feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_recent_posts?p_l_id=" + plid; } else { feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_category?p_l_id=" + plid + "&mbCategoryId=" + categoryId; } if (userId > 0) { rss = _mbMessageService.getGroupMessagesRSS(groupId, userId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else { rss = _mbMessageService.getGroupMessagesRSS(groupId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } } else if (categoryId > 0) { String feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_category?p_l_id=" + plid + "&mbCategoryId=" + categoryId; rss = _mbMessageService.getCategoryMessagesRSS(groupId, categoryId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else if (threadId > 0) { String feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_thread?p_l_id=" + plid + "&threadId=" + threadId; rss = _mbMessageService.getThreadMessagesRSS(threadId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } return rss.getBytes(StringPool.UTF8); }
From source file:com.liferay.portlet.blogs.action.RSSAction.java
License:Open Source License
protected byte[] getRSS(HttpServletRequest request) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); long plid = ParamUtil.getLong(request, "p_l_id"); long companyId = ParamUtil.getLong(request, "companyId"); long groupId = ParamUtil.getLong(request, "groupId"); long organizationId = ParamUtil.getLong(request, "organizationId"); int status = WorkflowConstants.STATUS_APPROVED; int max = ParamUtil.getInteger(request, "max", SearchContainer.DEFAULT_DELTA); String type = ParamUtil.getString(request, "type", RSSUtil.TYPE_DEFAULT); double version = ParamUtil.getDouble(request, "version", RSSUtil.VERSION_DEFAULT); String displayStyle = ParamUtil.getString(request, "displayStyle", RSSUtil.DISPLAY_STYLE_FULL_CONTENT); String feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/blogs/find_entry?"; String entryURL = feedURL;/* w w w .j av a 2 s. co m*/ String rss = StringPool.BLANK; if (companyId > 0) { feedURL = StringPool.BLANK; rss = BlogsEntryServiceUtil.getCompanyEntriesRSS(companyId, new Date(), status, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else if (groupId > 0) { feedURL += "p_l_id=" + plid; entryURL = feedURL; rss = BlogsEntryServiceUtil.getGroupEntriesRSS(groupId, new Date(), status, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else if (organizationId > 0) { feedURL = StringPool.BLANK; rss = BlogsEntryServiceUtil.getOrganizationEntriesRSS(organizationId, new Date(), status, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else if (layout != null) { groupId = themeDisplay.getScopeGroupId(); feedURL = PortalUtil.getLayoutFullURL(themeDisplay) + Portal.FRIENDLY_URL_SEPARATOR + "blogs/rss"; entryURL = feedURL; rss = BlogsEntryServiceUtil.getGroupEntriesRSS(groupId, new Date(), status, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } return rss.getBytes(StringPool.UTF8); }
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); }// www. j a v a2 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(); }
From source file:com.liferay.portlet.messageboards.action.RSSAction.java
License:Open Source License
protected byte[] getRSS(HttpServletRequest request) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); String plid = ParamUtil.getString(request, "p_l_id"); long companyId = ParamUtil.getLong(request, "companyId"); long groupId = ParamUtil.getLong(request, "groupId"); long userId = ParamUtil.getLong(request, "userId"); long categoryId = ParamUtil.getLong(request, "mbCategoryId"); long threadId = ParamUtil.getLong(request, "threadId"); int max = ParamUtil.getInteger(request, "max", SearchContainer.DEFAULT_DELTA); String type = ParamUtil.getString(request, "type", RSSUtil.TYPE_DEFAULT); double version = ParamUtil.getDouble(request, "version", RSSUtil.VERSION_DEFAULT); String displayStyle = ParamUtil.getString(request, "displayStyle", RSSUtil.DISPLAY_STYLE_FULL_CONTENT); String entryURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_message?p_l_id=" + plid; String rss = StringPool.BLANK; if (companyId > 0) { String feedURL = StringPool.BLANK; rss = MBMessageServiceUtil.getCompanyMessagesRSS(companyId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else if (groupId > 0) { String feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_recent_posts?p_l_id=" + plid; if (userId > 0) { rss = MBMessageServiceUtil.getGroupMessagesRSS(groupId, userId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else {/* w w w.j a va2 s.c om*/ rss = MBMessageServiceUtil.getGroupMessagesRSS(groupId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } } else if (categoryId > 0) { String feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_category?p_l_id=" + plid + "&mbCategoryId=" + categoryId; rss = MBMessageServiceUtil.getCategoryMessagesRSS(groupId, categoryId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } else if (threadId > 0) { String feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/message_boards/find_thread?p_l_id=" + plid + "&threadId=" + threadId; rss = MBMessageServiceUtil.getThreadMessagesRSS(threadId, WorkflowConstants.STATUS_APPROVED, max, type, version, displayStyle, feedURL, entryURL, themeDisplay); } return rss.getBytes(StringPool.UTF8); }
From source file:com.liferay.portlet.wiki.action.RSSAction.java
License:Open Source License
protected byte[] getRSS(HttpServletRequest request) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Layout layout = themeDisplay.getLayout(); long companyId = ParamUtil.getLong(request, "companyId"); long nodeId = ParamUtil.getLong(request, "nodeId"); String title = ParamUtil.getString(request, "title"); int max = ParamUtil.getInteger(request, "max", SearchContainer.DEFAULT_DELTA); String type = ParamUtil.getString(request, "type", RSSUtil.TYPE_DEFAULT); double version = ParamUtil.getDouble(request, "version", RSSUtil.VERSION_DEFAULT); String displayStyle = ParamUtil.getString(request, "displayStyle", RSSUtil.DISPLAY_STYLE_FULL_CONTENT); PortletURL feedURL = new PortletURLImpl(request, PortletKeys.WIKI, layout.getPlid(), PortletRequest.RENDER_PHASE); feedURL.setParameter("nodeId", String.valueOf(nodeId)); PortletURL entryURL = new PortletURLImpl(request, PortletKeys.WIKI, layout.getPlid(), PortletRequest.RENDER_PHASE); entryURL.setParameter("nodeId", String.valueOf(nodeId)); entryURL.setParameter("title", title); Locale locale = themeDisplay.getLocale(); String rss = StringPool.BLANK; if ((nodeId > 0) && (Validator.isNotNull(title))) { rss = WikiPageServiceUtil.getPagesRSS(companyId, nodeId, title, max, type, version, displayStyle, feedURL.toString(), entryURL.toString(), locale); } else if (nodeId > 0) { rss = WikiPageServiceUtil.getNodePagesRSS(nodeId, max, type, version, displayStyle, feedURL.toString(), entryURL.toString());/*w w w. j a v a 2s . c o m*/ } return rss.getBytes(StringPool.UTF8); }