Search in sources :

Example 91 with PessoaDTO

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

the class Pessoa method createDTO.

@Override
public PessoaDTO createDTO() {
    PessoaDTO dto = createDTOWithoutDependencies();
    if (organizacao != null) {
        dto.setOrganizacao(organizacao.createDTOWithoutDependencies());
    }
    if (telefones != null) {
        TelefoneDTO[] dtoArray = new TelefoneDTO[telefones.size()];
        Object[] modelArray = telefones.toArray();
        for (int i = 0; i < modelArray.length; i++) {
            Telefone telefone = (Telefone) modelArray[i];
            dtoArray[i] = telefone.createDTOWithoutDependencies();
        }
        dto.setTelefones(dtoArray);
    }
    if (emails != null) {
        EmailDTO[] dtoArray = new EmailDTO[emails.size()];
        Object[] modelArray = emails.toArray();
        for (int i = 0; i < modelArray.length; i++) {
            Email email = (Email) modelArray[i];
            dtoArray[i] = email.createDTOWithoutDependencies();
        }
        dto.setEmails(dtoArray);
    }
    if (enderecos != null) {
        EnderecoDTO[] dtoArray = new EnderecoDTO[enderecos.size()];
        Object[] modelArray = enderecos.toArray();
        for (int i = 0; i < modelArray.length; i++) {
            Endereco endereco = (Endereco) modelArray[i];
            dtoArray[i] = endereco.createDTOWithoutDependencies();
        }
        dto.setEnderecos(dtoArray);
    }
    return dto;
}
Also used : TelefoneDTO(com.tomasio.projects.trainning.dto.TelefoneDTO) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) EmailDTO(com.tomasio.projects.trainning.dto.EmailDTO) EnderecoDTO(com.tomasio.projects.trainning.dto.EnderecoDTO)

Example 92 with PessoaDTO

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

the class ConsultasInstrutoresController method addItemConsulta.

@RequestMapping("/add_item_consulta")
public String addItemConsulta(Model model, @Valid ItemConsultaForm form, BindingResult bindingResult, @ModelAttribute("itensConsulta") List<Map<Object, Object>> itensConsulta, WebRequest request) {
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        Date date = df.parse(form.getDataInicio());
    } catch (ParseException ex) {
        form.setDataInicio(null);
    }
    try {
        Date date = df.parse(form.getDataTermino());
    } catch (ParseException ex) {
        form.setDataTermino(null);
    }
    if (bindingResult.hasErrors()) {
        return "consultas_instrutores/form_item_consulta";
    }
    PessoaDTO pessoa = organizationalService.findPessoa(form.getPessoaId());
    String dataInicio = form.getDataInicio();
    String dataTermino = form.getDataTermino();
    Map<Object, Object> item = new HashMap<Object, Object>();
    item.put("tarjeta", pessoa.getTargetaCompletaOM());
    item.put("dataInicio", dataInicio);
    item.put("dataTermino", dataTermino);
    itensConsulta.add(item);
    return "consultas_instrutores/form_consulta";
}
Also used : PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) HashMap(java.util.HashMap) ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 93 with PessoaDTO

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

the class ConvitesInstrutoresController method detailInstrutor.

@RequestMapping("/detail")
public String detailInstrutor(Model model, WebRequest request) {
    String mode = request.getParameter("mode");
    String instrutorId = request.getParameter("instrutorId");
    HabilitacaoInstrutorEfetivaDTO dto = (HabilitacaoInstrutorEfetivaDTO) instructorsService.findHabilitacaoInstrutor(Long.parseLong(instrutorId));
    PessoaDTO pessoa = organizationalService.findPessoa(dto.getPessoa().getId());
    model.addAttribute("emails", pessoa.getEmails());
    model.addAttribute("telefones", pessoa.getTelefones());
    model.addAttribute("instrutor", dto);
    if (mode == null || !mode.equals("box")) {
        return "convites_instrutores/detail";
    } else {
        model.addAttribute("mode", "box");
        return "convites_instrutores/detail_box";
    }
}
Also used : PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) HabilitacaoInstrutorEfetivaDTO(com.tomasio.projects.trainning.dto.HabilitacaoInstrutorEfetivaDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 94 with PessoaDTO

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

the class ConvitesInstrutoresController method initializeItemConviteIndividualForm.

public ItemConviteIndividualForm initializeItemConviteIndividualForm(Map pessoaData) {
    Long pessoaId = (Long) pessoaData.get("id");
    PessoaDTO pessoa = organizationalService.findPessoa(pessoaId);
    ItemConviteIndividualForm form = new ItemConviteIndividualForm();
    if (pessoa.getOrganizacao() != null) {
        form.setOMSigla(pessoa.getOrganizacao().getSigla());
    }
    form.setPessoaId(pessoa.getId());
    form.setTargetaCompleta(pessoa.getTargetaCompleta());
    return form;
}
Also used : PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) ItemConviteIndividualForm(com.tomasio.projects.trainning.form.convites.ItemConviteIndividualForm)

Example 95 with PessoaDTO

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

the class ConvitesInstrutoresController method newInstrutor.

@RequestMapping("/new")
public String newInstrutor(Model model, WebRequest request, @ModelAttribute("curso") @Valid CursoDTO curso) {
    String pessoaIdParam = request.getParameter("pessoaId");
    if (pessoaIdParam == null || pessoaIdParam.equals("")) {
        return "convites_instrutores/select_pessoa";
    }
    HabilitacaoInstrutorForm habilitacaoInstrutor = new HabilitacaoInstrutorForm();
    PessoaDTO pessoa = organizationalService.findPessoa(Long.parseLong(pessoaIdParam));
    habilitacaoInstrutor.setPessoaId(pessoa.getId());
    habilitacaoInstrutor.setPessoaTargeta(pessoa.getTargetaCompleta());
    habilitacaoInstrutor.setOMSigla(pessoa.getOrganizacao().getSigla());
    habilitacaoInstrutor.setCursoId(curso.getId());
    model.addAttribute(habilitacaoInstrutor);
    model.addAttribute("pessoa", pessoa);
    return "convites_instrutores/form";
}
Also used : PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) HabilitacaoInstrutorForm(com.tomasio.projects.trainning.form.instrutores.HabilitacaoInstrutorForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)96 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)44 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)33 ArrayList (java.util.ArrayList)28 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)27 CoreException (com.tomasio.projects.trainning.exeption.CoreException)23 Date (java.util.Date)20 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)19 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)19 SimpleDateFormat (java.text.SimpleDateFormat)17 HashMap (java.util.HashMap)16 EmailDTO (com.tomasio.projects.trainning.dto.EmailDTO)14 TelefoneDTO (com.tomasio.projects.trainning.dto.TelefoneDTO)12 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)12 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)12 Map (java.util.Map)12 CustoDTO (com.tomasio.projects.trainning.dto.CustoDTO)11 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)11 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)10 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)9