001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.jsp.search.state;
029
030import java.util.HashMap;
031import java.util.Map;
032
033/** Class for handling the state of the common search options. */
034public class CmsSearchStateCommon implements I_CmsSearchStateCommon {
035
036    /** The current query string (as given by the user). */
037    private String m_query = "";
038    /** The last query string (as given by the user). */
039    private String m_lastquery = "";
040    /** The flag, indicating if the search is performed for the first time or not. */
041    private boolean m_isReloaded;
042    /** Map from the additional request parameters to their values. */
043    private Map<String, String> m_additionalParameters;
044
045    /**
046     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#getAdditionalParameters()
047     */
048    @Override
049    public Map<String, String> getAdditionalParameters() {
050
051        return m_additionalParameters == null ? new HashMap<String, String>() : m_additionalParameters;
052    }
053
054    /**
055     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#getIsReloaded()
056     */
057    public boolean getIsReloaded() {
058
059        return m_isReloaded;
060    }
061
062    /**
063     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#getLastQuery()
064     */
065    @Override
066    public String getLastQuery() {
067
068        return m_lastquery;
069    }
070
071    /**
072     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#getQuery()
073     */
074    @Override
075    public String getQuery() {
076
077        return m_query;
078    }
079
080    /**
081     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#setAdditionalParameters(java.util.Map)
082     */
083    @Override
084    public void setAdditionalParameters(Map<String, String> parameters) {
085
086        m_additionalParameters = parameters;
087    }
088
089    /**
090     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#setIsReloaded(boolean)
091     */
092    public void setIsReloaded(boolean isReloaded) {
093
094        m_isReloaded = isReloaded;
095
096    }
097
098    /**
099     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#setLastQuery(java.lang.String)
100     */
101    @Override
102    public void setLastQuery(final String lastquery) {
103
104        m_lastquery = lastquery;
105    }
106
107    /**
108     * @see org.opencms.jsp.search.state.I_CmsSearchStateCommon#setQuery(java.lang.String)
109     */
110    @Override
111    public void setQuery(final String query) {
112
113        m_query = query;
114
115    }
116}