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="UserSearchTag.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   */
34  public class UserSearchTag extends TagSupport {
35  
36      public int doStartTag() throws JspException {
37          try {
38              HttpServletRequest request =
39                  (HttpServletRequest)pageContext.getRequest();
40  
41              request.setAttribute(
42                  "liferay-ui:user-search:portletURL", _portletURL);
43              request.setAttribute(
44                  "liferay-ui:user-search:rowChecker", _rowChecker);
45              request.setAttribute(
46                  "liferay-ui:user-search:userParams", _userParams);
47  
48              PortalIncludeUtil.include(pageContext, getStartPage());
49  
50              return EVAL_BODY_INCLUDE;
51          }
52          catch (Exception e) {
53              throw new JspException(e);
54          }
55      }
56  
57      public int doEndTag() throws JspException {
58          try {
59              PortalIncludeUtil.include(pageContext, getEndPage());
60  
61              return EVAL_PAGE;
62          }
63          catch (Exception e) {
64              throw new JspException(e);
65          }
66      }
67  
68      public String getStartPage() {
69          if (Validator.isNull(_startPage)) {
70              return _START_PAGE;
71          }
72          else {
73              return _startPage;
74          }
75      }
76  
77      public void setStartPage(String startPage) {
78          _startPage = startPage;
79      }
80  
81      public String getEndPage() {
82          if (Validator.isNull(_endPage)) {
83              return _END_PAGE;
84          }
85          else {
86              return _endPage;
87          }
88      }
89  
90      public void setEndPage(String endPage) {
91          _endPage = endPage;
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 setUserParams(LinkedHashMap<String, Object> userParams) {
103         _userParams = userParams;
104     }
105 
106     private static final String _START_PAGE =
107         "/html/taglib/ui/user_search/start.jsp";
108 
109     private static final String _END_PAGE =
110         "/html/taglib/ui/user_search/end.jsp";
111 
112     private String _startPage;
113     private String _endPage;
114     private PortletURL _portletURL;
115     private RowChecker _rowChecker;
116     private LinkedHashMap<String, Object> _userParams;
117 
118 }