1 /*
2 * Copyright (c) 2002-2025, City of Paris
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice
10 * and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice
13 * and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 *
16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * License 1.0
33 */
34 package fr.paris.lutece.util.datatable;
35
36 import fr.paris.lutece.util.ReferenceList;
37
38 /**
39 * Class to filter data with a DataTableManager
40 */
41 public class DataTableFilter
42 {
43 private DataTableFilterType _filterType;
44 private String _strParameterName;
45 private String _strFilterLabel;
46 private String _strValue;
47 private ReferenceList _refList;
48
49 /**
50 * Creates a new filter
51 *
52 * @param filterType
53 * The type of the filter
54 * @param strParameterName
55 * The name of the parameter to filter
56 * @param strFilterLabel
57 * The label of the filter
58 */
59 protected DataTableFilter( DataTableFilterType filterType, String strParameterName, String strFilterLabel )
60 {
61 _filterType = filterType;
62 _strParameterName = strParameterName;
63 _strFilterLabel = strFilterLabel;
64 }
65
66 /**
67 * Get the type of the filter
68 *
69 * @return The type of the filter
70 */
71 public DataTableFilterType getFilterType( )
72 {
73 return _filterType;
74 }
75
76 /**
77 * Set the type of the filter
78 *
79 * @param filterType
80 * The type of the filter
81 */
82 protected void setFilterType( DataTableFilterType filterType )
83 {
84 _filterType = filterType;
85 }
86
87 /**
88 * Get the name of the parameter to filter
89 *
90 * @return The name of the parameter to filter
91 */
92 public String getParameterName( )
93 {
94 return _strParameterName;
95 }
96
97 /**
98 * Set the name of the parameter to filter
99 *
100 * @param strParameterName
101 * The name of the parameter to filter
102 */
103 protected void setParameterName( String strParameterName )
104 {
105 _strParameterName = strParameterName;
106 }
107
108 /**
109 * Get the label of the filter
110 *
111 * @return The label of the filter
112 */
113 public String getFilterLabel( )
114 {
115 return _strFilterLabel;
116 }
117
118 /**
119 * Set the label of the filter
120 *
121 * @param strFilterLabel
122 * The label of the filter
123 */
124 protected void setFilterLabel( String strFilterLabel )
125 {
126 _strFilterLabel = strFilterLabel;
127 }
128
129 /**
130 * Get the reference list of this filter
131 *
132 * @return The reference list of this filter
133 */
134 public ReferenceList getRefList( )
135 {
136 return _refList;
137 }
138
139 /**
140 * Set the reference list of this filter
141 *
142 * @param refList
143 * The reference list of this filter
144 */
145 protected void setRefList( ReferenceList refList )
146 {
147 _refList = refList;
148 }
149
150 /**
151 * Get the current value of the filter
152 *
153 * @return The current value of the filter
154 */
155 public String getValue( )
156 {
157 return _strValue;
158 }
159
160 /**
161 * Set the current value of the filter
162 *
163 * @param strValue
164 * The current value of the filter
165 */
166 protected void setValue( String strValue )
167 {
168 _strValue = strValue;
169 }
170 }