Subversion Repositories bacoAlunos

Rev

Rev 1626 | Rev 1703 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors;

import jomm.dao.impl.AbstractDao;
import jomm.utils.FilesUtils;
import org.apache.log4j.Logger;
import org.hibernate.Query;
import pt.estgp.estgweb.domain.OlapStarFactQuestionarioAnswer;
import pt.estgp.estgweb.domain.QuestionarioReportFileAno;
import pt.estgp.estgweb.domain.QuestionarioReportFileGroupAno;
import pt.estgp.estgweb.domain.dao.DaoFactory;
import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum;
import pt.estgp.estgweb.services.data.RepositoryService;
import pt.estgp.estgweb.services.questionarios.PedagogicoAlunosProcessor;
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.PerguntasGrupoQueryDao;
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QueryDaoUtils;
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QuestionariosQueryDao;
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.reportdomains.EntityEvaluated;
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.reportdomains.QuestionariosAlunosReport;
import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils.*;
import pt.estgp.estgweb.utils.ConfigProperties;

import java.awt.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by jorgemachado on 16/12/16.
 */

public abstract class ReportAlunosGenerator extends ReportGenerator
{

    private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(ReportAlunosGenerator.class);

    protected 1.5.0/docs/api/java/lang/String.html">String anoLectivo;
    protected 1.5.0/docs/api/java/lang/String.html">String[] periodos;
    protected 1.5.0/docs/api/java/lang/String.html">String[] degrees;

    public ReportAlunosGenerator(1.5.0/docs/api/java/lang/String.html">String anoLectivo, 1.5.0/docs/api/java/lang/String.html">String[] periodos, 1.5.0/docs/api/java/lang/String.html">String[] degrees) {
        this.anoLectivo = anoLectivo;
        this.periodos = periodos;
        this.degrees = degrees;
    }


    /**
     * Gera um gráfico com todas as respostas agregadas por questao para um professor
     * @param codes
     * @param anoLectivo
     * @param report
     */

    public static boolean criarGraficosRespostasAgregadas(1.5.0/docs/api/java/lang/String.html">String[] codes,
                                                        EntityEvaluated entityEvaluated,
                                                        1.5.0/docs/api/java/lang/String.html">String anoLectivo,
                                                        QuestionariosAlunosReport report,
                                                        List<String> codigosCurso,
                                                        List<String> codigosEscola,
                                                        double tempoMinimo,
                                                        RespostasAgregadasGrupoStats.RespostasAgregadasChartTable respostasAgregadasChartTable,
                                                        RespostasAgregadasGrupoStats respostasAgregadasGrupo,
                                                        1.5.0/docs/api/java/lang/String.html">String grupo,
                                                        1.5.0/docs/api/java/lang/String.html">String subGrupo,
                                                        1.5.0/docs/api/java/lang/String.html">String[] periodos,
                                                        1.5.0/docs/api/java/lang/String.html">String[] degrees,
                                                        boolean generateChart)
    {
        1.5.0/docs/api/java/lang/String.html">String periodosQuery = QueryDaoUtils.createPeriodosQuery(periodos, "quest", true);
        1.5.0/docs/api/java/lang/String.html">String degreesQuery = QueryDaoUtils.createDegreesQuery(degrees, "curso", true);

        1.5.0/docs/api/java/lang/String.html">String whereFragmentEntity = QuestionariosQueryDao.getWhereEntityCodesFragment(codes,entityEvaluated);

        1.5.0/docs/api/javax/management/Query.html">Query query;//*****CRIAR REPOSTAS DO GRUPO DOCENTE*****///


        query = AbstractDao.getCurrentSession().createQuery("" +
                "SELECT " +
                "avg(fc.intResposta) as media," +
                "sum(case when fc.intResposta = 1 then 1 else 0 end) as r1," +
                "sum(case when fc.intResposta = 2 then 1 else 0 end) as r2," +
                "sum(case when fc.intResposta = 3 then 1 else 0 end) as r3," +
                "sum(case when fc.intResposta = 4 then 1 else 0 end) as r4," +
                "sum(case when fc.intResposta = 5 then 1 else 0 end) as r5," +
                "std(fc.intResposta) as desvio," +
                "count(fc.id) as total, " +
                "prgp.pergunta as pergunta, " +
                "prgp.numero as numero, " +
                "avg(fc.tempoLevado) as tempoMedioLevado " +

                "FROM  " + OlapStarFactQuestionarioAnswer.class.getName() + " fc " +
                "JOIN fc.olapPergunta prgp " +
                "JOIN fc.olapTipologia tipo " +
                "JOIN fc.olapQuestionario quest " +
                "JOIN fc.olapCurso curso " +
                "JOIN fc.olapTimeLine timeLine " +

                "where " +

                " quest.ano = :ano " +
                whereFragmentEntity +
                "and timeLine.nome = '" + PedagogicoAlunosProcessor.getHistoryDriveConstraintStatic() + "' " +
                (tempoMinimo > 0 ?  " and fc.tempoLevado > :tempoLevado " : "" ) +
                periodosQuery +
                degreesQuery +
                (grupo == null ? "" : " and prgp.grupoCode = :grupoCode ") +
                (subGrupo == null ? "" : " and prgp.subGrupoCode = :subGrupoCode ") +
                "group by prgp.numero " +
                "order by prgp.numero ");
        if(grupo != null)
            query.setString("grupoCode",grupo);
        if(subGrupo != null)
            query.setString("subGrupoCode",subGrupo);
//        query.setString("codigoSiges",teacherCode);
        query.setString("ano",anoLectivo);
        if(tempoMinimo > 0)
        {
            query.setDouble("tempoLevado",tempoMinimo);
        }

        List<Object[]> resultsTest = query.list();
        if(resultsTest == null || resultsTest.size() == 0)
        {
            return false;
        }


        DataTable tableRespostasAgregadas = new DataTable();



        DataTable.Row header = tableRespostasAgregadas.addRowHeader();
        header.addColTextCenter("Questão");
        header.addColTextCenter("Resps.");
        header.addColTextCenter("Resps. Esper.");
        //header.addColTextCenter("Tempo Médio de Resposta (seg.)");
        header.addColTextCenter("% Resp.");
        header.addColTextCenter("Nada Satisf. %");
        header.addColTextCenter("Pouco Satisf. %");
        header.addColTextCenter("Satisf. %");
        header.addColTextCenter("Bastante Satisf. %");
        header.addColTextCenter("Muito Satisf. %");
        header.addColTextCenter("Média");
        header.addColTextCenter("Desvio Padrão");

        if(entityEvaluated == EntityEvaluated.DOCENTE)
        {
            header.addColTextCenter("Média dos Cursos em que Lecciona");
            header.addColTextCenter("Diff Cursos");
            header.addColTextCenter("Média das Escolas em que Lecciona");
            header.addColTextCenter("Diff Escolas");
        }
        else if(entityEvaluated == EntityEvaluated.CURSO)
        {
            header.addColTextCenter("Média da Escola");
            header.addColTextCenter("Diff Escola");
        }
        else
        {
            throw new 1.5.0/docs/api/java/lang/RuntimeException.html">RuntimeException("Não implementado");
        }



        PerguntasGrupoQueryDao.getMediasGrupo(codes, entityEvaluated, anoLectivo, report, codigosCurso, codigosEscola, grupo, subGrupo, respostasAgregadasGrupo.getMediasGrupo(), periodos, degrees);


        //Um ciclo por pergunta numero
        for(5+0%2Fdocs%2Fapi+Object">Object[] resultTest : resultsTest)
        {
            1.5.0/docs/api/java/lang/Double.html">Double tempoMedioLevado = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[10];
            1.5.0/docs/api/java/lang/Double.html">Double mediaDocente = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[0];
            1.5.0/docs/api/java/lang/Double.html">Double desvio = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[6];
            1.5.0/docs/api/java/lang/Long.html">Long total = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[7];
            double min = mediaDocente - (desvio*2);
            double max = mediaDocente + (desvio*2);
            if(max > 5) max = 5;
            1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat df = new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#,##0.00");

            1.5.0/docs/api/java/lang/String.html">String questao = resultTest[8].toString();
            1.5.0/docs/api/java/lang/String.html">String numero = resultTest[9].toString();


            DataTable.Row rowUnidade = tableRespostasAgregadas.addRowNormal();
            rowUnidade.addColLabelCenter(questao);
            rowUnidade.addColTextCenter(""+total);
            rowUnidade.addColTextCenter("" + report.getQuestionariosReqTotal());
            //rowUnidade.addColTextCenter(df.format(tempoMedioLevado/1000.0));
            rowUnidade.addColPercentageCenter(ChartBuilderUtil.getPercentagemPrint0Slots(total, report.getQuestionariosReqTotal()), true);
            DataTable.Row.Col colResposta1 = rowUnidade.addColTextCenter(resultTest[1].toString());
            DataTable.Row.Col colResposta2 = rowUnidade.addColTextCenter(resultTest[2].toString());
            DataTable.Row.Col colResposta3 = rowUnidade.addColTextCenter(resultTest[3].toString());
            DataTable.Row.Col colResposta4 = rowUnidade.addColTextCenter(resultTest[4].toString());
            DataTable.Row.Col colResposta5 = rowUnidade.addColTextCenter(resultTest[5].toString());

            1.5.0/docs/api/java/lang/Long.html">Long respostas1 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[1];
            1.5.0/docs/api/java/lang/Long.html">Long respostas2 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[2];
            1.5.0/docs/api/java/lang/Long.html">Long respostas3 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[3];
            1.5.0/docs/api/java/lang/Long.html">Long respostas4 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[4];
            1.5.0/docs/api/java/lang/Long.html">Long respostas5 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[5];

            if(respostas1 >= respostas2 && respostas1 >= respostas3 && respostas1 >= respostas4 && respostas1 >= respostas5)
            {
                colResposta1.setBackgroundColor(ChartBuilderUtil.COLOR_1_HEX);
            }else if(respostas2 >= respostas1  && respostas2 >= respostas3 && respostas2 >= respostas4 && respostas2 >= respostas5)
            {
                colResposta2.setBackgroundColor(ChartBuilderUtil.COLOR_2_HEX);
            }else if(respostas3 >= respostas1  && respostas3 >= respostas2 && respostas3 >= respostas4 && respostas3 >= respostas5)
            {
                colResposta3.setBackgroundColor(ChartBuilderUtil.COLOR_3_HEX);
            }else if(respostas4 >= respostas1  && respostas4 >= respostas2 && respostas4 >= respostas3 && respostas4 >= respostas5)
            {
                colResposta4.setBackgroundColor(ChartBuilderUtil.COLOR_4_HEX);
            }else if(respostas5 >= respostas1  && respostas5 >= respostas2 && respostas5 >= respostas3 && respostas5 >= respostas4)
            {
                colResposta5.setBackgroundColor(ChartBuilderUtil.COLOR_5_HEX);
            }





            double mediaCursos = QueryDaoUtils.getMediaCursos(codigosCurso, anoLectivo, numero, tempoMinimo, grupo,subGrupo, periodos, degrees);
            double mediaEscolas = QueryDaoUtils.getMediaEscolas(codigosEscola, anoLectivo, numero, tempoMinimo, grupo,subGrupo, periodos, degrees);



            try {
                PerguntaStats perguntaStatsAndChart;

                if(tempoMinimo <= 0 && generateChart)
                {
                    List<String> info = new ArrayList<String>();
                    info.add("Desvio Padrão: " + df.format(desvio));
                    info.add("Média: " + df.format(mediaDocente));
                    info.add("Respostas: " + total);
                    info.add("95% respostas entre: " + df.format(min) + " e " + df.format(max));
                    perguntaStatsAndChart = ChartBuilderUtil.createChartRespostasPergunta(questao, info,
                            new int[]{
                                    ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[1]).intValue(),
                                    ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[2]).intValue(),
                                    ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[3]).intValue(),
                                    ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[4]).intValue(),
                                    ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[5]).intValue(),
                            }, "resposta" + tempoMinimo + numero, report.getQuestionariosReqRespondidos());

                }
                else
                    perguntaStatsAndChart = new PerguntaStats();

                perguntaStatsAndChart.setPergunta(questao);
                perguntaStatsAndChart.setNumero(numero);
                perguntaStatsAndChart.setGrupo(grupo);
                perguntaStatsAndChart.setSubGrupo(subGrupo);
                perguntaStatsAndChart.setDesvio(df.format(desvio));
                perguntaStatsAndChart.setMediaCursosPrint(df.format(mediaCursos));
                perguntaStatsAndChart.setMediaEscolasPrint(df.format(mediaEscolas));
                perguntaStatsAndChart.setMediaCursos(mediaCursos);
                perguntaStatsAndChart.setMediaEscolas(mediaEscolas);
                perguntaStatsAndChart.setMediaEntidadeEmAvaliacao(mediaDocente);
                perguntaStatsAndChart.setMediaEntidadeEmAvaliacaoPrint(df.format(mediaDocente));
                perguntaStatsAndChart.setPercentMediaCursos("" + ((int) ((mediaCursos / 5.0) * 100.0)));
                perguntaStatsAndChart.setPercentMediaEscolas("" + ((int) ((mediaEscolas / 5.0) * 100.0)));
                perguntaStatsAndChart.setPercentMediaEntidadeEmAvaliacao("" + ((int)((mediaDocente/5.0)*100.0)));

                perguntaStatsAndChart.setDiffMediaCurso(mediaDocente - mediaCursos);
                perguntaStatsAndChart.setDiffMediaEscola(mediaDocente - mediaEscolas);
                perguntaStatsAndChart.setDiffMediaCursoPrint(df.format(mediaDocente - mediaCursos));
                perguntaStatsAndChart.setDiffMediaEscolaPrint(df.format(mediaDocente - mediaEscolas));

                rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaEntidadeEmAvaliacaoPrint(), perguntaStatsAndChart.getPercentMediaEntidadeEmAvaliacao(), true);
                rowUnidade.addColTextCenter(df.format(desvio));
                if(entityEvaluated == EntityEvaluated.DOCENTE)
                {
                    rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaCursosPrint(),perguntaStatsAndChart.getPercentMediaCursos(),true);
                    rowUnidade.addColNumberRight(perguntaStatsAndChart.getDiffMediaCursoPrint()).setBackgroundColor(ChartBuilderUtil.getBackgroundColorDiff(perguntaStatsAndChart.getDiffMediaCurso()));
                }
                else if(entityEvaluated == EntityEvaluated.CURSO)
                {
                    //do nothing
                }
                else
                {
                    throw new 1.5.0/docs/api/java/lang/RuntimeException.html">RuntimeException("Não implementado"); //para lembrar se implementar o de cima e esquecer este
                }
                rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaEscolasPrint(),perguntaStatsAndChart.getPercentMediaEscolas(),true);
                rowUnidade.addColNumberRight(perguntaStatsAndChart.getDiffMediaEscolaPrint()).setBackgroundColor(ChartBuilderUtil.getBackgroundColorDiff(perguntaStatsAndChart.getDiffMediaEscola()));

                respostasAgregadasChartTable.getRespostasAgregadasCharts().addChart(perguntaStatsAndChart);
                respostasAgregadasChartTable.setRespostasTable(tableRespostasAgregadas);
                //Adicionar o Grafico ao perguntaStats deste grupo
                if(tempoMinimo <= 0)
                {
                    //adicionada segunda vez para ficar na classe de agregação de respostas e medias
                    //legadamente ja estavam no chart mas metem-se aqui tambem pois estavam em rows e afins
                    respostasAgregadasGrupo.getPerguntasStats().add(perguntaStatsAndChart);
                }

            } catch (1.5.0/docs/api/java/io/IOException.html">IOException e) {
                logger.error(e,e);
            }
        }
        respostasAgregadasGrupo.setValid(true);
        return true;

    }


    protected 1.5.0/docs/api/java/lang/String.html">String criarChartETabelaMediaGruposPorUnidade(int width,int heightCategory,List<UnidadeStats> unidadesStats,1.5.0/docs/api/java/lang/String.html">String grupo1,1.5.0/docs/api/java/lang/String.html">String subgrupo1, 1.5.0/docs/api/java/lang/String.html">String grupo2,1.5.0/docs/api/java/lang/String.html">String subgrupo2,DataTable table,1.5.0/docs/api/java/lang/String.html">String tmpPathPrefix,1.5.0/docs/api/java/awt/Color.html">Color[] barColors,1.5.0/docs/api/java/awt/Color.html">Color[] labelsColors) throws 1.5.0/docs/api/java/io/IOException.html">IOException
    {
        //Se houver subgrupo usa-se a label do subgrupo
        1.5.0/docs/api/java/lang/String.html">String grupo1propertyIndex = subgrupo1 != null ?  ConfigProperties.getProperty("questionario.group.inverse." + subgrupo1) : ConfigProperties.getProperty("questionario.group.inverse." + grupo1);
        1.5.0/docs/api/java/lang/String.html">String grupo1Label = ConfigProperties.getProperty("questionario.group" + grupo1propertyIndex + ".title");
        1.5.0/docs/api/java/lang/String.html">String grupo2propertyIndex = subgrupo2 != null ? grupo2propertyIndex = ConfigProperties.getProperty("questionario.group.inverse." + subgrupo2) : ConfigProperties.getProperty("questionario.group.inverse." + grupo2);
        1.5.0/docs/api/java/lang/String.html">String grupo2Label = ConfigProperties.getProperty("questionario.group" + grupo2propertyIndex + ".title");

        if(table != null)
        {
            DataTable.Row headerDefinition = table.addRowHeader();
            headerDefinition.setInvisible(true);
            headerDefinition.addColTextCenter("Unidade Inv").setWidth("20%");
            headerDefinition.addColTextCenter("Código Inv");
            headerDefinition.addColTextCenter("Curso Inv").setWidth("20%");
            headerDefinition.addColTextCenter("Código Curso Inv");
            headerDefinition.addColTextCenter("Respostas Inv");
            headerDefinition.addColTextCenter("Média Inv");
            headerDefinition.addColTextCenter("Desvio Inv");
            headerDefinition.addColTextCenter("Média Curso Inv");
            headerDefinition.addColTextCenter("Média Escola Inv");
            headerDefinition.addColTextCenter("Média Inv");
            headerDefinition.addColTextCenter("Desvio Inv");
            headerDefinition.addColTextCenter("Média Curso Inv");
            headerDefinition.addColTextCenter("Média Escola Inv");

            DataTable.Row header = table.addRowHeader();


            header.addColInvisible().setColspan(5);
            DataTable.Row.Col colgrupo1 = header.addColTextCenter(grupo1Label);
            DataTable.Row.Col colgrupo2 =  header.addColTextCenter(grupo2Label);
            colgrupo1.setColspan(4);
            colgrupo2.setColspan(4);

            colgrupo1.setBackgroundColor(ChartBuilderUtil.getRgbXslColor(barColors[0]));
            colgrupo2.setBackgroundColor(ChartBuilderUtil.getRgbXslColor(barColors[1]));

            DataTable.Row header2 = table.addRowHeader();
            header2.addColTextCenter("Unidade");
            header2.addColTextCenter("Código");
            header2.addColTextCenter("Curso");
            header2.addColTextCenter("Código Curso");
            header2.addColTextCenter("Resps");
            header2.addColTextCenter("Média").setBackgroundColor(colgrupo1.getBackgroundColor());
            header2.addColTextCenter("Desvio").setBackgroundColor(colgrupo1.getBackgroundColor());
            header2.addColTextCenter("Média Curso").setBackgroundColor(colgrupo1.getBackgroundColor());
            header2.addColTextCenter("Média Escola").setBackgroundColor(colgrupo1.getBackgroundColor());
            header2.addColTextCenter("Média").setBackgroundColor(colgrupo2.getBackgroundColor());
            header2.addColTextCenter("Desvio").setBackgroundColor(colgrupo2.getBackgroundColor());
            header2.addColTextCenter("Média Curso").setBackgroundColor(colgrupo2.getBackgroundColor());
            header2.addColTextCenter("Média Escola").setBackgroundColor(colgrupo2.getBackgroundColor());
        }

        double valores[][] = new double[unidadesStats.size()][2];
        1.5.0/docs/api/java/lang/String.html">String [] categories = new 1.5.0/docs/api/java/lang/String.html">String[unidadesStats.size()];
        int i = 0;

        1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat df =new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#,##0.00");
        for(UnidadeStats unidadeStats : unidadesStats)
        {
            UnidadeStats.UnidadeStatsGrupo unidadeStatsGrupo1 = unidadeStats.findUnidadeStatsGrupo(grupo1,subgrupo1);
            UnidadeStats.UnidadeStatsGrupo unidadeStatsGrupo2 = unidadeStats.findUnidadeStatsGrupo(grupo2,subgrupo2);
            valores[i][0] = unidadeStatsGrupo1.getMediasGrupo().getAvaliacaoMedia();
            valores[i][1] = unidadeStatsGrupo2.getMediasGrupo().getAvaliacaoMedia();
            categories[i] = unidadeStats.getNomeUnidadeComCursoAbreviado();
            i++;

            if(table != null)
            {
                DataTable.Row rowUnit = table.addRowNormal();
                rowUnit.addColTextCenter(unidadeStats.getNomeUnidade());
                rowUnit.addColTextCenter(unidadeStats.getCodigoUnidade());
                rowUnit.addColTextCenter(unidadeStats.getNomeCurso());
                rowUnit.addColTextCenter(unidadeStats.getCodigoCurso());
                rowUnit.addColNumberRight("" + unidadeStats.getRespostas());

                rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getAvaliacaoMedia()), unidadeStatsGrupo1.getMediasGrupo().getPercentAvaliacaoMediaForTables(), true);
                rowUnit.addColNumberRight(df.format(unidadeStatsGrupo1.getMediasGrupo().getDesvioPadrao()));
                rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getMediaGlobalNosCursos()), unidadeStatsGrupo1.getMediasGrupo().getPercentMediaGlobalNosCursosForTables(), true);
                rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getMediaGlobalNasEscolas()), unidadeStatsGrupo1.getMediasGrupo().getPercentMediaGlobalNasEscolasForTables(), true);

                rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getAvaliacaoMedia()), unidadeStatsGrupo2.getMediasGrupo().getPercentAvaliacaoMediaForTables(), true);
                rowUnit.addColNumberRight(df.format(unidadeStatsGrupo2.getMediasGrupo().getDesvioPadrao()));
                rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getMediaGlobalNosCursos()), unidadeStatsGrupo2.getMediasGrupo().getPercentMediaGlobalNosCursosForTables(), true);
                rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getMediaGlobalNasEscolas()), unidadeStatsGrupo2.getMediasGrupo().getPercentMediaGlobalNasEscolasForTables(), true);
            }

        }

        1.5.0/docs/api/java/lang/String.html">String path = ChartBuilderUtil.createBarChartBarsCategories(
                new 1.5.0/docs/api/java/lang/String.html">String[]{grupo1Label,grupo2Label},
                categories,
                barColors,
                labelsColors,
                valores,
                0,5, tmpPathPrefix + "unidadesConjuntas",width,heightCategory);
        return path;
    }

    public 1.5.0/docs/api/java/lang/String.html">String generateBigDataCSV(1.5.0/docs/api/java/lang/String.html">String[] periodos,1.5.0/docs/api/java/lang/String.html">String[] degrees)
    {
        //ZipOutputStream()
        //AbstractDao.getCurrentSession().
        return null;
    }

    public void zipFolder(QuestionarioReportFileGroupAno q, 1.5.0/docs/api/java/io/File.html">File reportGroupFolder,1.5.0/docs/api/java/lang/String.html">String desc,ResourceAccessControlEnum access) throws 1.5.0/docs/api/java/io/IOException.html">IOException
    {
        1.5.0/docs/api/java/lang/String.html">String zipFilePath =  reportGroupFolder.getAbsolutePath() + ".zip";
        FilesUtils.zipFolder(reportGroupFolder.getAbsolutePath(), zipFilePath);
        FilesUtils.delete(reportGroupFolder.getAbsolutePath());
        1.5.0/docs/api/java/io/File.html">File zipFile = new 1.5.0/docs/api/java/io/File.html">File(zipFilePath);

        if(q.getRepositoryStreamZipFile() == null || q.getRepositoryStreamZipFile().trim().length() == 0)
        {
            1.5.0/docs/api/java/lang/String.html">String repositoryStreamCode = new RepositoryService().storeRepositoryFile(
                    new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(zipFile),
                    "application/zip",
                    "zip",
                    (int)zipFile.length(),
                    zipFile.getName(),
                    desc,
                    access,
                    DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1)));
            q.setRepositoryStreamZipFile(repositoryStreamCode);
        }
        else
        {
            new RepositoryService().updateRepositoryFile(
                    q.getRepositoryStreamZipFile(),
                    new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(zipFile),
                    "application/zip",
                    "zip",
                    (int)zipFile.length(),
                    zipFile.getName(),
                    desc,
                    access);
        }
        zipFile.delete();
    }

    protected void sendPdfToRepository(QuestionarioReportFileAno reportFile, 1.5.0/docs/api/java/io/File.html">File tmpFile, 1.5.0/docs/api/java/lang/String.html">String descricao,ResourceAccessControlEnum access) throws 1.5.0/docs/api/java/io/FileNotFoundException.html">FileNotFoundException {
        if(reportFile.getRepositoryStream() == null || reportFile.getRepositoryStream().trim().length() == 0)
        {
            1.5.0/docs/api/java/lang/String.html">String repositoryStreamCode = new RepositoryService().storeRepositoryFile(
                    new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile),
                    "application/pdf",
                    "pdf",
                    (int)tmpFile.length(),
                    tmpFile.getName(),
                    descricao,
                    access,//Este relatório de curso é publico
                    DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1)));
            reportFile.setRepositoryStream(repositoryStreamCode);
        }
        else
        {
            new RepositoryService().updateRepositoryFile(
                    reportFile.getRepositoryStream(),
                    new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile),
                    "application/pdf",
                    "pdf",
                    (int)tmpFile.length(),
                    tmpFile.getName(),
                    descricao,
                    access);
        }
    }
}