001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.taglib.ui;
016    
017    import com.liferay.portal.kernel.dao.search.DisplayTerms;
018    import com.liferay.portal.kernel.dao.search.SearchContainer;
019    import com.liferay.taglib.util.IncludeTag;
020    
021    import java.util.LinkedHashMap;
022    
023    import javax.servlet.http.HttpServletRequest;
024    
025    /**
026     * @author Drew Brokke
027     */
028    public class UserGroupSearchContainerResultsTag<R> extends IncludeTag {
029    
030            public void setSearchTerms(DisplayTerms searchTerms) {
031                    _searchTerms = searchTerms;
032            }
033    
034            public void setUseIndexer(boolean useIndexer) {
035                    _useIndexer = useIndexer;
036            }
037    
038            public void setUserGroupParams(
039                    LinkedHashMap<String, Object> userGroupParams) {
040    
041                    _userGroupParams = userGroupParams;
042            }
043    
044            @Override
045            protected void cleanUp() {
046                    _searchTerms = null;
047                    _useIndexer = true;
048                    _userGroupParams = null;
049            }
050    
051            @Override
052            protected String getPage() {
053                    return _PAGE;
054            }
055    
056            @Override
057            protected void setAttributes(HttpServletRequest request) {
058                    SearchContainerTag<R> searchContainerTag =
059                            (SearchContainerTag<R>)findAncestorWithClass(
060                                    this, SearchContainerTag.class);
061    
062                    SearchContainer<R> searchContainer =
063                            searchContainerTag.getSearchContainer();
064    
065                    request.setAttribute(
066                            "liferay-ui:user-group-search-container-results:useIndexer",
067                            _useIndexer);
068                    request.setAttribute(
069                            "liferay-ui:user-group-search-container-results:searchContainer",
070                            searchContainer);
071                    request.setAttribute(
072                            "liferay-ui:user-group-search-container-results:searchTerms",
073                            _searchTerms);
074                    request.setAttribute(
075                            "liferay-ui:user-group-search-container-results:userGroupParams",
076                            _userGroupParams);
077            }
078    
079            private static final String _PAGE =
080                    "/html/taglib/ui/user_group_search_container_results/page.jsp";
081    
082            private DisplayTerms _searchTerms;
083            private boolean _useIndexer = true;
084            private LinkedHashMap<String, Object> _userGroupParams;
085    
086    }