Rev 1814 | Go to most recent revision | 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.courseunitreport; |
2 | 2 | ||
- | 3 | import com.owlike.genson.Genson; |
|
- | 4 | import com.owlike.genson.GensonBuilder; |
|
- | 5 | import org.json.JSONException; |
|
- | 6 | import org.json.JSONObject; |
|
3 | import pt.estgp.estgweb.domain.CourseUnitEvaluation; |
7 | import pt.estgp.estgweb.domain.CourseUnitEvaluation; |
- | 8 | import pt.estgp.estgweb.domain.CourseUnitEvaluationImpl; |
|
- | 9 | import pt.estgp.estgweb.domain.utils.JsonView; |
|
- | 10 | import pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.components.ReportTeacher; |
|
- | 11 | import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
|
4 | 12 | ||
- | 13 | import java.util.Date; |
|
5 | import java.util.List; |
14 | import java.util.List; |
6 | 15 | ||
7 | /** |
16 | /** |
8 | * Created by jorgemachado on 14/10/17. |
17 | * Created by jorgemachado on 14/10/17. |
9 | */ |
18 | */ |
10 | public class CourseUnitSection extends DocumentSection |
19 | public class CourseUnitSection extends DocumentSection implements JsonView |
11 | { |
20 | { |
12 | private long courseUnitId; |
21 | private long courseUnitId; |
13 | private 1.5.0/docs/api/java/lang/String.html">String courseUnitName; |
22 | private 1.5.0/docs/api/java/lang/String.html">String name; |
14 | private 1.5.0/docs/api/java/lang/String.html">String sigesCode; |
23 | private 1.5.0/docs/api/java/lang/String.html">String sigesCode; |
- | 24 | private 1.5.0/docs/api/java/lang/String.html">String period; |
|
15 | private ReportTeacher responsableTeacher; |
25 | private ReportTeacher responsableTeacher; |
- | 26 | private int anoPlano; |
|
16 | private List<ReportTeacher> teachers; |
27 | private List<ReportTeacher> teachers; |
17 | 28 | ||
18 | private CourseUnitEvaluation courseUnitEvaluation; |
29 | private CourseUnitEvaluationImpl courseUnitEvaluation; |
19 | 30 | ||
- | 31 | public CourseUnitSection() |
|
- | 32 | { |
|
- | 33 | } |
|
- | 34 | ||
- | 35 | public CourseUnitSection(long courseUnitId, |
|
- | 36 | 1.5.0/docs/api/java/lang/String.html">String courseUnitName, |
|
- | 37 | 1.5.0/docs/api/java/lang/String.html">String sigesCode, |
|
- | 38 | int anoPlano, |
|
- | 39 | 1.5.0/docs/api/java/lang/String.html">String period, |
|
- | 40 | ReportTeacher responsableTeacher, |
|
- | 41 | List<ReportTeacher> teachers, |
|
- | 42 | CourseUnitEvaluationImpl courseUnitEvaluation) { |
|
- | 43 | this.courseUnitId = courseUnitId; |
|
- | 44 | this.name = courseUnitName; |
|
- | 45 | this.sigesCode = sigesCode; |
|
- | 46 | this.anoPlano = anoPlano; |
|
- | 47 | this.period = period; |
|
- | 48 | this.responsableTeacher = responsableTeacher; |
|
- | 49 | this.teachers = teachers; |
|
- | 50 | this.courseUnitEvaluation = courseUnitEvaluation; |
|
- | 51 | super.setTitle(courseUnitName); |
|
- | 52 | } |
|
20 | 53 | ||
21 | public long getCourseUnitId() { |
54 | public long getCourseUnitId() { |
22 | return courseUnitId; |
55 | return courseUnitId; |
23 | } |
56 | } |
24 | 57 | ||
25 | public void setCourseUnitId(long courseUnitId) { |
58 | public void setCourseUnitId(long courseUnitId) { |
26 | this.courseUnitId = courseUnitId; |
59 | this.courseUnitId = courseUnitId; |
27 | } |
60 | } |
28 | 61 | ||
- | 62 | public 1.5.0/docs/api/java/lang/String.html">String getPeriod() { return period; } |
|
- | 63 | ||
- | 64 | public void setPeriod(1.5.0/docs/api/java/lang/String.html">String period) { this.period = period; } |
|
- | 65 | ||
29 | public 1.5.0/docs/api/java/lang/String.html">String getCourseUnitName() { |
66 | public 1.5.0/docs/api/java/lang/String.html">String getName() { |
30 | return courseUnitName; |
67 | return name; |
31 | } |
68 | } |
32 | 69 | ||
33 | public void setCourseUnitName(1.5.0/docs/api/java/lang/String.html">String courseUnitName) { |
70 | public void setName(1.5.0/docs/api/java/lang/String.html">String name) { |
34 | this.courseUnitName = courseUnitName; |
71 | this.name = name; |
35 | } |
72 | } |
36 | 73 | ||
37 | public 1.5.0/docs/api/java/lang/String.html">String getSigesCode() { |
74 | public 1.5.0/docs/api/java/lang/String.html">String getSigesCode() { |
38 | return sigesCode; |
75 | return sigesCode; |
39 | } |
76 | } |
Line 60... | Line 97... | ||
60 | 97 | ||
61 | public CourseUnitEvaluation getCourseUnitEvaluation() { |
98 | public CourseUnitEvaluation getCourseUnitEvaluation() { |
62 | return courseUnitEvaluation; |
99 | return courseUnitEvaluation; |
63 | } |
100 | } |
64 | 101 | ||
65 | public void setCourseUnitEvaluation(CourseUnitEvaluation courseUnitEvaluation) { |
102 | public void setCourseUnitEvaluation(CourseUnitEvaluationImpl courseUnitEvaluation) { |
66 | this.courseUnitEvaluation = courseUnitEvaluation; |
103 | this.courseUnitEvaluation = courseUnitEvaluation; |
67 | } |
104 | } |
- | 105 | ||
- | 106 | public int getAnoPlano() { |
|
- | 107 | return anoPlano; |
|
- | 108 | } |
|
- | 109 | ||
- | 110 | public void setAnoPlano(int anoPlano) { |
|
- | 111 | this.anoPlano = anoPlano; |
|
- | 112 | } |
|
- | 113 | ||
- | 114 | private static Genson gensonGenericLoad; |
|
- | 115 | static{ |
|
- | 116 | gensonGenericLoad = new GensonBuilder() |
|
- | 117 | .useMethods(true) |
|
- | 118 | .useFields(true) |
|
- | 119 | .useRuntimeType(true) |
|
- | 120 | .useClassMetadata(true) |
|
- | 121 | .useDateAsTimestamp(true) |
|
- | 122 | .exclude(1.5.0/docs/api/java/lang/Class.html">Class.class) |
|
- | 123 | .exclude(5+0%2Fdocs%2Fapi+Date">Date.class) |
|
- | 124 | .exclude(java.sql.5+0%2Fdocs%2Fapi+Timestamp">Timestamp.class) |
|
- | 125 | .exclude(java.sql.5+0%2Fdocs%2Fapi+Date">Date.class) |
|
- | 126 | .create(); |
|
- | 127 | } |
|
- | 128 | ||
- | 129 | public static CourseUnitSection fromJson(1.5.0/docs/api/java/lang/String.html">String json) |
|
- | 130 | { |
|
- | 131 | return gensonGenericLoad.deserialize(json,CourseUnitSection.class); |
|
- | 132 | } |
|
- | 133 | ||
- | 134 | public static CourseUnitSection[] fromJsonArray(1.5.0/docs/api/java/lang/String.html">String jsonArray) |
|
- | 135 | { |
|
- | 136 | return gensonGenericLoad.deserialize(jsonArray,CourseUnitSection[].class); |
|
- | 137 | } |
|
- | 138 | ||
- | 139 | ||
- | 140 | ||
- | 141 | public List<String> getJsonExcludedProperties() { |
|
- | 142 | return null; |
|
- | 143 | } |
|
- | 144 | ||
- | 145 | /** |
|
- | 146 | * Generic Json Object only for local class methods |
|
- | 147 | * @return |
|
- | 148 | * @throws org.json.JSONException |
|
- | 149 | */ |
|
- | 150 | public JSONObject toJsonObject() throws JSONException |
|
- | 151 | { |
|
- | 152 | return new JSONObject(toJson()); |
|
- | 153 | } |
|
- | 154 | ||
- | 155 | /** |
|
- | 156 | * * Generic Json Object only for local class methods |
|
- | 157 | * @return |
|
- | 158 | * @throws java.io.IOException |
|
- | 159 | */ |
|
- | 160 | public 1.5.0/docs/api/java/lang/String.html">String toJson() |
|
- | 161 | { |
|
- | 162 | return gensonGenericLoad.serialize(this); |
|
- | 163 | } |
|
68 | } |
164 | } |