Rev 1814 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1830 | jmachado | 1 | package pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport; |
1814 | jmachado | 2 | |
1830 | jmachado | 3 | import com.owlike.genson.Genson; |
4 | import com.owlike.genson.GensonBuilder; |
||
5 | import org.json.JSONException; |
||
6 | import org.json.JSONObject; |
||
1814 | jmachado | 7 | import pt.estgp.estgweb.domain.CourseUnitEvaluation; |
1830 | jmachado | 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; |
||
1814 | jmachado | 12 | |
1830 | jmachado | 13 | import java.util.Date; |
1814 | jmachado | 14 | import java.util.List; |
15 | |||
16 | /** |
||
17 | * Created by jorgemachado on 14/10/17. |
||
18 | */ |
||
1830 | jmachado | 19 | public class CourseUnitSection extends DocumentSection implements JsonView |
1814 | jmachado | 20 | { |
21 | private long courseUnitId; |
||
1830 | jmachado | 22 | private 1.5.0/docs/api/java/lang/String.html">String name; |
1814 | jmachado | 23 | private 1.5.0/docs/api/java/lang/String.html">String sigesCode; |
1830 | jmachado | 24 | private 1.5.0/docs/api/java/lang/String.html">String period; |
1814 | jmachado | 25 | private ReportTeacher responsableTeacher; |
1830 | jmachado | 26 | private int anoPlano; |
1814 | jmachado | 27 | private List<ReportTeacher> teachers; |
28 | |||
1830 | jmachado | 29 | private CourseUnitEvaluationImpl courseUnitEvaluation; |
1814 | jmachado | 30 | |
1830 | jmachado | 31 | public CourseUnitSection() |
32 | { |
||
33 | } |
||
1814 | jmachado | 34 | |
1830 | jmachado | 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 | } |
||
53 | |||
1814 | jmachado | 54 | public long getCourseUnitId() { |
55 | return courseUnitId; |
||
56 | } |
||
57 | |||
58 | public void setCourseUnitId(long courseUnitId) { |
||
59 | this.courseUnitId = courseUnitId; |
||
60 | } |
||
61 | |||
1830 | jmachado | 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 | |||
66 | public 1.5.0/docs/api/java/lang/String.html">String getName() { |
||
67 | return name; |
||
1814 | jmachado | 68 | } |
69 | |||
1830 | jmachado | 70 | public void setName(1.5.0/docs/api/java/lang/String.html">String name) { |
71 | this.name = name; |
||
1814 | jmachado | 72 | } |
73 | |||
74 | public 1.5.0/docs/api/java/lang/String.html">String getSigesCode() { |
||
75 | return sigesCode; |
||
76 | } |
||
77 | |||
78 | public void setSigesCode(1.5.0/docs/api/java/lang/String.html">String sigesCode) { |
||
79 | this.sigesCode = sigesCode; |
||
80 | } |
||
81 | |||
82 | public ReportTeacher getResponsableTeacher() { |
||
83 | return responsableTeacher; |
||
84 | } |
||
85 | |||
86 | public void setResponsableTeacher(ReportTeacher responsableTeacher) { |
||
87 | this.responsableTeacher = responsableTeacher; |
||
88 | } |
||
89 | |||
90 | public List<ReportTeacher> getTeachers() { |
||
91 | return teachers; |
||
92 | } |
||
93 | |||
94 | public void setTeachers(List<ReportTeacher> teachers) { |
||
95 | this.teachers = teachers; |
||
96 | } |
||
97 | |||
98 | public CourseUnitEvaluation getCourseUnitEvaluation() { |
||
99 | return courseUnitEvaluation; |
||
100 | } |
||
101 | |||
1830 | jmachado | 102 | public void setCourseUnitEvaluation(CourseUnitEvaluationImpl courseUnitEvaluation) { |
1814 | jmachado | 103 | this.courseUnitEvaluation = courseUnitEvaluation; |
104 | } |
||
1830 | jmachado | 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 | } |
||
1814 | jmachado | 164 | } |