Search in sources :

Example 16 with NetworkUserDTO

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

the class SettingsController method showIndex.

@RequestMapping({ "/", "/index", "" })
public String showIndex(Model model, WebRequest request) {
    final InetOrgPerson user = (InetOrgPerson) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    String userLogin = user.getUid();
    // buscar o usuário pelo ID
    NetworkUserDTO usuario = userService.findUser(userLogin);
    // buscar as roles do usuário
    NetworkGroupDTO[] groups = userService.findAllRoleGroups();
    List<String> rolesAssigned = new ArrayList<>();
    for (NetworkGroupDTO group : groups) {
        if (group.getMembers().contains(usuario.getId())) {
            rolesAssigned.add(group.getNome());
        }
    }
    // jogo no ArrayList para trabalhar
    List<NetworkGroupDTO> roles = new ArrayList();
    roles.addAll(Arrays.asList(groups));
    // ordenar a lista de roles
    Collections.sort(roles, new Comparator<NetworkGroupDTO>() {

        @Override
        public int compare(NetworkGroupDTO o1, NetworkGroupDTO o2) {
            return o1.getDescricao().compareTo(o2.getDescricao());
        }
    });
    model.addAttribute("roles", roles);
    model.addAttribute("rolesAssigned", rolesAssigned);
    model.addAttribute("usuario", usuario);
    return "settings";
}
Also used : NetworkGroupDTO(com.tomasio.projects.trainning.dto.NetworkGroupDTO) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) InetOrgPerson(org.springframework.security.ldap.userdetails.InetOrgPerson) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with NetworkUserDTO

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

the class TurmasEfetivasController method detailApresentacao.

@RequestMapping("/detail_apresentacao")
public String detailApresentacao(Model model, WebRequest request) {
    Long apresentacaoId = Long.parseLong(request.getParameter("apresentacaoId"));
    ApresentacaoDTO apresentacao = atividadesEnsinoService.findApresentacao(apresentacaoId);
    MatriculaDTO matricula = atividadesEnsinoService.findMatricula(apresentacao.getMatricula().getId());
    model.addAttribute("apresentacao", apresentacao);
    String operador = "Não Informado";
    if (apresentacao.getOperador() != null && !"".equals(apresentacao.getOperador())) {
        NetworkUserDTO usuario = userService.findUser(apresentacao.getOperador());
        if (usuario != null) {
            operador = usuario.getTarjeta() + " (" + usuario.getOrganizacao() + ")";
        } else {
            operador = apresentacao.getOperador();
        }
    }
    model.addAttribute("operador", operador);
    model.addAttribute("indicacao", atividadesEnsinoService.findIndicacao(matricula.getIndicacao().getId()));
    model.addAttribute("pareceres", atividadesEnsinoService.findAllPareceres(matricula.getIndicacao().getId()));
    return "turmas_efetivas/detail_apresentacao";
}
Also used : PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) NotificacaoMatriculaDTO(com.tomasio.projects.trainning.dto.NotificacaoMatriculaDTO) MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) ApresentacaoDTO(com.tomasio.projects.trainning.dto.ApresentacaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 18 with NetworkUserDTO

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

the class TurmasEfetivasController method detailConclusao.

@RequestMapping("/detail_conclusao")
public String detailConclusao(Model model, WebRequest request) {
    Long conclusaoId = Long.parseLong(request.getParameter("conclusaoId"));
    ConclusaoDTO conclusao = atividadesEnsinoService.findConclusao(conclusaoId);
    MatriculaDTO matricula = atividadesEnsinoService.findMatricula(conclusao.getMatricula().getId());
    model.addAttribute("conclusao", conclusao);
    String operador = "Não Informado";
    if (conclusao.getOperador() != null && !"".equals(conclusao.getOperador())) {
        NetworkUserDTO usuario = userService.findUser(conclusao.getOperador());
        if (usuario != null) {
            operador = usuario.getTarjeta() + " (" + usuario.getOrganizacao() + ")";
        } else {
            operador = conclusao.getOperador();
        }
    }
    model.addAttribute("operador", operador);
    model.addAttribute("indicacao", atividadesEnsinoService.findIndicacao(matricula.getIndicacao().getId()));
    model.addAttribute("pareceres", atividadesEnsinoService.findAllPareceres(matricula.getIndicacao().getId()));
    return "turmas_efetivas/detail_conclusao";
}
Also used : PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) NotificacaoMatriculaDTO(com.tomasio.projects.trainning.dto.NotificacaoMatriculaDTO) MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) CancelamentoMatriculaDTO(com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) CertificadoConclusaoDTO(com.tomasio.projects.trainning.dto.CertificadoConclusaoDTO) ConclusaoDTO(com.tomasio.projects.trainning.dto.ConclusaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 19 with NetworkUserDTO

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

the class UsuariosController method editUsuario.

@RequestMapping("/edit")
public String editUsuario(Model model, @ModelAttribute("userOrganization") OrganizacaoDTO userOrganization, WebRequest request) {
    String usuarioId = request.getParameter("usuarioId");
    // buscar usuário pelo ID
    NetworkUserDTO dto = userService.findUser(usuarioId);
    // buscar as roles do usuário
    NetworkGroupDTO[] groups = userService.findAllRoleGroups();
    List<String> rolesAssigned = new ArrayList<>();
    for (NetworkGroupDTO group : groups) {
        if (group.getMembers().contains(dto.getId())) {
            rolesAssigned.add(group.getNome());
        }
    }
    // jogo no ArrayList para trabalhar
    List<NetworkGroupDTO> roles = new ArrayList();
    roles.addAll(Arrays.asList(groups));
    // ordenar a lista de roles
    Collections.sort(roles, new Comparator<NetworkGroupDTO>() {

        @Override
        public int compare(NetworkGroupDTO o1, NetworkGroupDTO o2) {
            return o1.getDescricao().compareTo(o2.getDescricao());
        }
    });
    UsuarioForm usuarioForm = new UsuarioForm();
    usuarioForm.setOp("EDIT");
    usuarioForm.setEmail(dto.getEmail());
    usuarioForm.setLogin(dto.getLogin());
    usuarioForm.setNome(dto.getNome());
    usuarioForm.setNomeGuerra(dto.getNomeGuerra());
    OrganizacaoDTO organizacao = organizationalService.findOrganizacaoBySigla(dto.getOrganizacao());
    usuarioForm.setOrganizacaoId(organizacao.getId());
    usuarioForm.setPosto(dto.getPosto());
    usuarioForm.setTelefone(dto.getTelefone());
    model.addAttribute(usuarioForm);
    model.addAttribute("organizacoes", initializeSelectableOrganizacoes(request, userOrganization));
    model.addAttribute("roles", roles);
    model.addAttribute("rolesAssigned", rolesAssigned);
    return "usuarios/form";
}
Also used : NetworkGroupDTO(com.tomasio.projects.trainning.dto.NetworkGroupDTO) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) UsuarioForm(com.tomasio.projects.trainning.form.UsuarioForm) ArrayList(java.util.ArrayList) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 20 with NetworkUserDTO

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

the class UsuariosController method showDetails.

@RequestMapping("/detail")
public String showDetails(Model model, WebRequest request) {
    String usuarioId = request.getParameter("usuarioId");
    // buscar o usuário pelo ID
    NetworkUserDTO usuario = userService.findUser(usuarioId);
    // buscar as roles do usuário
    NetworkGroupDTO[] groups = userService.findAllRoleGroups();
    List<String> rolesAssigned = new ArrayList<>();
    for (NetworkGroupDTO group : groups) {
        if (group.getMembers().contains(usuario.getId())) {
            rolesAssigned.add(group.getNome());
        }
    }
    // jogo no ArrayList para trabalhar
    List<NetworkGroupDTO> roles = new ArrayList();
    roles.addAll(Arrays.asList(groups));
    // ordenar a lista de roles
    Collections.sort(roles, new Comparator<NetworkGroupDTO>() {

        @Override
        public int compare(NetworkGroupDTO o1, NetworkGroupDTO o2) {
            return o1.getDescricao().compareTo(o2.getDescricao());
        }
    });
    model.addAttribute("roles", roles);
    model.addAttribute("rolesAssigned", rolesAssigned);
    model.addAttribute("usuario", usuario);
    return "usuarios/detail";
}
Also used : NetworkGroupDTO(com.tomasio.projects.trainning.dto.NetworkGroupDTO) NetworkUserDTO(com.tomasio.projects.trainning.dto.NetworkUserDTO) ArrayList(java.util.ArrayList) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

NetworkUserDTO (com.tomasio.projects.trainning.dto.NetworkUserDTO)29 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)11 DAOException (com.tomasio.projects.trainning.exception.DAOException)10 ArrayList (java.util.ArrayList)10 NetworkUserDAO (com.tomasio.projects.trainning.dao.NetworkUserDAO)9 NetworkGroupDTO (com.tomasio.projects.trainning.dto.NetworkGroupDTO)9 CoreException (com.tomasio.projects.trainning.exeption.CoreException)9 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)4 NetworkGroupDAO (com.tomasio.projects.trainning.dao.NetworkGroupDAO)3 OrganizacaoDAO (com.tomasio.projects.trainning.dao.OrganizacaoDAO)3 CancelamentoMatriculaDTO (com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO)3 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)3 NotificacaoMatriculaDTO (com.tomasio.projects.trainning.dto.NotificacaoMatriculaDTO)3 PreMatriculaDTO (com.tomasio.projects.trainning.dto.PreMatriculaDTO)3 Organizacao (com.tomasio.projects.trainning.model.Organizacao)3 ApresentacaoDTO (com.tomasio.projects.trainning.dto.ApresentacaoDTO)2 CertificadoConclusaoDTO (com.tomasio.projects.trainning.dto.CertificadoConclusaoDTO)2 ConclusaoDTO (com.tomasio.projects.trainning.dto.ConclusaoDTO)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2