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 setUserGroupParams(
035                    LinkedHashMap<String, Object> userGroupParams) {
036    
037                    _userGroupParams = userGroupParams;
038            }
039    
040            @Override
041            protected void cleanUp() {
042                    _searchTerms = null;
043                    _userGroupParams = null;
044            }
045    
046            @Override
047            protected String getPage() {
048                    return _PAGE;
049            }
050    
051            @Override
052            protected void setAttributes(HttpServletRequest request) {
053                    SearchContainerTag<R> searchContainerTag =
054                            (SearchContainerTag<R>)findAncestorWithClass(
055                                    this, SearchContainerTag.class);
056    
057                    SearchContainer<R> searchContainer =
058                            searchContainerTag.getSearchContainer();
059    
060                    request.setAttribute(
061                            "liferay-ui:user-group-search-container-results:searchContainer",
062                            searchContainer);
063                    request.setAttribute(
064                            "liferay-ui:user-group-search-container-results:searchTerms",
065                            _searchTerms);
066                    request.setAttribute(
067                            "liferay-ui:user-group-search-container-results:userGroupParams",
068                            _userGroupParams);
069            }
070    
071            private static final String _PAGE =
072                    "/html/taglib/ui/user_group_search_container_results/page.jsp";
073    
074            private DisplayTerms _searchTerms;
075            private LinkedHashMap<String, Object> _userGroupParams;
076    
077    }