1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.taglib.ui;
16  
17  import com.liferay.portal.kernel.dao.search.RowChecker;
18  import com.liferay.portal.kernel.servlet.PortalIncludeUtil;
19  import com.liferay.portal.kernel.util.Validator;
20  
21  import java.util.LinkedHashMap;
22  
23  import javax.portlet.PortletURL;
24  
25  import javax.servlet.http.HttpServletRequest;
26  import javax.servlet.jsp.JspException;
27  import javax.servlet.jsp.tagext.TagSupport;
28  
29  /**
30   * <a href="GroupSearchTag.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   */
34  public class GroupSearchTag extends TagSupport {
35  
36      public int doEndTag() throws JspException {
37          try {
38              PortalIncludeUtil.include(pageContext, getEndPage());
39  
40              return EVAL_PAGE;
41          }
42          catch (Exception e) {
43              throw new JspException(e);
44          }
45      }
46  
47      public int doStartTag() throws JspException {
48          try {
49              HttpServletRequest request =
50                  (HttpServletRequest)pageContext.getRequest();
51  
52              request.setAttribute(
53                  "liferay-ui:group-search:groupParams", _groupParams);
54              request.setAttribute(
55                  "liferay-ui:group-search:portletURL", _portletURL);
56              request.setAttribute(
57                  "liferay-ui:group-search:rowChecker", _rowChecker);
58  
59              PortalIncludeUtil.include(pageContext, getStartPage());
60  
61              return EVAL_BODY_INCLUDE;
62          }
63          catch (Exception e) {
64              throw new JspException(e);
65          }
66      }
67  
68      public String getEndPage() {
69          if (Validator.isNull(_endPage)) {
70              return _END_PAGE;
71          }
72          else {
73              return _endPage;
74          }
75      }
76  
77      public String getStartPage() {
78          if (Validator.isNull(_startPage)) {
79              return _START_PAGE;
80          }
81          else {
82              return _startPage;
83          }
84      }
85  
86      public void setEndPage(String endPage) {
87          _endPage = endPage;
88      }
89  
90      public void setGroupParams(LinkedHashMap<String, Object> groupParams) {
91          _groupParams = groupParams;
92      }
93  
94      public void setPortletURL(PortletURL portletURL) {
95          _portletURL = portletURL;
96      }
97  
98      public void setRowChecker(RowChecker rowChecker) {
99          _rowChecker = rowChecker;
100     }
101 
102     public void setStartPage(String startPage) {
103         _startPage = startPage;
104     }
105 
106     private static final String _END_PAGE =
107         "/html/taglib/ui/group_search/end.jsp";
108 
109     private static final String _START_PAGE =
110         "/html/taglib/ui/group_search/start.jsp";
111 
112     private String _endPage;
113     private LinkedHashMap<String, Object> _groupParams;
114     private PortletURL _portletURL;
115     private RowChecker _rowChecker;
116     private String _startPage;
117 
118 }