View Javadoc
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.List;
25  import com.google.gson.Gson;
26  import com.google.gson.annotations.SerializedName;
27  
28  /**
29   * The Class DataTableResults.
30   *
31   * @author Petr Vcelak (vcelak@kiv.zcu.cz)
32   * @param <T> the generic type
33   */
34  public class DataTableResults<T> {
35  
36      /**
37       * The draw.
38       */
39      private String draw;
40  
41      /**
42       * The records filtered.
43       */
44      private long recordsFiltered;
45  
46      /**
47       * The records total.
48       */
49      private long recordsTotal;
50  
51      /**
52       * The list of data objects.
53       */
54      @SerializedName("data")
55      List<T> listOfDataObjects;
56  
57      public String getJson() {
58          return new Gson().toJson(this);
59      }
60  
61      /**
62       * Gets the draw.
63       *
64       * @return the draw
65       */
66      public String getDraw() {
67          return draw;
68      }
69  
70      /**
71       * Sets the draw.
72       *
73       * @param draw the draw to set
74       */
75      public void setDraw(String draw) {
76          this.draw = draw;
77      }
78  
79      /**
80       * Gets the records filtered.
81       *
82       * @return the recordsFiltered
83       */
84      public long getRecordsFiltered() {
85          return recordsFiltered;
86      }
87  
88      /**
89       * Sets the records filtered.
90       *
91       * @param recordsFiltered the recordsFiltered to set
92       */
93      public void setRecordsFiltered(long recordsFiltered) {
94          this.recordsFiltered = recordsFiltered;
95      }
96  
97      /**
98       * Gets the records total.
99       *
100      * @return the recordsTotal
101      */
102     public long getRecordsTotal() {
103         return recordsTotal;
104     }
105 
106     /**
107      * Sets the records total.
108      *
109      * @param recordsTotal the recordsTotal to set
110      */
111     public void setRecordsTotal(long recordsTotal) {
112         this.recordsTotal = recordsTotal;
113     }
114 
115     /**
116      * Gets the list of data objects.
117      *
118      * @return the listOfDataObjects
119      */
120     public List<T> getListOfDataObjects() {
121         return listOfDataObjects;
122     }
123 
124     /**
125      * Sets the list of data objects.
126      *
127      * @param listOfDataObjects the listOfDataObjects to set
128      */
129     public void setListOfDataObjects(List<T> listOfDataObjects) {
130         this.listOfDataObjects = listOfDataObjects;
131     }
132 
133     @Override
134     public String toString() {
135         return "DataTableResults{" + "draw=" + draw + ", recordsFiltered=" + recordsFiltered + ", recordsTotal=" + recordsTotal + ", listOfDataObjects=" + listOfDataObjects + '}';
136     }
137 }