Rev 1876 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1876 | Rev 1918 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
1 | package pt.estgp.estgweb.services.courses.coursereport.documentmodel; |
2 | 2 | ||
3 | import com.owlike.genson.Genson; |
3 | import com.owlike.genson.Genson; |
4 | import com.owlike.genson.GensonBuilder; |
4 | import com.owlike.genson.GensonBuilder; |
- | 5 | import jomm.dao.impl.AbstractDao; |
|
5 | import org.apache.log4j.Logger; |
6 | import org.apache.log4j.Logger; |
6 | import org.json.JSONException; |
7 | import org.json.JSONException; |
7 | import org.json.JSONObject; |
8 | import org.json.JSONObject; |
8 | import pt.estgp.estgweb.domain.Course; |
9 | import pt.estgp.estgweb.domain.Course; |
- | 10 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
|
9 | import pt.estgp.estgweb.domain.utils.JsonView; |
11 | import pt.estgp.estgweb.domain.utils.JsonView; |
10 | import pt.estgp.estgweb.utils.documentBuilder.Document; |
12 | import pt.estgp.estgweb.utils.documentBuilder.Document; |
11 | import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
13 | import pt.estgp.estgweb.utils.documentBuilder.DocumentSection; |
12 | 14 | ||
13 | import java.util.Date; |
15 | import java.util.Date; |
Line 63... | Line 65... | ||
63 | setCourseName(c.getName()); |
65 | setCourseName(c.getName()); |
64 | 66 | ||
65 | //1 - Introducao |
67 | //1 - Introducao |
66 | IntroSection introSection = new IntroSection(); |
68 | IntroSection introSection = new IntroSection(); |
67 | introSection.init(); |
69 | introSection.init(); |
- | 70 | ||
68 | getSections().add(introSection); |
71 | getSections().add(introSection); |
69 | 72 | ||
70 | //2 - Mapa Sintese dos Relatórios dos Responsáveis das UC's |
73 | //2 - Mapa Sintese dos Relatórios dos Responsáveis das UC's |
71 | ReportsUcSummarySection reportsUcSummarySection = new ReportsUcSummarySection(); |
74 | ReportsUcSummarySection reportsUcSummarySection = new ReportsUcSummarySection(); |
72 | reportsUcSummarySection.init(); |
75 | reportsUcSummarySection.init(); |
73 | getSections().add(reportsUcSummarySection); |
76 | getSections().add(reportsUcSummarySection); |
74 | 77 | ||
75 | //3 - Resultados da Aprendizagem |
78 | //3 - Resultados da Aprendizagem |
76 | LearningResultsSection learningResultsSection = new LearningResultsSection(); |
79 | LearningResultsSection learningResultsSection = new LearningResultsSection(); |
77 | learningResultsSection.init(); |
80 | learningResultsSection.init(); |
78 | getSections().add(learningResultsSection); |
81 | getSections().add(learningResultsSection); |
79 | 82 | ||
80 | //4 - Inquéritos |
83 | //4 - Inquéritos |
81 | SurveysSection surveysSection = new SurveysSection(); |
84 | SurveysSection surveysSection = new SurveysSection(); |
82 | surveysSection.init(); |
85 | surveysSection.init(); |
83 | getSections().add(surveysSection); |
86 | getSections().add(surveysSection); |
84 | 87 | ||
85 | //5 - Conclusões |
88 | //5 - Conclusões |
86 | ConclusionsSection conclusionsSection = new ConclusionsSection(); |
89 | ConclusionsSection conclusionsSection = new ConclusionsSection(); |
87 | conclusionsSection.init(); |
90 | conclusionsSection.init(); |
88 | getSections().add(conclusionsSection); |
91 | getSections().add(conclusionsSection); |
89 | 92 | ||
90 | //5 - Unidades Curriculares |
93 | //5 - Unidades Curriculares |
Line 156... | Line 159... | ||
156 | public 1.5.0/docs/api/java/lang/String.html">String toJson() |
159 | public 1.5.0/docs/api/java/lang/String.html">String toJson() |
157 | { |
160 | { |
158 | return gensonGenericLoad.serialize(this); |
161 | return gensonGenericLoad.serialize(this); |
159 | } |
162 | } |
160 | 163 | ||
- | 164 | public static void main(1.5.0/docs/api/java/lang/String.html">String[] args) |
|
- | 165 | { |
|
- | 166 | CourseReportDocument d = new CourseReportDocument(); |
|
- | 167 | ||
- | 168 | AbstractDao.getCurrentSession().beginTransaction(); |
|
- | 169 | ||
- | 170 | List<Course> cursos = DaoFactory.getCourseDaoImpl().findAll(); |
|
- | 171 | ||
- | 172 | ||
- | 173 | d.init(cursos.get(0),"201718"); |
|
- | 174 | ||
- | 175 | 1.5.0/docs/api/java/lang/String.html">String json = d.toJson(); |
|
- | 176 | 1.5.0/docs/api/java/lang/System.html">System.out.println(json); |
|
- | 177 | CourseReportDocument d2 = CourseReportDocument.fromJson(json); |
|
- | 178 | 1.5.0/docs/api/java/lang/System.html">System.out.println(d2.toJson()); |
|
- | 179 | ||
- | 180 | AbstractDao.getCurrentSession().getTransaction().commit(); |
|
- | 181 | } |
|
- | 182 | ||
161 | 183 | ||
162 | 184 | ||
163 | } |
- | |
164 | 185 | } |
|
- | 186 |