@Override public void postProcessContextQuery(BooleanQuery contextQuery, SearchContext searchContext) throws Exception { Long classNameId = (Long) searchContext.getAttribute(Field.CLASS_NAME_ID); if (classNameId != null) { contextQuery.addRequiredTerm("classNameId", classNameId.toString()); } int status = GetterUtil.getInteger( searchContext.getAttribute(Field.STATUS), WorkflowConstants.STATUS_APPROVED); if (status != WorkflowConstants.STATUS_ANY) { contextQuery.addRequiredTerm(Field.STATUS, status); } long[] folderIds = searchContext.getFolderIds(); if ((folderIds != null) && (folderIds.length > 0)) { if (folderIds[0] == JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) { return; } BooleanQuery folderIdsQuery = BooleanQueryFactoryUtil.create(searchContext); for (long folderId : folderIds) { try { JournalFolderServiceUtil.getFolder(folderId); } catch (Exception e) { continue; } folderIdsQuery.addTerm(Field.FOLDER_ID, folderId); } contextQuery.add(folderIdsQuery, BooleanClauseOccur.MUST); } String articleType = (String) searchContext.getAttribute("articleType"); if (Validator.isNotNull(articleType)) { contextQuery.addRequiredTerm(Field.TYPE, articleType); } String structureId = (String) searchContext.getAttribute("structureId"); if (Validator.isNotNull(structureId)) { contextQuery.addRequiredTerm("structureId", structureId); } String templateId = (String) searchContext.getAttribute("templateId"); if (Validator.isNotNull(templateId)) { contextQuery.addRequiredTerm("templateId", templateId); } }
@Override public String getRowCheckBox( HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); JournalArticle article = null; JournalFolder folder = null; String articleId = GetterUtil.getString(primaryKey); try { article = JournalArticleServiceUtil.getArticle(themeDisplay.getScopeGroupId(), articleId); } catch (Exception e1) { if (e1 instanceof NoSuchArticleException) { try { long folderId = GetterUtil.getLong(primaryKey); folder = JournalFolderServiceUtil.getFolder(folderId); } catch (Exception e2) { return StringPool.BLANK; } } } boolean showInput = false; String name = null; if (article != null) { name = JournalArticle.class.getSimpleName(); try { if (JournalArticlePermission.contains(_permissionChecker, article, ActionKeys.DELETE) || JournalArticlePermission.contains(_permissionChecker, article, ActionKeys.EXPIRE) || JournalArticlePermission.contains(_permissionChecker, article, ActionKeys.UPDATE)) { showInput = true; } } catch (Exception e) { } } else if (folder != null) { name = JournalFolder.class.getSimpleName(); try { if (JournalFolderPermission.contains(_permissionChecker, folder, ActionKeys.DELETE)) { showInput = true; } } catch (Exception e) { } } if (!showInput) { return StringPool.BLANK; } StringBundler sb = new StringBundler(9); sb.append("['"); sb.append(_liferayPortletResponse.getNamespace()); sb.append(RowChecker.ROW_IDS); sb.append(JournalFolder.class.getSimpleName()); sb.append("Checkbox', '"); sb.append(_liferayPortletResponse.getNamespace()); sb.append(RowChecker.ROW_IDS); sb.append(JournalArticle.class.getSimpleName()); sb.append("Checkbox']"); String checkBoxRowIds = sb.toString(); return getRowCheckBox( request, checked, disabled, _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name + "Checkbox", primaryKey, checkBoxRowIds, "'#" + getAllRowIds() + "Checkbox'", StringPool.BLANK); }