Subversion Repositories bacoAlunos

Rev

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

Rev 1928 Rev 1934
Line 408... Line 408...
408
 
408
 
409
    /**
409
    /**
410
     * Este servico gera um grafico com a taxa global de aproveitamento e grava-o no repositorio digital
410
     * Este servico gera um grafico com a taxa global de aproveitamento e grava-o no repositorio digital
411
     * devolvendo o respectivo RepositoryFile4JsonView em json para poder ser anexado ao objecto imagem do
411
     * devolvendo o respectivo RepositoryFile4JsonView em json para poder ser anexado ao objecto imagem do
412
     * widget do grafico
412
     * widget do grafico
413
     * @param reportDocumentJson
413
     * @param reportDocument
414
     * @param session
414
     * @param session
415
     * @return
415
     * @return
416
     * @throws IOException
416
     * @throws IOException
417
     */
417
     */
418
    public 1.5.0/docs/api/java/lang/String.html">String generateGlobalLearningResultsChartImg(1.5.0/docs/api/java/lang/String.html">String reportDocumentJson,UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException {
418
    public 1.5.0/docs/api/java/lang/String.html">String generateGlobalLearningResultsChartImg(CourseReportDocument reportDocument,UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException {
419
 
419
 
420
        CourseReportDocument reportDocument =  CourseReportDocument.fromJson(reportDocumentJson);
-
 
421
        LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
420
        LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
422
        LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
421
        LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
423
        GlobalLearningResultsChartImg chartImg = (GlobalLearningResultsChartImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartImg.class);
422
        GlobalLearningResultsChartImg chartImg = (GlobalLearningResultsChartImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartImg.class);
424
 
423
 
425
 
424
 
Line 443... Line 442...
443
        else
442
        else
444
        {
443
        {
445
            view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session);
444
            view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session);
446
        }
445
        }
447
        chartImg.setImage(view);
446
        chartImg.setImage(view);
448
        //TODO FALTA GUARDAR O JSON NO CURSO
447
        saveCourseReportDocument(reportDocument, session);
449
        return view.toJson();
448
        return view.toJson();
450
    }
449
    }
451
 
450
 
452
    public 1.5.0/docs/api/java/lang/String.html">String generateGenerateGlobalLearningResultsChartYearImg(1.5.0/docs/api/java/lang/String.html">String reportDocumentJson,UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException {
451
    public 1.5.0/docs/api/java/lang/String.html">String generateGenerateGlobalLearningResultsChartYearImg(CourseReportDocument reportDocument,UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException {
453
 
452
 
454
        CourseReportDocument reportDocument =  CourseReportDocument.fromJson(reportDocumentJson);
-
 
455
        LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
453
        LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
456
        LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
454
        LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
457
        GlobalLearningResultsChartYearImg chartImg = (GlobalLearningResultsChartYearImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartYearImg.class);
455
        GlobalLearningResultsChartYearImg chartImg = (GlobalLearningResultsChartYearImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartYearImg.class);
458
 
456
 
459
        UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
457
        UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
Line 476... Line 474...
476
        else
474
        else
477
        {
475
        {
478
            view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session);
476
            view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session);
479
        }
477
        }
480
        chartImg.setImage(view);
478
        chartImg.setImage(view);
481
        //TODO FALTA GUARDAR O JSON NO CURSO
479
        saveCourseReportDocument(reportDocument, session);
482
        return view.toJson();
480
        return view.toJson();
483
    }
481
    }
484
 
482
 
485
    public 1.5.0/docs/api/java/lang/String.html">String generateGenerateGlobalLearningResultsChartSem(1.5.0/docs/api/java/lang/String.html">String reportDocumentJson, 1.5.0/docs/api/java/lang/String.html">String semesterCode, UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException {
483
    public 1.5.0/docs/api/java/lang/String.html">String generateGenerateGlobalLearningResultsChartSem(CourseReportDocument reportDocument, 1.5.0/docs/api/java/lang/String.html">String semesterCode, UserSession session) throws 1.5.0/docs/api/java/io/IOException.html">IOException {
486
 
484
 
487
        CourseReportDocument reportDocument =  CourseReportDocument.fromJson(reportDocumentJson);
-
 
488
        LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
485
        LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
489
        LearningAnalysisSection learningAnalysisSection = (LearningAnalysisSection) learningResultsSection.findSection(LearningAnalysisSection.class);
486
        LearningAnalysisSection learningAnalysisSection = (LearningAnalysisSection) learningResultsSection.findSection(LearningAnalysisSection.class);
490
        LearningResultsChartSem chartImg = (LearningResultsChartSem) learningAnalysisSection.findDocComponent(LearningResultsChartSem.class, semesterCode);
487
        LearningResultsChartSem chartImg = (LearningResultsChartSem) learningAnalysisSection.findDocComponent(LearningResultsChartSem.class, semesterCode);
491
 
488
 
492
        UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
489
        UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
Line 509... Line 506...
509
        else
506
        else
510
        {
507
        {
511
            view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session);
508
            view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.publicDomain,session);
512
        }
509
        }
513
        chartImg.setImage(view);
510
        chartImg.setImage(view);
514
        //TODO FALTA GUARDAR O JSON NO CURSO
511
        saveCourseReportDocument(reportDocument, session);
515
        return view.toJson();
512
        return view.toJson();
516
    }
513
    }
517
 
514
 
518
    public 1.5.0/docs/api/java/lang/String.html">String saveCourseReportDocument(1.5.0/docs/api/java/lang/String.html">String reportDocumentJson,UserSession session) {
515
    public 1.5.0/docs/api/java/lang/String.html">String saveCourseReportDocument(CourseReportDocument reportDocument, UserSession session) {
519
        CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson);
-
 
520
 
-
 
521
        Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode());
-
 
522
        CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(reportDocument.getCourseCode(), reportDocument.getYear());
516
        CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(reportDocument.getCourseCode(), reportDocument.getYear());
523
 
517
 
524
        if (cy == null) {
518
        if (cy == null) {
-
 
519
            Course c = DaoFactory.getCourseDaoImpl().findCourseByCode(reportDocument.getCourseCode());
525
            cy = DomainObjectFactory.createCourseYearImpl();
520
            cy = DomainObjectFactory.createCourseYearImpl();
526
            cy.setCourse(c);
521
            cy.setCourse(c);
527
            c.getCourseYears().add(cy);
522
            c.getCourseYears().add(cy);
528
            cy.setImportYear(reportDocument.getYear());
523
            cy.setImportYear(reportDocument.getYear());
529
            DaoFactory.getCourseYearDaoImpl().save(cy);
524
            DaoFactory.getCourseYearDaoImpl().save(cy);
530
        }
525
        }
531
        cy.setCourseReportDocument(reportDocumentJson);
526
        cy.setCourseReportDocument(reportDocument.toJson());
532
 
527
 
533
        return reportDocument.toJson();
528
        return reportDocument.toJson();
534
    }
529
    }
535
 
530
 
536
    public 1.5.0/docs/api/java/lang/String.html">String loadCourseReportDocument(1.5.0/docs/api/java/lang/String.html">String courseCode,1.5.0/docs/api/java/lang/String.html">String year,UserSession session) {
531
    public 1.5.0/docs/api/java/lang/String.html">String loadCourseReportDocument(1.5.0/docs/api/java/lang/String.html">String courseCode, 1.5.0/docs/api/java/lang/String.html">String year, UserSession session) {
537
        CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(courseCode, year);
532
        CourseYear cy = DaoFactory.getCourseYearDaoImpl().findCourseYearU(courseCode, year);
538
 
533
 
539
        1.5.0/docs/api/java/lang/String.html">String courseReportJson = null;
534
        1.5.0/docs/api/java/lang/String.html">String courseReportJson = null;
540
        if (cy != null) {
535
        if (cy != null) {
541
            courseReportJson = cy.getCourseReportDocument();
536
            courseReportJson = cy.getCourseReportDocument();
Line 543... Line 538...
543
 
538
 
544
        if (courseReportJson == null) {
539
        if (courseReportJson == null) {
545
            try {
540
            try {
546
                CourseReportDocument courseReport = createNewCourseReportDocument(courseCode, year);
541
                CourseReportDocument courseReport = createNewCourseReportDocument(courseCode, year);
547
                courseReportJson = courseReport.toJson();
542
                courseReportJson = courseReport.toJson();
548
                saveCourseReportDocument(courseReportJson, session);
543
                saveCourseReportDocument(courseReport, session);
549
            } catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) {
544
            } catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) {
550
                1.5.0/docs/api/java/lang/System.html">System.out.println(e);
545
                1.5.0/docs/api/java/lang/System.html">System.out.println(e);
551
                e.printStackTrace();
546
                e.printStackTrace();
552
            }
547
            }
553
        }
548
        }