Rev 1814 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1814 | Rev 1830 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
1 | package pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary; |
- | 2 | ||
- | 3 | import org.json.JSONArray; |
|
- | 4 | import com.owlike.genson.Genson; |
|
- | 5 | import com.owlike.genson.GensonBuilder; |
|
- | 6 | import org.json.JSONException; |
|
- | 7 | import org.json.JSONObject; |
|
- | 8 | import pt.estgp.estgweb.domain.utils.JsonView; |
|
- | 9 | ||
- | 10 | import java.util.Date; |
|
- | 11 | import java.util.List; |
|
2 | 12 | ||
3 | /** |
13 | /** |
4 | * Created by jorgemachado on 11/10/17. |
14 | * Created by jorgemachado on 11/10/17. |
5 | */ |
15 | */ |
6 | public class CourseUnitDtpStat |
16 | public class CourseUnitDtpStat implements JsonView |
7 | { |
17 | { |
- | 18 | 1.5.0/docs/api/java/lang/String.html">String sigesCode; |
|
- | 19 | 1.5.0/docs/api/java/lang/String.html">String period; |
|
- | 20 | 1.5.0/docs/api/java/lang/String.html">String name; |
|
- | 21 | ||
8 | boolean planeamentoConteudos; |
22 | boolean planeamentoConteudos; |
9 | boolean planeamentoCalendarizacao; |
23 | boolean planeamentoCalendarizacao; |
10 | 24 | ||
11 | boolean ficha; |
25 | boolean ficha; |
12 | 26 | ||
Line 17... | Line 31... | ||
17 | 31 | ||
18 | boolean relatorio; |
32 | boolean relatorio; |
19 | 33 | ||
20 | boolean inquerito; |
34 | boolean inquerito; |
21 | 35 | ||
- | 36 | public 1.5.0/docs/api/java/lang/String.html">String getSigesCode() { |
|
- | 37 | return sigesCode; |
|
- | 38 | } |
|
- | 39 | ||
- | 40 | public void setSigesCode(1.5.0/docs/api/java/lang/String.html">String sigesCode) { |
|
- | 41 | this.sigesCode = sigesCode; |
|
- | 42 | } |
|
- | 43 | ||
- | 44 | public 1.5.0/docs/api/java/lang/String.html">String getPeriod() { |
|
- | 45 | return period; |
|
- | 46 | } |
|
- | 47 | ||
- | 48 | public void setPeriod(1.5.0/docs/api/java/lang/String.html">String period) { |
|
- | 49 | this.period = period; |
|
- | 50 | } |
|
- | 51 | ||
- | 52 | public 1.5.0/docs/api/java/lang/String.html">String getName() { |
|
- | 53 | return name; |
|
- | 54 | } |
|
- | 55 | ||
- | 56 | public void setName(1.5.0/docs/api/java/lang/String.html">String name) { |
|
- | 57 | this.name = name; |
|
- | 58 | } |
|
- | 59 | ||
22 | public boolean isPlaneamentoConteudos() { |
60 | public boolean isPlaneamentoConteudos() { |
23 | return planeamentoConteudos; |
61 | return planeamentoConteudos; |
24 | } |
62 | } |
25 | 63 | ||
26 | public void setPlaneamentoConteudos(boolean planeamentoConteudos) { |
64 | public void setPlaneamentoConteudos(boolean planeamentoConteudos) { |
Line 80... | Line 118... | ||
80 | } |
118 | } |
81 | 119 | ||
82 | public void setInquerito(boolean inquerito) { |
120 | public void setInquerito(boolean inquerito) { |
83 | this.inquerito = inquerito; |
121 | this.inquerito = inquerito; |
84 | } |
122 | } |
- | 123 | ||
- | 124 | ||
- | 125 | private static Genson gensonGenericLoad; |
|
- | 126 | static{ |
|
- | 127 | gensonGenericLoad = new GensonBuilder() |
|
- | 128 | .useMethods(true) |
|
- | 129 | .useFields(true) |
|
- | 130 | .useRuntimeType(true) |
|
- | 131 | .useClassMetadata(true) |
|
- | 132 | .useDateAsTimestamp(true) |
|
- | 133 | .exclude(1.5.0/docs/api/java/lang/Class.html">Class.class) |
|
- | 134 | .exclude(5+0%2Fdocs%2Fapi+Date">Date.class) |
|
- | 135 | .exclude(java.sql.5+0%2Fdocs%2Fapi+Timestamp">Timestamp.class) |
|
- | 136 | .exclude(java.sql.5+0%2Fdocs%2Fapi+Date">Date.class) |
|
- | 137 | .create(); |
|
- | 138 | } |
|
- | 139 | ||
- | 140 | public static CourseUnitDtpStat fromJson(1.5.0/docs/api/java/lang/String.html">String json) |
|
- | 141 | { |
|
- | 142 | return gensonGenericLoad.deserialize(json,CourseUnitDtpStat.class); |
|
- | 143 | } |
|
- | 144 | ||
- | 145 | public static CourseUnitDtpStat[] fromJson(JSONArray stats) |
|
- | 146 | { |
|
- | 147 | return gensonGenericLoad.deserialize(stats.toString(),CourseUnitDtpStat[].class); |
|
- | 148 | } |
|
- | 149 | ||
- | 150 | ||
- | 151 | ||
- | 152 | public List<String> getJsonExcludedProperties() { |
|
- | 153 | return null; |
|
- | 154 | } |
|
- | 155 | ||
- | 156 | /** |
|
- | 157 | * Generic Json Object only for local class methods |
|
- | 158 | * @return |
|
- | 159 | * @throws org.json.JSONException |
|
- | 160 | */ |
|
- | 161 | public JSONObject toJsonObject() throws JSONException |
|
- | 162 | { |
|
- | 163 | return new JSONObject(toJson()); |
|
- | 164 | } |
|
- | 165 | ||
- | 166 | /** |
|
- | 167 | * * Generic Json Object only for local class methods |
|
- | 168 | * @return |
|
- | 169 | * @throws java.io.IOException |
|
- | 170 | */ |
|
- | 171 | public 1.5.0/docs/api/java/lang/String.html">String toJson() |
|
- | 172 | { |
|
- | 173 | return gensonGenericLoad.serialize(this); |
|
- | 174 | } |
|
- | 175 | ||
85 | } |
176 | } |