All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opencms.jsp.search.config.CmsSearchConfigurationFacetQuery Maven / Gradle / Ivy

/*
 * This library is part of OpenCms -
 * the Open Source Content Management System
 *
 * Copyright (c) Alkacon Software GmbH (http://www.alkacon.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * For further information about Alkacon Software, please see the
 * company website: http://www.alkacon.com
 *
 * For further information about OpenCms, please see the
 * project website: http://www.opencms.org
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package org.opencms.jsp.search.config;

import java.util.ArrayList;
import java.util.List;

/** Configuration for the query facet. */
public class CmsSearchConfigurationFacetQuery extends CmsSearchConfigurationFacet
implements I_CmsSearchConfigurationFacetQuery {

    /** Representation of one query facet item. */
    public static class CmsFacetQueryItem implements I_CmsFacetQueryItem {

        /** The query string for the item. */
        String m_query;
        /** The label for the query item. */
        String m_label;

        /** Constructor for a facet item.
         * @param query the query string for the item.
         * @param label the label for the item, defaults to the query string.
         */
        public CmsFacetQueryItem(String query, String label) {

            m_query = query;
            m_label = label == null ? query : label;
        }

        /**
         * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem#getLabel()
         */
        @Override
        public String getLabel() {

            return m_label;
        }

        /**
         * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetQuery.I_CmsFacetQueryItem#getQuery()
         */
        @Override
        public String getQuery() {

            return m_query;
        }

    }

    /** List of queries for the facet. */
    List m_queries;

    /** Constructor for the range facet configuration.
     * @param queries the queries that can be selected for the facet
     * @param label the label used to display the facet
     * @param isAndFacet true if checked facet entries should all be matched, otherwise only one checked entry must match
     * @param preselection list of entries that should be checked in advance
     */
    public CmsSearchConfigurationFacetQuery(
        final List queries,
        final String label,
        final Boolean isAndFacet,
        final List preselection) {

        super(null, null, label, I_CmsSearchConfigurationFacetQuery.NAME, null, isAndFacet, preselection);
        m_queries = queries != null ? queries : new ArrayList();
    }

    /**
     * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetQuery#getQueryList()
     */
    @Override
    public List getQueryList() {

        return m_queries;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy