@Override public List<ResultRowSplitterEntry> split(List<ResultRow> resultRows) { List<ResultRowSplitterEntry> resultRowSplitterEntries = new ArrayList<>(); List<ResultRow> fileEntryResultRows = new ArrayList<>(); List<ResultRow> folderResultRows = new ArrayList<>(); for (ResultRow resultRow : resultRows) { Object object = resultRow.getObject(); if (object instanceof Folder) { folderResultRows.add(resultRow); } else { fileEntryResultRows.add(resultRow); } } if (!folderResultRows.isEmpty()) { resultRowSplitterEntries.add(new ResultRowSplitterEntry(StringPool.BLANK, folderResultRows)); } if (!fileEntryResultRows.isEmpty()) { resultRowSplitterEntries.add( new ResultRowSplitterEntry(StringPool.BLANK, fileEntryResultRows)); } return resultRowSplitterEntries; }
@Override public int doEndTag() { try { SearchContainerRowTag<R> searchContainerRowTag = (SearchContainerRowTag<R>) findAncestorWithClass(this, SearchContainerRowTag.class); ResultRow resultRow = searchContainerRowTag.getRow(); if (index <= -1) { List<SearchEntry> searchEntries = resultRow.getEntries(); index = searchEntries.size(); } if (resultRow.isRestricted()) { _href = null; } ImageSearchEntry imageSearchEntry = new ImageSearchEntry(); imageSearchEntry.setAlign(getAlign()); imageSearchEntry.setColspan(getColspan()); imageSearchEntry.setCssClass(getCssClass()); imageSearchEntry.setRequest((HttpServletRequest) pageContext.getRequest()); imageSearchEntry.setResponse((HttpServletResponse) pageContext.getResponse()); imageSearchEntry.setToggleRowChecker(isToggleRowChecker()); ServletContext servletContext = ServletContextPool.get(PortalUtil.getServletContextName()); imageSearchEntry.setServletContext(servletContext); imageSearchEntry.setSrc(_src); imageSearchEntry.setValign(getValign()); resultRow.addSearchEntry(index, imageSearchEntry); return EVAL_PAGE; } finally { index = -1; _src = null; if (!ServerDetector.isResin()) { align = SearchEntry.DEFAULT_ALIGN; colspan = SearchEntry.DEFAULT_COLSPAN; cssClass = SearchEntry.DEFAULT_CSS_CLASS; _href = null; name = null; _toggleRowChecker = false; valign = SearchEntry.DEFAULT_VALIGN; } } }
@Override public int doEndTag() { try { SearchContainerRowTag<R> searchContainerRowTag = (SearchContainerRowTag<R>) findAncestorWithClass(this, SearchContainerRowTag.class); ResultRow resultRow = searchContainerRowTag.getRow(); if (Validator.isNotNull(_property)) { _value = String.valueOf(BeanPropertiesUtil.getObject(resultRow.getObject(), _property)); } else if (Validator.isNotNull(_buffer)) { _value = _sb.toString(); } else if (_value == null) { BodyContent bodyContent = getBodyContent(); if (bodyContent != null) { _value = bodyContent.getString(); } else { Object object = BeanPropertiesUtil.getObject(resultRow.getObject(), getName()); _value = String.valueOf(object); } } if (_translate) { ResourceBundle resourceBundle = TagResourceBundleUtil.getResourceBundle(pageContext); _value = LanguageUtil.get(resourceBundle, _value); } if (index <= -1) { List<SearchEntry> searchEntries = resultRow.getEntries(); index = searchEntries.size(); } if (resultRow.isRestricted()) { _href = null; } TextSearchEntry textSearchEntry = new TextSearchEntry(); textSearchEntry.setAlign(getAlign()); textSearchEntry.setColspan(getColspan()); textSearchEntry.setCssClass(getCssClass()); textSearchEntry.setHref(String.valueOf(getHref())); textSearchEntry.setName(getValue()); textSearchEntry.setTarget(getTarget()); textSearchEntry.setTitle(getTitle()); textSearchEntry.setTruncate(getTruncate()); textSearchEntry.setValign(getValign()); resultRow.addSearchEntry(index, textSearchEntry); return EVAL_PAGE; } finally { index = -1; _value = null; if (!ServerDetector.isResin()) { align = SearchEntry.DEFAULT_ALIGN; _buffer = null; colspan = SearchEntry.DEFAULT_COLSPAN; cssClass = SearchEntry.DEFAULT_CSS_CLASS; _href = null; name = null; _orderable = false; _orderableProperty = null; _property = null; _sb = null; _target = null; _title = null; _translate = false; valign = SearchEntry.DEFAULT_VALIGN; } } }