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 */ 067 public CmsSearchConfigurationFacetRange( 068 final String range, 069 final String start, 070 final String end, 071 final String gap, 072 final Collection<Other> other, 073 final Boolean hardEnd, 074 final String name, 075 final Integer minCount, 076 final String label, 077 final Boolean isAndFacet, 078 final List<String> preselection, 079 final Boolean ignoreFilterFromAllFacets) { 080 081 super(minCount, label, null != name ? name : range, isAndFacet, preselection, ignoreFilterFromAllFacets); 082 083 m_range = range; 084 m_start = start; 085 m_end = end; 086 m_gap = gap; 087 m_other = null == other ? new ArrayList<Other>() : other; 088 m_hardEnd = null == hardEnd ? false : hardEnd.booleanValue(); 089 } 090 091 /** 092 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getEnd() 093 */ 094 public String getEnd() { 095 096 return m_end; 097 } 098 099 /** 100 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getGap() 101 */ 102 public String getGap() { 103 104 return m_gap; 105 } 106 107 /** 108 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getHardEnd() 109 */ 110 public boolean getHardEnd() { 111 112 return m_hardEnd; 113 } 114 115 /** 116 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getOther() 117 */ 118 public Collection<Other> getOther() { 119 120 return m_other; 121 } 122 123 /** 124 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getRange() 125 */ 126 @Override 127 public String getRange() { 128 129 return m_range; 130 } 131 132 /** 133 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationFacetRange#getStart() 134 */ 135 public String getStart() { 136 137 return m_start; 138 } 139 140}