1 /*
2 * Copyright 2018-2022 Medical Information Systems Research Group (https://medical.zcu.cz),
3 * Department of Computer Science and Engineering, University of West Bohemia.
4 * Address: Univerzitni 8, 306 14 Plzen, Czech Republic.
5 *
6 * Author Petr Vcelak (vcelak@kiv.zcu.cz).
7 *
8 * This file is part of MRECore project.
9 *
10 * MRECore is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License.
13 *
14 * MRECore is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MRECore. If not, see <http://www.gnu.org/licenses/>.
21 */
22 package cz.zcu.mre.data.datatable;
23
24 import java.util.HashMap;
25 import java.util.Map;
26
27 /**
28 * The Class DataTableQueryFilterBy.
29 *
30 * @author Petr Vcelak (vcelak@kiv.zcu.cz)
31 */
32 public class DataTableQueryFilterBy {
33
34 /**
35 * The map of sorts.
36 */
37 private Map<String, String> mapOfFilters = null;
38
39 /**
40 * The global search.
41 */
42 private boolean globalSearch = false;
43
44 /**
45 * Instantiates a new sort by.
46 */
47 public DataTableQueryFilterBy() {
48 if (null == mapOfFilters) {
49 mapOfFilters = new HashMap<>();
50 }
51 }
52
53 /**
54 * Gets the map of filters.
55 *
56 * @return the mapOfFilters
57 */
58 public Map<String, String> getMapOfFilters() {
59 return mapOfFilters;
60 }
61
62 /**
63 * Sets the map of filters.
64 *
65 * @param mapOfFilters the mapOfFilters to set
66 */
67 public void setMapOfFilters(Map<String, String> mapOfFilters) {
68 this.mapOfFilters = mapOfFilters;
69 }
70
71 /**
72 * Adds the sort.
73 *
74 * @param filterColumn the filter column
75 * @param filterValue the filter value
76 */
77 public void addFilter(String filterColumn, String filterValue) {
78 mapOfFilters.put(filterColumn, filterValue);
79 }
80
81 /**
82 * Checks if is global search.
83 *
84 * @return the globalSearch
85 */
86 public boolean isGlobalSearch() {
87 return globalSearch;
88 }
89
90 /**
91 * Sets the global search.
92 *
93 * @param globalSearch the globalSearch to set
94 */
95 public void setGlobalSearch(boolean globalSearch) {
96 this.globalSearch = globalSearch;
97 }
98
99 @Override
100 public String toString() {
101 return "FilterBy{" + "mapOfFilters=" + mapOfFilters + ", globalSearch=" + globalSearch + '}';
102 }
103 }