1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.dao.search;
16  
17  import com.liferay.portal.kernel.util.ParamUtil;
18  
19  import javax.portlet.PortletRequest;
20  
21  import javax.servlet.http.HttpServletRequest;
22  
23  /**
24   * <a href="DisplayTerms.java.html"><b><i>View Source</i></b></a>
25   *
26   * @author Brian Wing Shun Chan
27   */
28  public class DisplayTerms {
29  
30      public static final String KEYWORDS = "keywords";
31  
32      public static final String ADVANCED_SEARCH = "advancedSearch";
33  
34      public static final String AND_OPERATOR = "andOperator";
35  
36      public DisplayTerms(HttpServletRequest request) {
37          keywords = ParamUtil.getString(request, KEYWORDS);
38          advancedSearch = ParamUtil.getBoolean(request, ADVANCED_SEARCH);
39          andOperator = ParamUtil.getBoolean(request, AND_OPERATOR, true);
40      }
41  
42      public DisplayTerms(PortletRequest portletRequest) {
43          keywords = ParamUtil.getString(portletRequest, KEYWORDS);
44          advancedSearch = ParamUtil.getBoolean(portletRequest, ADVANCED_SEARCH);
45          andOperator = ParamUtil.getBoolean(portletRequest, AND_OPERATOR, true);
46      }
47  
48      public String getKeywords() {
49          return keywords;
50      }
51  
52      public boolean isAdvancedSearch() {
53          return advancedSearch;
54      }
55  
56      public void setAdvancedSearch(boolean advancedSearch) {
57          this.advancedSearch = advancedSearch;
58      }
59  
60      public boolean isAndOperator() {
61          return andOperator;
62      }
63  
64      protected String keywords;
65      protected boolean advancedSearch;
66      protected boolean andOperator;
67  
68  }