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.widgets.dataview; 029 030import java.util.LinkedHashMap; 031import java.util.Map; 032 033/** 034 * Represents a search query which can be submitted to an implementation of I_CmsDataView to retrieve a set of results.<p> 035 */ 036public class CmsDataViewQuery { 037 038 /** The full text query. */ 039 private String m_fullTextQuery; 040 041 /** The values of the selected filters. */ 042 private Map<String, String> m_filterValues; 043 044 /** The sort direction (true for ascending). Only used when a sort column is selected. */ 045 private boolean m_sortAscending; 046 047 /** The column to sort by. */ 048 private String m_sortColumn; 049 050 /** 051 * Gets the selected filter values.<p> 052 * 053 * @return the selected filter values 054 */ 055 public Map<String, String> getFilterValues() { 056 057 return m_filterValues; 058 } 059 060 /** 061 * Gets the full text query.<p> 062 * 063 * If no full text query is provided, this will return the empty string. 064 * 065 * @return the full text query 066 */ 067 public String getFullTextQuery() { 068 069 return m_fullTextQuery; 070 } 071 072 /** 073 * Gets the column to sort by.<p> 074 * 075 * If this method returns null, unsorted results should be returned. 076 * 077 * @return the column to sort by 078 */ 079 public String getSortColumn() { 080 081 return m_sortColumn; 082 } 083 084 /** 085 * Returns true if the sorting for the given sort column should be in ascending order.<p> 086 * 087 * @return true if the results should be sorted in ascending order 088 */ 089 public boolean isSortAscending() { 090 091 return m_sortAscending; 092 } 093 094 /** 095 * Sets the selected filter values.<p> 096 * 097 * @param filterValues the filter values 098 */ 099 public void setFilterValues(LinkedHashMap<String, String> filterValues) { 100 101 m_filterValues = new LinkedHashMap<String, String>(filterValues); 102 } 103 104 /** 105 * Sets the full text query.<p> 106 * 107 * @param query the full text query 108 */ 109 public void setFullTextQuery(String query) { 110 111 if (query == null) { 112 query = ""; 113 } 114 m_fullTextQuery = query; 115 116 } 117 118 /** 119 * Sets the sort direction.<p> 120 * 121 * @param ascending true if results should be sorted in ascending order 122 */ 123 public void setSortAscending(boolean ascending) { 124 125 m_sortAscending = ascending; 126 127 } 128 129 /** 130 * Sets the sort column.<p> 131 * 132 * @param sortColumn the sort column 133 */ 134 public void setSortColumn(String sortColumn) { 135 136 m_sortColumn = sortColumn; 137 138 } 139 140}