Subversion Repositories bacoAlunos

Rev

Rev 1994 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1994 Rev 1996
Line 11... Line 11...
11
import pt.estgp.estgweb.domain.dao.DaoFactory;
11
import pt.estgp.estgweb.domain.dao.DaoFactory;
12
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
12
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
13
import pt.estgp.estgweb.services.courses.coursereport.CourseReportUtils;
13
import pt.estgp.estgweb.services.courses.coursereport.CourseReportUtils;
14
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.*;
14
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.*;
15
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.CourseUnitSection;
15
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.courseunitreport.CourseUnitSection;
-
 
16
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.LearningAnalysisSection;
16
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.LearningGlobalAnalysisSection;
17
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.LearningGlobalAnalysisSection;
17
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.*;
18
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.*;
18
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.CourseUnitDtpStat;
19
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.CourseUnitDtpStat;
19
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.UnitDtpSemester;
20
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.UnitDtpSemester;
20
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.UnitsDtpTable;
21
import pt.estgp.estgweb.services.courses.coursereport.documentmodel.reportucsummary.UnitsDtpTable;
Line 481... Line 482...
481
        //TODO FALTA GUARDAR O JSON NO CURSO
482
        //TODO FALTA GUARDAR O JSON NO CURSO
482
        return view.toJson();
483
        return view.toJson();
483
    }
484
    }
484
 
485
 
485
 
486
 
-
 
487
    /* Grafico 3 */
-
 
488
    public 1.5.0/docs/api/java/lang/String.html">String generateLearningResultsChartSem(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
 
-
 
490
        CourseReportDocument reportDocument =  CourseReportDocument.fromJson(reportDocumentJson);
-
 
491
        LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
-
 
492
        LearningAnalysisSection learningAnalysisSection = (LearningAnalysisSection) learningResultsSection.findSection(LearningAnalysisSection.class);
-
 
493
        /* alt */
-
 
494
        LearningResultsChartSem chartImg = (LearningResultsChartSem) learningAnalysisSection.findDocComponent(LearningResultsChartSem.class);
-
 
495
 
-
 
496
        UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
-
 
497
 
-
 
498
 
-
 
499
        FileUploaded fileUploaded = chartImg.generateChart2tmp(table,reportDocument);
-
 
500
 
-
 
501
        RepositoryService repositoryService = new RepositoryService();
-
 
502
 
-
 
503
        boolean imageInitialized = chartImg.getImage() != null
-
 
504
                &&
-
 
505
                chartImg.getImage().getIdentifier() != null;
-
 
506
 
-
 
507
        RepositoryFile4JsonView view;
-
 
508
        if(imageInitialized)
-
 
509
        {
-
 
510
            1.5.0/docs/api/java/lang/String.html">String identifier = chartImg.getImage().getIdentifier();
-
 
511
            view = repositoryService.replaceRepositoryFileFromFileUpload(identifier, fileUploaded, ResourceAccessControlEnum.privateDomain, session);
-
 
512
        }
-
 
513
        else
-
 
514
        {
-
 
515
            view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.privateDomain,session);
-
 
516
        }
-
 
517
        chartImg.setImage(view);
-
 
518
        //TODO FALTA GUARDAR O JSON NO CURSO
-
 
519
        return view.toJson();
-
 
520
    }
-
 
521
 
-
 
522
 
486
 
523
 
487
    /*  Guardar report */
524
    /*  Guardar report */
488
 
525
 
489
    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 {
526
    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 {
490
 
527
 
491
        CourseReportDocument reportDocument =  CourseReportDocument.fromJson(reportDocumentJson);
528
        CourseReportDocument reportDocument =  CourseReportDocument.fromJson(reportDocumentJson);
492
 
529
 
493
        Course course = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode());
530
        Course course = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode());
494
        List<CourseYear> courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear(reportDocument.getCourseCode(), reportDocument.getYear());
531
        List<CourseYear> courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear(reportDocument.getCourseCode(), reportDocument.getYear());
Line 506... Line 543...
506
        return reportDocument.toJson();
543
        return reportDocument.toJson();
507
    }
544
    }
508
 
545
 
509
    /* Ler o relatorio */
546
    /* Ler o relatorio */
510
 
547
 
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 {
548
    public 1.5.0/docs/api/java/lang/String.html">String loadCourseReportDoc(1.5.0/docs/api/java/lang/String.html">String courseCode, 1.5.0/docs/api/java/lang/String.html">String year, UserSession session ) throws 1.5.0/docs/api/java/io/IOException.html">IOException {
512
 
549
 
513
        List<CourseYear> courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear(courseCode, year);
550
        List<CourseYear> courseYr = DaoFactory.getCourseYearDaoImpl().findCourseYear(courseCode, year);
514
 
-
 
515
        1.5.0/docs/api/java/lang/String.html">String courseReport = null;
551
        1.5.0/docs/api/java/lang/String.html">String courseReport = null;
-
 
552
 
516
        if(!courseYr.isEmpty()){
553
        if(!courseYr.isEmpty()){
517
            courseReport =  courseYr.get(0).getCourseReportDocument();
554
            courseReport =  courseYr.get(0).getCourseReportDocument();
518
        }
555
        }
519
 
556
 
520
        if(courseReport == null){
557
        if(courseReport == null){
521
            try{
558
            try{
522
                courseReport = new CourseReportServices().createNewCourseReportDocument(courseCode, year).toString();
559
                courseReport = new CourseReportServices().createNewCourseReportDocument(courseCode, year).toJson();
-
 
560
 
-
 
561
                //saveCourseReportDoc(courseReport, session);
523
            } catch (JSONException e) {
562
            } catch (JSONException e) {
524
                e.printStackTrace();
563
                e.printStackTrace();
525
            }
564
            }
526
        }
565
        }
527
 
566