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 030/** Configuration for a single sort option. */ 031public class CmsSearchConfigurationSortOption implements I_CmsSearchConfigurationSortOption { 032 033 /** The label shown when the sort option is displayed. */ 034 private final String m_label; 035 /** The value send in the request that identifies the option. */ 036 private final String m_paramValue; 037 /** The sort option as given to Solr. */ 038 private final String m_solrValue; 039 040 /** Constructor setting all options. 041 * @param label The label shown when the sort option is displayed. 042 * @param paramValue The value send in the request that identifies the option. 043 * @param solrValue The sort option as given to Solr. 044 */ 045 public CmsSearchConfigurationSortOption(final String label, final String paramValue, final String solrValue) { 046 047 m_solrValue = solrValue; 048 m_paramValue = paramValue == null ? solrValue : paramValue; 049 m_label = label == null ? m_paramValue : label; 050 } 051 052 /** 053 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationSortOption#getLabel() 054 */ 055 @Override 056 public String getLabel() { 057 058 return m_label; 059 } 060 061 /** 062 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationSortOption#getParamValue() 063 */ 064 @Override 065 public String getParamValue() { 066 067 return m_paramValue; 068 } 069 070 /** 071 * @see org.opencms.jsp.search.config.I_CmsSearchConfigurationSortOption#getSolrValue() 072 */ 073 @Override 074 public String getSolrValue() { 075 076 return m_solrValue; 077 } 078}