Search in sources :

Example 6 with PlanoDTO

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

the class CursosController method initializeSelectablePlanos.

public Map<Long, String> initializeSelectablePlanos() {
    Map<Long, String> selectablePlanos = new HashMap<Long, String>();
    selectablePlanos.put(0L, "");
    for (PlanoDTO plano : trainningService.findAllPlanos()) {
        selectablePlanos.put(plano.getId(), plano.getSigla());
    }
    return selectablePlanos;
}
Also used : HashMap(java.util.HashMap) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO)

Example 7 with PlanoDTO

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

the class TreinamentosSolicitadosController method initializeSelectablePlanosEnsino.

public Map initializeSelectablePlanosEnsino(Long planejamentoId) {
    Map selectablePlanosEnsino = new HashMap();
    Set<PlanoDTO> planos = new HashSet<>();
    ItemPlanejamentoDTO[] itens = planningService.findAllItensPlanejamentoByPlanejamentoId(planejamentoId);
    for (ItemPlanejamentoDTO item : itens) {
        CursoDTO curso = trainningService.findCurso(item.getCurso().getId());
        if (curso.getPlano() != null) {
            planos.add(curso.getPlano());
        }
    }
    for (PlanoDTO plano : planos) {
        selectablePlanosEnsino.put(plano.getId(), plano.getSigla());
    }
    return selectablePlanosEnsino;
}
Also used : ItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO) HashMap(java.util.HashMap) CursoDTO(com.tomasio.projects.trainning.dto.CursoDTO) HashMap(java.util.HashMap) Map(java.util.Map) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) HashSet(java.util.HashSet)

Example 8 with PlanoDTO

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

the class SGCAuthService method createCurso.

/**
 * This is a sample web service operation
 *
 * @param codigo
 * @param descricao
 * @param ativo
 * @param permiteEstrangeiros
 * @param planoId
 * @param quantidadeVagas
 * @param duracao
 * @param objetivos
 * @param disciplinas
 * @param preRequisitos
 * @return
 */
@WebMethod(operationName = "createCurso")
public Long createCurso(@WebParam(name = "codigo") String codigo, @WebParam(name = "descricao") String descricao, @WebParam(name = "ativo") Boolean ativo, @WebParam(name = "permiteEstrangeiros") Boolean permiteEstrangeiros, @WebParam(name = "planoId") Long planoId, @WebParam(name = "quantidadeVagas") Integer quantidadeVagas, @WebParam(name = "duracao") Integer duracao, @WebParam(name = "objetivos") String objetivos, @WebParam(name = "disciplinas") String disciplinas, @WebParam(name = "preRequisitos") String preRequisitos) {
    CursoDTO curso = new CursoDTO();
    curso.setCodigo(codigo);
    curso.setDescricao(descricao);
    curso.setAtivo(ativo);
    curso.setEstrangeiro(permiteEstrangeiros);
    PlanoDTO plano = trainningService.findPlano(planoId);
    curso.setPlano(plano);
    curso.setQuantidadeVagas(quantidadeVagas);
    curso.setDuracao(duracao);
    FolhaRostoDTO folhaRosto = new FolhaRostoDTO();
    folhaRosto.setObjetivo(objetivos);
    folhaRosto.setDisciplinas(disciplinas);
    folhaRosto.setPreRequisitos(preRequisitos);
    curso.setFolhaRosto(folhaRosto);
    return trainningService.createCurso(curso);
}
Also used : CursoDTO(com.tomasio.projects.trainning.dto.CursoDTO) FolhaRostoDTO(com.tomasio.projects.trainning.dto.FolhaRostoDTO) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) WebMethod(javax.jws.WebMethod)

Example 9 with PlanoDTO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllPlanos.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] findAllPlanos() {
    PlanoDAO dao = factory.getPlanoDAO();
    List<Plano> planos;
    PlanoDTO[] planosArray = null;
    try {
        planos = dao.findAll();
        planosArray = new PlanoDTO[planos.size()];
        for (int i = 0; i < planos.size(); i++) {
            planosArray[i] = planos.get(i).createDTOWithoutDependencies();
        }
        return planosArray;
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Plano(com.tomasio.projects.trainning.model.Plano) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with PlanoDTO

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

the class TrainningServiceSimpleImpl method searchPlanoBySigla.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] searchPlanoBySigla(String term) {
    PlanoDAO dao = factory.getPlanoDAO();
    PlanoDTO[] planosArray = null;
    try {
        List<Plano> planos = dao.searchBySigla(term);
        if (planos != null) {
            planosArray = new PlanoDTO[planos.size()];
            for (int i = 0; i < planos.size(); i++) {
                planosArray[i] = planos.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return planosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PlanoDTO (com.tomasio.projects.trainning.dto.PlanoDTO)15 PlanoDAO (com.tomasio.projects.trainning.dao.PlanoDAO)6 Plano (com.tomasio.projects.trainning.model.Plano)5 Transactional (org.springframework.transaction.annotation.Transactional)5 CoreException (com.tomasio.projects.trainning.exeption.CoreException)4 HashMap (java.util.HashMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 DAOException (com.tomasio.projects.trainning.exception.DAOException)3 Map (java.util.Map)3 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)2 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 DAOFactory (com.tomasio.projects.trainning.dao.DAOFactory)1 FolhaRostoDTO (com.tomasio.projects.trainning.dto.FolhaRostoDTO)1 ItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO)1 PlanoForm (com.tomasio.projects.trainning.form.PlanoForm)1 ParseException (java.text.ParseException)1 HashSet (java.util.HashSet)1 WebMethod (javax.jws.WebMethod)1