001    /**
002     * Copyright (c) 2000-2013 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.portal.kernel.dao.search;
016    
017    import com.liferay.portal.kernel.util.ParamUtil;
018    
019    import javax.portlet.PortletRequest;
020    
021    import javax.servlet.http.HttpServletRequest;
022    
023    /**
024     * @author Brian Wing Shun Chan
025     */
026    public class DisplayTerms {
027    
028            public static final String ADVANCED_SEARCH = "advancedSearch";
029    
030            public static final String AND_OPERATOR = "andOperator";
031    
032            public static final String KEYWORDS = "keywords";
033    
034            public DisplayTerms(HttpServletRequest request) {
035                    advancedSearch = ParamUtil.getBoolean(request, ADVANCED_SEARCH);
036                    andOperator = ParamUtil.getBoolean(request, AND_OPERATOR, true);
037                    keywords = ParamUtil.getString(request, KEYWORDS);
038            }
039    
040            public DisplayTerms(PortletRequest portletRequest) {
041                    advancedSearch = ParamUtil.getBoolean(portletRequest, ADVANCED_SEARCH);
042                    andOperator = ParamUtil.getBoolean(portletRequest, AND_OPERATOR, true);
043                    keywords = ParamUtil.getString(portletRequest, KEYWORDS);
044            }
045    
046            public String getKeywords() {
047                    return keywords;
048            }
049    
050            public boolean isAdvancedSearch() {
051                    return advancedSearch;
052            }
053    
054            public boolean isAndOperator() {
055                    return andOperator;
056            }
057    
058            public void setAdvancedSearch(boolean advancedSearch) {
059                    this.advancedSearch = advancedSearch;
060            }
061    
062            protected boolean advancedSearch;
063            protected boolean andOperator;
064            protected String keywords;
065    
066    }