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.config; 029 030import java.util.ArrayList; 031import java.util.Collection; 032import java.util.List; 033 034/** 035 * Search configuration special for field facets. Extends @see{org.opencms.jsp.search.config.CmsSearchConfigurationFacet}. 036 */ 037public class CmsSearchConfigurationFacetRange extends CmsSearchConfigurationFacet 038implements I_CmsSearchConfigurationFacetRange { 039 040 /** The range field to use for the facet. */ 041 protected String m_range; 042 /** The start of the complete range. */ 043 private String m_start; 044 /** The end of the complete range. */ 045 private String m_end; 046 /** The range size for one facet entry. */ 047 private String m_gap; 048 /** Additional information collected by the facet. */ 049 private Collection<Other> m_other; 050 /** The value to use for facet.range.hardend. */ 051 private boolean m_hardEnd; 052 053 /** Constructor directly setting all configuration values. 054 * @param range The numeric index field to use for the facet. 055 * @param start The begin of the range of the complete facet 056 * @param end The end of the range of the complete facet 057 * @param gap The range of one facet entry 058 * @param other The way how to group other values 059 * @param hardEnd Flag, indicating if the last facet item range should end at <code>end</code> (use <code>true</code>) or extend to the full size of <code>gap</code> (use <code>false</code>). 060 * @param name The name of the facet. If <code>null</code> it defaults to the name of the index field. 061 * @param minCount The minimal number of hits that is necessary to add a term to the facet. 062 * @param label The label that can be shown over the facet entries in your search form. 063 * @param isAndFacet If set to true, the facets filters for results containing all checked entries. Otherwise it filters for results containing at least one checked entry. 064 * @param preselection The list of facet items that should be preselected for the first search. 065 * @param ignoreFilterFromAllFacets A flag, indicating if filters from all facets should be ignored or not. 066 * @param excludeTags The tags (keys) of (filter) queries to be not taken into account for the facet. If "ignoreFiltersFromFacets" is true, the according tags for facets and queries will be added. 067 */ 068 public CmsSearchConfigurationFacetRange( 069 final String range, 070 final String start, 071 final String end, 072 final String gap, 073 final Collection<Other> other, 074 final Boolean hardEnd, 075 final String name, 076 final Integer minCount, 077 final String label, 078 final Boolean isAndFacet, 079 final List<String> preselection, 080 final Boolean ignoreFilterFromAllFacets, 081 final Collection<String> excludeTags) { 082 083 super( 084 minCount, 085 label, 086 null != name ? name : range, 087 isAndFacet, 088 preselection, 089 ignoreFilterFromAllFacets, 090 excludeTags); 091 092 m_range = range; 093 m_start = start; 094 m_end = end; 095 m_gap = gap; 096 m_other = null == other ? new ArrayList<Other>() : other; 097 m_hardEnd = null == hardEnd ? false : hardEnd.booleanValue(); 098 } 099 100 /** 101 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getEnd() 102 */ 103 public String getEnd() { 104 105 return m_end; 106 } 107 108 /** 109 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getGap() 110 */ 111 public String getGap() { 112 113 return m_gap; 114 } 115 116 /** 117 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getHardEnd() 118 */ 119 public boolean getHardEnd() { 120 121 return m_hardEnd; 122 } 123 124 /** 125 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getOther() 126 */ 127 public Collection<Other> getOther() { 128 129 return m_other; 130 } 131 132 /** 133 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getRange() 134 */ 135 @Override 136 public String getRange() { 137 138 return m_range; 139 } 140 141 /** 142 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getStart() 143 */ 144 public String getStart() { 145 146 return m_start; 147 } 148 149}