Search in sources :

Example 26 with IndicacaoDTO

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

the class TurmasEfetivasController method newParecer.

@RequestMapping("/new_parecer")
public String newParecer(Model model, WebRequest request, @ModelAttribute("userOrganization") OrganizacaoDTO organizacao) {
    String tipo = request.getParameter("tipo");
    String indicacaoId = request.getParameter("indicacaoId");
    IndicacaoDTO indicacao = atividadesEnsinoService.findIndicacao(Long.parseLong(indicacaoId));
    PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
    ParecerForm form = new ParecerForm();
    form.setIndicacaoId(indicacao.getId());
    form.setTipo(tipo);
    form.setOrganizacaoId(organizacao.getId());
    model.addAttribute(form);
    model.addAttribute("pessoa", pessoa);
    return "turmas_efetivas/form_parecer";
}
Also used : PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) ParecerForm(com.tomasio.projects.trainning.form.ParecerForm) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 27 with IndicacaoDTO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunoByPessoaId.

@Override
@Transactional(readOnly = true)
public IndicacaoDTO[] findAllIndicacoesAlunoByPessoaId(Date exercicio, Long pessoaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoDTO[] indicacoesArray = null;
    try {
        List<Indicacao> indicacoes = dao.findAllIndicacoesAlunoByPessoaId(pessoaId, exercicio);
        if (indicacoes != null) {
            indicacoesArray = new IndicacaoAlunoDTO[indicacoes.size()];
            for (int i = 0; i < indicacoes.size(); i++) {
                indicacoesArray[i] = indicacoes.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 indicacoesArray;
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Indicacao(com.tomasio.projects.trainning.model.Indicacao) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 28 with IndicacaoDTO

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

the class AtividadesEnsinoCacheAdvice method createParecerMethodInterceptor.

@Around("createParecer()")
public Object createParecerMethodInterceptor(ProceedingJoinPoint joinPoint) throws Throwable {
    Object[] args = joinPoint.getArgs();
    ParecerDTO parecer = (ParecerDTO) args[0];
    IndicacaoDTO indicacao = atividadesEnsinoService.findIndicacao(parecer.getIndicacao().getId());
    TurmaEfetivaDTO turma = atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurma().getId());
    SimpleDateFormat df = new SimpleDateFormat("yyyy");
    String exercicio = df.format(turma.getExercicio());
    String organizacao = parecer.getOrganizacao().getId().toString();
    String key = exercicio + "-" + organizacao;
    clearChacheTurmas(key);
    clearChachePendencias(key);
    return joinPoint.proceed();
}
Also used : TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) ParecerDTO(com.tomasio.projects.trainning.dto.ParecerDTO) SimpleDateFormat(java.text.SimpleDateFormat) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) Around(org.aspectj.lang.annotation.Around)

Example 29 with IndicacaoDTO

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

the class AtividadesEnsinoCacheAdvice method createIndicacaoMethodInterceptor.

@Around("createIndicacao()")
public Object createIndicacaoMethodInterceptor(ProceedingJoinPoint joinPoint) throws Throwable {
    Object[] args = joinPoint.getArgs();
    IndicacaoDTO indicacao = (IndicacaoDTO) args[0];
    TurmaEfetivaDTO turma = atividadesEnsinoService.findTurmaEfetiva(indicacao.getTurma().getId());
    SimpleDateFormat df = new SimpleDateFormat("yyyy");
    String exercicio = df.format(turma.getExercicio());
    String organizacao = turma.getOrganizacaoGestoraId().toString();
    String key = exercicio + "-" + organizacao;
    clearChacheTurmas(key);
    clearChachePendencias(key);
    return joinPoint.proceed();
}
Also used : TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) SimpleDateFormat(java.text.SimpleDateFormat) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) Around(org.aspectj.lang.annotation.Around)

Example 30 with IndicacaoDTO

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

the class EXC001IReport method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    document = documentManager.getDocumentPortrait();
    os = documentManager.prepareDocument(document);
    writer = documentManager.getWritter();
    document.open();
    Long turmaId = (Long) params.get("turmaId");
    TurmaDTO turma = service.findTurmaEfetiva(turmaId);
    IndicacaoDTO[] indicacoes = service.findAllIndicacoesAlunos(turmaId);
    try {
        Paragraph p = null;
        p = new Paragraph(ReportUtil.convertEncode(turma.getCurso().getCodigo()) + " - " + ReportUtil.convertEncode(turma.getCurso().getDescricao()), fontManager.getH1Font());
        p.setAlignment(Element.ALIGN_LEFT);
        document.add(p);
        PdfPTable tableIndicacoes = new PdfPTable(4);
        tableIndicacoes.addCell(tableManager.getHeaderCell("Nome"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("Nome de Guerra"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("SARAM"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("CPF"));
        tableIndicacoes.addCell(tableManager.getHeaderCell("Organização"));
        for (IndicacaoDTO indicacao : indicacoes) {
            PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
            String nomeGuerra = pessoa.getNomeGuerra();
            if (nomeGuerra == null) {
                nomeGuerra = "";
            }
            tableIndicacoes.addCell(tableManager.getPhraseCellLeft(pessoa.getTargetaCompleta()));
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(nomeGuerra));
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(pessoa.getSaram()));
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(pessoa.getCpf()));
            OrganizacaoDTO organizacao = organizationalService.findOrganizacao(indicacao.getOrganizacao().getId());
            tableIndicacoes.addCell(tableManager.getPhraseCellCenter(organizacao.getSigla()));
        }
        document.add(tableIndicacoes);
    } catch (DocumentException ex) {
        Logger.getLogger(EXC001IReport.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        document.close();
    }
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) Paragraph(com.itextpdf.text.Paragraph) PdfPTable(com.itextpdf.text.pdf.PdfPTable) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) DocumentException(com.itextpdf.text.DocumentException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Aggregations

IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)36 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)19 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)15 ArrayList (java.util.ArrayList)13 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)12 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)11 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)11 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)11 SimpleDateFormat (java.text.SimpleDateFormat)10 TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)8 Date (java.util.Date)7 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)6 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)6 IndicacaoInstrutorDTO (com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO)6 BufferedWriter (java.io.BufferedWriter)5 IOException (java.io.IOException)5 OutputStreamWriter (java.io.OutputStreamWriter)5 Writer (java.io.Writer)5 ParseException (java.text.ParseException)5 HashMap (java.util.HashMap)5