Search in sources :

Example 96 with CoreException

use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method searchCurso.

@Override
@Transactional(readOnly = true)
public CursoDTO[] searchCurso(String searchTerm, Long planoId, Long areaId, Boolean ativo, Boolean permiteEstrangeiro) {
    CursoDAO dao = factory.getCursoDAO();
    CursoDTO[] cursosArray = null;
    try {
        List<Curso> cursos = dao.search(searchTerm, planoId, areaId, ativo, permiteEstrangeiro);
        if (cursos != null) {
            cursosArray = new CursoDTO[cursos.size()];
            for (int i = 0; i < cursos.size(); i++) {
                cursosArray[i] = cursos.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return cursosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CursoDTO(com.tomasio.projects.trainning.dto.CursoDTO) Curso(com.tomasio.projects.trainning.model.Curso) CursoDAO(com.tomasio.projects.trainning.dao.CursoDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 97 with CoreException

use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method updatePlano.

@Override
@Transactional
public void updatePlano(PlanoDTO planoDTO) {
    PlanoDAO dao = factory.getPlanoDAO();
    Plano model = new Plano();
    assemblyEntity(planoDTO, model);
    try {
        dao.update(model);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + 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) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Example 98 with CoreException

use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method findArea.

@Override
@Transactional(readOnly = true)
public AreaDTO findArea(Long id) {
    AreaDAO dao = factory.getAreaDAO();
    Area area = null;
    try {
        area = dao.find(id);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    if (!(area == null)) {
        return area.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Area(com.tomasio.projects.trainning.model.Area) CoreException(com.tomasio.projects.trainning.exeption.CoreException) AreaDAO(com.tomasio.projects.trainning.dao.AreaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 99 with CoreException

use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method findCursoByCodigo.

@Override
@Transactional(readOnly = true)
public CursoDTO findCursoByCodigo(String codigo) {
    CursoDAO dao = factory.getCursoDAO();
    Curso curso = null;
    try {
        curso = dao.findByCodigo(codigo);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    if (curso != null) {
        return curso.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Curso(com.tomasio.projects.trainning.model.Curso) CursoDAO(com.tomasio.projects.trainning.dao.CursoDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 100 with CoreException

use of com.tomasio.projects.trainning.exeption.CoreException in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method findCurso.

@Override
@Transactional(readOnly = true)
public CursoDTO findCurso(Long id) {
    CursoDAO dao = factory.getCursoDAO();
    Curso curso = null;
    try {
        curso = dao.find(id);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    if (curso != null) {
        return curso.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Curso(com.tomasio.projects.trainning.model.Curso) CursoDAO(com.tomasio.projects.trainning.dao.CursoDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

CoreException (com.tomasio.projects.trainning.exeption.CoreException)435 DAOException (com.tomasio.projects.trainning.exception.DAOException)388 Transactional (org.springframework.transaction.annotation.Transactional)372 ParseException (java.text.ParseException)91 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)53 Organizacao (com.tomasio.projects.trainning.model.Organizacao)41 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)40 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)30 PreMatriculaDAO (com.tomasio.projects.trainning.dao.PreMatriculaDAO)27 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)25 PreMatricula (com.tomasio.projects.trainning.model.PreMatricula)25 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)23 PreMatriculaDTO (com.tomasio.projects.trainning.dto.PreMatriculaDTO)21 CancelamentoMatriculaDAO (com.tomasio.projects.trainning.dao.CancelamentoMatriculaDAO)20 NotificacaoMatriculaDAO (com.tomasio.projects.trainning.dao.NotificacaoMatriculaDAO)20 Date (java.util.Date)20 MatriculaDAO (com.tomasio.projects.trainning.dao.MatriculaDAO)19 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)19 CancelamentoMatricula (com.tomasio.projects.trainning.model.CancelamentoMatricula)18 Indicacao (com.tomasio.projects.trainning.model.Indicacao)18