Search in sources :

Example 41 with OrganizacaoDTO

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

the class TurmasEfetivasController method listIndicacoesAjax.

@RequestMapping("/detail/indicacoes/ajax")
@ResponseBody
public List listIndicacoesAjax(Model model, WebRequest request, @ModelAttribute("turma") TurmaEfetivaDTO turma, @ModelAttribute("permissionsManager") BusinessPermissionsManager permissionManager, @ModelAttribute("userOrganization") OrganizacaoDTO userOrganization) {
    List<Map> result = new ArrayList<Map>();
    IndicacaoDTO[] indicacoes = atividadesEnsinoService.findAllIndicacoesAlunos(turma.getId());
    OrganizacaoDTO[] organizacoesSubordinadas = organizationalService.findAllOrganizacoesSubordinadas(userOrganization.getId());
    List subordinadasList = new ArrayList();
    for (int i = 0; i < organizacoesSubordinadas.length; i++) {
        subordinadasList.add(organizacoesSubordinadas[i]);
    }
    subordinadasList.add(userOrganization);
    for (IndicacaoDTO indicacaoDTO : indicacoes) {
        // PessoaDTO pessoa = organizationalService.findPessoa(indicacaoDTO.getPessoa().getId());
        Map item = new HashMap();
        item.put("pessoa", indicacaoDTO.getPessoa().getTargetaCompletaOM());
        item.put("prioridade", indicacaoDTO.getPrioridade());
        item.put("data", indicacaoDTO.getDataCriacaoFormatted());
        // OrganizacaoDTO beneficiada = organizationalService.findOrganizacao(indicacaoDTO.getOrganizacaoBeneficiada().getId());
        item.put("beneficiada", indicacaoDTO.getOrganizacaoBeneficiada().getSigla());
        // OrganizacaoDTO responsavel = organizationalService.findOrganizacao(indicacaoDTO.getOrganizacao().getId());
        item.put("responsavel", indicacaoDTO.getOrganizacao().getSigla());
        item.put("objectId", indicacaoDTO.getObjectId());
        item.put("id", indicacaoDTO.getId());
        item.put("organizacao", indicacaoDTO.getOrganizacao().getSigla());
        item.put("status", indicacaoDTO.getStatus());
        for (OrganizacaoDTO organizacaoDTO : organizacoesSubordinadas) {
            if (indicacaoDTO.getOrganizacao().getId().equals(organizacaoDTO.getId()) || indicacaoDTO.getOrganizacaoBeneficiada().getId().equals(organizacaoDTO.getId())) {
                item.put("rowClass", "warning");
            }
        }
        if (indicacaoDTO.getOrganizacao().getId().equals(userOrganization.getId()) || indicacaoDTO.getOrganizacaoBeneficiada().getId().equals(userOrganization.getId())) {
            item.put("rowClass", "warning");
        }
        if (userOrganization.equals(indicacaoDTO.getNextWorkflowActor())) {
            item.put("alert", true);
            item.put("rowClass", "danger");
        } else {
            item.put("alert", false);
        }
        Map distribuicaoStatus = new HashMap();
        int statusInt = indicacaoDTO.getDistribuicaoStatus();
        switch(statusInt) {
            case 0:
                distribuicaoStatus.put("cssClass", "");
                distribuicaoStatus.put("label", "");
                break;
            case 1:
                distribuicaoStatus.put("cssClass", "label-success arrowed");
                distribuicaoStatus.put("label", "Dentro das Vagas");
                break;
            case 2:
                distribuicaoStatus.put("cssClass", "label-warning arrowed");
                distribuicaoStatus.put("label", "Vagas Reserva");
                break;
            case 3:
                distribuicaoStatus.put("cssClass", "label-grey arrowed");
                distribuicaoStatus.put("label", "Fora da Distribuição de Vagas. Não impede a Matrícula!");
                break;
            case 4:
                distribuicaoStatus.put("cssClass", "label-danger arrowed");
                distribuicaoStatus.put("label", "Não aprovado");
                break;
            case 5:
                distribuicaoStatus.put("cssClass", "label-info arrowed");
                distribuicaoStatus.put("label", "Aguardando Aprovação");
                break;
            default:
                distribuicaoStatus.put("cssClass", "label-danger arrowed");
                distribuicaoStatus.put("label", "INDEFINIDO");
        }
        item.put("distribuicaoStatus", distribuicaoStatus);
        Map grants = new HashMap();
        boolean indicacaoSubordinada = subordinadasList.contains(indicacaoDTO.getOrganizacao());
        boolean edit = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.EDIT, indicacaoDTO, userOrganization)) {
            edit = true;
        }
        grants.put("edit", edit);
        boolean remove = false;
        if (indicacaoSubordinada && (permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.REMOVE, indicacaoDTO, userOrganization) || turma.getOrganizacaoGestoraId().equals(userOrganization.getId()))) {
            remove = true;
        }
        grants.put("remove", remove);
        boolean aprove = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.APROVE, indicacaoDTO, userOrganization)) {
            aprove = true;
        }
        grants.put("aprove", aprove);
        boolean cancelAprove = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.CANCEL_APROVE, indicacaoDTO, userOrganization)) {
            cancelAprove = true;
        }
        grants.put("cancelAprove", cancelAprove);
        boolean reject = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.REJECT, indicacaoDTO, userOrganization)) {
            reject = true;
        }
        grants.put("reject", reject);
        boolean cancelReject = false;
        if (indicacaoSubordinada && permissionManager.hasPermissionForIndicacao(IndicacaoPermissionModel.CANCEL_REJECT, indicacaoDTO, userOrganization)) {
            cancelReject = true;
        }
        grants.put("cancelReject", cancelReject);
        item.put("grants", grants);
        result.add(item);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Map(java.util.Map) HashMap(java.util.HashMap) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 42 with OrganizacaoDTO

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

the class TurmasEfetivasController method initializeSelectableOrganizacoes.

public Map initializeSelectableOrganizacoes() {
    Map result = new HashMap();
    List<OrganizacaoDTO> organizacoes = null;
    organizacoes = Arrays.asList(organizationalService.findAllOrganizacoes());
    result.put(null, "");
    for (OrganizacaoDTO organizacaoDTO : organizacoes) {
        result.put(organizacaoDTO.getId(), organizacaoDTO.getSigla());
    }
    return result;
}
Also used : HashMap(java.util.HashMap) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Map(java.util.Map) HashMap(java.util.HashMap)

Example 43 with OrganizacaoDTO

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

the class OrganizationalServiceSimpleImpl method findAllOrganizacoesExternasByEstadoId.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] findAllOrganizacoesExternasByEstadoId(Long estadoId) {
    OrganizacaoDAO dao = factory.getOrganizacaoDAO();
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        List<Organizacao> organizacoes = dao.findAllExternoByEstadoId(estadoId);
        if (organizacoes != null) {
            organizacoesArray = convertToArray(organizacoes);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return organizacoesArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Organizacao(com.tomasio.projects.trainning.model.Organizacao) CoreException(com.tomasio.projects.trainning.exeption.CoreException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 44 with OrganizacaoDTO

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

the class OrganizationalServiceSimpleImpl method findAllOrganizacoesFAB.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] findAllOrganizacoesFAB() {
    OrganizacaoDAO dao = factory.getOrganizacaoDAO();
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        List<Organizacao> organizacoes = dao.findAllOrganizacaoFAB();
        if (organizacoes != null) {
            organizacoesArray = convertToArray(organizacoes);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return organizacoesArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Organizacao(com.tomasio.projects.trainning.model.Organizacao) CoreException(com.tomasio.projects.trainning.exeption.CoreException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 45 with OrganizacaoDTO

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

the class OrganizationalServiceSimpleImpl method searchOrganizacoesFABByNome.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] searchOrganizacoesFABByNome(String term) {
    OrganizacaoDAO dao = factory.getOrganizacaoDAO();
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        List<Organizacao> organizacoes = dao.searchOrganizacaoFABByNome(term);
        if (organizacoes != null) {
            organizacoesArray = convertToArray(organizacoes);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return organizacoesArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Organizacao(com.tomasio.projects.trainning.model.Organizacao) CoreException(com.tomasio.projects.trainning.exeption.CoreException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)150 CoreException (com.tomasio.projects.trainning.exeption.CoreException)54 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)52 ArrayList (java.util.ArrayList)41 HashMap (java.util.HashMap)39 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)37 DAOException (com.tomasio.projects.trainning.exception.DAOException)37 Organizacao (com.tomasio.projects.trainning.model.Organizacao)35 Map (java.util.Map)35 Transactional (org.springframework.transaction.annotation.Transactional)35 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)33 Date (java.util.Date)23 SimpleDateFormat (java.text.SimpleDateFormat)21 List (java.util.List)18 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)17 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)14 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)14 CancelamentoMatriculaDTO (com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO)12 CustoDTO (com.tomasio.projects.trainning.dto.CustoDTO)12 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)12