410,14 → 410,13 |
* Este servico gera um grafico com a taxa global de aproveitamento e grava-o no repositorio digital |
* devolvendo o respectivo RepositoryFile4JsonView em json para poder ser anexado ao objecto imagem do |
* widget do grafico |
* @param reportDocumentJson |
* @param reportDocument |
* @param session |
* @return |
* @throws IOException |
*/ |
public String generateGlobalLearningResultsChartImg(String reportDocumentJson,UserSession session) throws IOException { |
public String generateGlobalLearningResultsChartImg(CourseReportDocument reportDocument,UserSession session) throws IOException { |
|
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson); |
LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class); |
LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class); |
GlobalLearningResultsChartImg chartImg = (GlobalLearningResultsChartImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartImg.class); |
445,13 → 444,12 |
view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session); |
} |
chartImg.setImage(view); |
//TODO FALTA GUARDAR O JSON NO CURSO |
saveCourseReportDocument(reportDocument, session); |
return view.toJson(); |
} |
|
public String generateGenerateGlobalLearningResultsChartYearImg(String reportDocumentJson,UserSession session) throws IOException { |
public String generateGenerateGlobalLearningResultsChartYearImg(CourseReportDocument reportDocument,UserSession session) throws IOException { |
|
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson); |
LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class); |
LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class); |
GlobalLearningResultsChartYearImg chartImg = (GlobalLearningResultsChartYearImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartYearImg.class); |
478,13 → 476,12 |
view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session); |
} |
chartImg.setImage(view); |
//TODO FALTA GUARDAR O JSON NO CURSO |
saveCourseReportDocument(reportDocument, session); |
return view.toJson(); |
} |
|
public String generateGenerateGlobalLearningResultsChartSem(String reportDocumentJson, String semesterCode, UserSession session) throws IOException { |
public String generateGenerateGlobalLearningResultsChartSem(CourseReportDocument reportDocument, String semesterCode, UserSession session) throws IOException { |
|
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson); |
LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class); |
LearningAnalysisSection learningAnalysisSection = (LearningAnalysisSection) learningResultsSection.findSection(LearningAnalysisSection.class); |
LearningResultsChartSem chartImg = (LearningResultsChartSem) learningAnalysisSection.findDocComponent(LearningResultsChartSem.class, semesterCode); |
511,29 → 508,27 |
view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session); |
} |
chartImg.setImage(view); |
//TODO FALTA GUARDAR O JSON NO CURSO |
saveCourseReportDocument(reportDocument, session); |
return view.toJson(); |
} |
|
public String saveCourseReportDocument(String reportDocumentJson,UserSession session) { |
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson); |
|
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode()); |
public String saveCourseReportDocument(CourseReportDocument reportDocument, UserSession session) { |
CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(reportDocument.getCourseCode(), reportDocument.getYear()); |
|
if (cy == null) { |
Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode()); |
cy = DomainObjectFactory.createCourseYearImpl(); |
cy.setCourse(c); |
c.getCourseYears().add(cy); |
cy.setImportYear(reportDocument.getYear()); |
DaoFactory.getCourseYearDaoImpl().save(cy); |
} |
cy.setCourseReportDocument(reportDocumentJson); |
cy.setCourseReportDocument(reportDocument.toJson()); |
|
return reportDocument.toJson(); |
} |
|
public String loadCourseReportDocument(String courseCode,String year,UserSession session) { |
public String loadCourseReportDocument(String courseCode, String year, UserSession session) { |
CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(courseCode, year); |
|
String courseReportJson = null; |
545,7 → 540,7 |
try { |
CourseReportDocument courseReport = createNewCourseReportDocument(courseCode, year); |
courseReportJson = courseReport.toJson(); |
saveCourseReportDocument(courseReportJson, session); |
saveCourseReportDocument(courseReport, session); |
} catch (Throwable e) { |
System.out.println(e); |
e.printStackTrace(); |