Search in sources :

Example 6 with TurmaDTO

use of com.tomasio.projects.trainning.dto.TurmaDTO in project trainning by fernandotomasio.

the class TurmaUpdateInterceptor method invoke.

@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    Object result = null;
    CacheManager cacheManager = CacheManager.create(new ClassPathResource("echache.xml").getInputStream());
    Cache cache = cacheManager.getCache("turmasCache");
    TurmaDTO turma = (TurmaDTO) invocation.getArguments()[0];
    if (turma != null) {
        Element element = cache.get(turma.getId());
        if (element != null) {
            cache.remove(turma.getId());
        }
    }
    result = invocation.proceed();
    return result;
}
Also used : Element(net.sf.ehcache.Element) CacheManager(net.sf.ehcache.CacheManager) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) ClassPathResource(org.springframework.core.io.ClassPathResource) Cache(net.sf.ehcache.Cache)

Example 7 with TurmaDTO

use of com.tomasio.projects.trainning.dto.TurmaDTO in project trainning by fernandotomasio.

the class StatisticalServiceSimpleImpl method getTotalVagasDisponiveis.

@Override
public int getTotalVagasDisponiveis(Long cursoId, Long planejamentoId) {
    TurmaDTO[] turmas = planningService.findAllTurmasPlanejadas(planejamentoId, null, cursoId, null);
    int totalVagas = 0;
    for (TurmaDTO turmaDTO : turmas) {
        totalVagas += turmaDTO.getVagasDisponiveis();
    }
    return totalVagas;
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO)

Example 8 with TurmaDTO

use of com.tomasio.projects.trainning.dto.TurmaDTO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method findAllTurmas.

@Override
@Transactional(readOnly = true)
public TurmaDTO[] findAllTurmas(Long[] ids) {
    if (ids == null || ids.length <= 0) {
        return new TurmaDTO[0];
    }
    TurmaDAO dao = factory.getTurmaDAO();
    TurmaDTO[] turmasArray = null;
    try {
        List<Turma> turmas = dao.findAll(Arrays.asList(ids));
        // }
        if (turmas != null) {
            turmasArray = new TurmaDTO[turmas.size()];
            for (int i = 0; i < turmas.size(); i++) {
                turmasArray[i] = turmas.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    return turmasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Turma(com.tomasio.projects.trainning.model.Turma) CoreException(com.tomasio.projects.trainning.exeption.CoreException) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with TurmaDTO

use of com.tomasio.projects.trainning.dto.TurmaDTO in project trainning by fernandotomasio.

the class ConsultasInstrutoresController method newConsulta.

@RequestMapping("/new_consulta")
public String newConsulta(Model model, WebRequest request) {
    String turmaIdParam = request.getParameter("turmaId");
    if (turmaIdParam != null) {
        Long turmaId = Long.parseLong(turmaIdParam);
        TurmaDTO turma = atividadesEnsinoService.findTurmaEfetiva(turmaId);
        model.addAttribute("turma", turma);
        model.addAttribute(new ConsultaForm());
        return "consultas_instrutores/form_consulta";
    } else {
        return "redirect:select_turma";
    }
}
Also used : ConsultaForm(com.tomasio.projects.trainning.form.ConsultaForm) ItemConsultaForm(com.tomasio.projects.trainning.form.ItemConsultaForm) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with TurmaDTO

use of com.tomasio.projects.trainning.dto.TurmaDTO in project trainning by fernandotomasio.

the class EXC001ODF method makeReport.

@Override
public void makeReport() {
    try {
        odt = OdfTextDocument.newTextDocument();
        AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
        OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
        Long turmaId = (Long) params.get("turmaId");
        TurmaDTO turma = service.findTurmaEfetiva(turmaId);
        IndicacaoDTO[] indicacoes = service.findAllIndicacoesAlunos(turmaId);
        odt.newParagraph("CURSO: " + turma.getCurso().getCodigo() + " - " + turma.getCurso().getDescricao());
        odt.newParagraph("TURMA: " + turma.getNumeroTurma());
        odt.newParagraph("INICIO: " + turma.getDataInicioFormatted());
        odt.newParagraph("TERMINO: " + turma.getDataTerminoFormatted());
        OdfTable indicacoesTable = OdfTable.newTable(odt, indicacoes.length + 1, 5);
        OdfTableCell postoHeader = indicacoesTable.getCellByPosition(0, 0);
        postoHeader.setStringValue("Posto/Graduacao");
        postoHeader.setHorizontalAlignment("center");
        OdfTableCell especialidadeHeader = indicacoesTable.getCellByPosition(1, 0);
        especialidadeHeader.setStringValue("Especialidade");
        especialidadeHeader.setHorizontalAlignment("center");
        OdfTableCell nomeHeader = indicacoesTable.getCellByPosition(2, 0);
        nomeHeader.setStringValue("Nome");
        nomeHeader.setHorizontalAlignment("center");
        OdfTableCell saramHeader = indicacoesTable.getCellByPosition(3, 0);
        saramHeader.setStringValue("SARAM");
        saramHeader.setHorizontalAlignment("center");
        OdfTableCell cpfHeader = indicacoesTable.getCellByPosition(4, 0);
        cpfHeader.setStringValue("CPF");
        cpfHeader.setHorizontalAlignment("center");
        OdfTableCell organizacaoHeader = indicacoesTable.getCellByPosition(5, 0);
        organizacaoHeader.setStringValue("Organizacao");
        organizacaoHeader.setHorizontalAlignment("center");
        for (int i = 0; i < indicacoes.length; i++) {
            PessoaDTO pessoa = organizationalService.findPessoa(indicacoes[i].getPessoa().getId());
            String posto = pessoa.getPosto();
            String especialidade = pessoa.getEspecialidade();
            String nome = pessoa.getNome();
            String saram = pessoa.getSaram();
            String cpf = pessoa.getCpf();
            OrganizacaoDTO organizacao = organizationalService.findOrganizacao(indicacoes[i].getOrganizacao().getId());
            String siglaOrganizacao = organizacao.getSigla();
            OdfTableCell postoCell = indicacoesTable.getCellByPosition(0, i + 1);
            postoCell.setStringValue(posto);
            OdfTableCell especialidadeCell = indicacoesTable.getCellByPosition(1, i + 1);
            especialidadeCell.setStringValue(especialidade);
            OdfTableCell nomeCell = indicacoesTable.getCellByPosition(2, i + 1);
            nomeCell.setStringValue(nome);
            OdfTableCell saramCell = indicacoesTable.getCellByPosition(3, i + 1);
            saramCell.setStringValue(saram);
            OdfTableCell cpfCell = indicacoesTable.getCellByPosition(4, i + 1);
            cpfCell.setStringValue(cpf);
            OdfTableCell organizacaoCell = indicacoesTable.getCellByPosition(5, i + 1);
            organizacaoCell.setStringValue(siglaOrganizacao);
        }
        odt.save(os);
    } catch (Exception ex) {
        Logger.getLogger(EXC001ODF.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) OdfTableCell(org.odftoolkit.odfdom.doc.table.OdfTableCell) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OdfTable(org.odftoolkit.odfdom.doc.table.OdfTable) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Aggregations

TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)23 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)8 HashMap (java.util.HashMap)8 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)7 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)7 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)5 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 AnotacaoDTO (com.tomasio.projects.trainning.dto.AnotacaoDTO)3 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)3 FolhaRostoDTO (com.tomasio.projects.trainning.dto.FolhaRostoDTO)3 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)3 IndicacaoInstrutorDTO (com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO)3 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)3 TurmaPlanejadaDTO (com.tomasio.projects.trainning.dto.TurmaPlanejadaDTO)3 IOException (java.io.IOException)3 SimpleDateFormat (java.text.SimpleDateFormat)3