Rev 1922 | Rev 1990 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1922 | Rev 1926 | ||
---|---|---|---|
Line 488... | Line 488... | ||
488 | public 1.5.0/docs/api/java/lang/String.html">String saveCourseReportDoc(1.5.0/docs/api/java/lang/String.html">String reportDocumentJson,UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
488 | public 1.5.0/docs/api/java/lang/String.html">String saveCourseReportDoc(1.5.0/docs/api/java/lang/String.html">String reportDocumentJson,UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
489 | 489 | ||
490 | CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson); |
490 | CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson); |
491 | 491 | ||
492 | Course course = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode()); |
492 | Course course = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode()); |
493 | CourseYear courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear2(reportDocument.getCourseCode(), reportDocument.getYear()); |
493 | List<CourseYear> courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear(reportDocument.getCourseCode(), reportDocument.getYear()); |
494 | 494 | ||
495 | if(courseYr == null){ |
495 | if(courseYr.isEmpty()){ |
496 | courseYr = DomainObjectFactory.createCourseYearImpl(); |
496 | courseYr.add(DomainObjectFactory.createCourseYearImpl()); |
497 | courseYr.setCourse(course); |
497 | courseYr.get(0).setCourse(course); |
498 | course.getCourseYears().add(courseYr); |
498 | course.getCourseYears().add(courseYr.get(0)); |
499 | courseYr.setImportYear(reportDocument.getYear()); |
499 | courseYr.get(0).setImportYear(reportDocument.getYear()); |
500 | DaoFactory.getCourseYearDaoImpl().save(courseYr); |
500 | DaoFactory.getCourseYearDaoImpl().save(courseYr.get(0)); |
501 | } |
501 | } |
502 | courseYr.setReportSave(reportDocumentJson); |
- | |
503 | - | ||
504 | return reportDocument.toJson(); |
- | |
505 | 502 | ||
- | 503 | courseYr.get(0).setCourseReportDocument(reportDocumentJson); |
|
506 | 504 | ||
- | 505 | return reportDocument.toJson(); |
|
507 | } |
506 | } |
508 | 507 | ||
509 | /* Ler o relatorio */ |
508 | /* Ler o relatorio */ |
510 | 509 | ||
511 | public 1.5.0/docs/api/java/lang/String.html">String loadCourseReportDoc(UserSession session, 1.5.0/docs/api/java/lang/String.html">String year, 1.5.0/docs/api/java/lang/String.html">String courseCode) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
510 | public 1.5.0/docs/api/java/lang/String.html">String loadCourseReportDoc(UserSession session, 1.5.0/docs/api/java/lang/String.html">String year, 1.5.0/docs/api/java/lang/String.html">String courseCode) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
- | 511 | ||
512 | CourseYear courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear2(courseCode, year); |
512 | List<CourseYear> courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear(courseCode, year); |
- | 513 | ||
513 | 1.5.0/docs/api/java/lang/String.html">String courseReport = null; |
514 | 1.5.0/docs/api/java/lang/String.html">String courseReport = null; |
- | 515 | if(!courseYr.isEmpty()){ |
|
- | 516 | courseReport = courseYr.get(0).getCourseReportDocument(); |
|
- | 517 | } |
|
- | 518 | ||
514 | if(courseYr != null){ |
519 | if(courseReport == null){ |
515 | courseReport = courseYr.getReportSave(); |
520 | CourseReportDocument report = null; |
- | 521 | try{ |
|
- | 522 | report = new CourseReportServices().createNewCourseReportDocument(courseCode, year); |
|
- | 523 | courseReport = report.toJson(); |
|
- | 524 | } catch (JSONException e) { |
|
- | 525 | e.printStackTrace(); |
|
- | 526 | } |
|
516 | } |
527 | } |
517 | 528 | ||
518 | return courseReport; |
529 | return courseReport; |
519 | } |
530 | } |
520 | 531 |