Search in sources :

Example 76 with CoreException

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

the class OrganizationalServiceSimpleImpl method searchOrganizacoesFABBySigla.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] searchOrganizacoesFABBySigla(String term) {
    OrganizacaoDAO dao = factory.getOrganizacaoDAO();
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        List<Organizacao> organizacoes = dao.searchOrganizacaoFABBySigla(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)

Example 77 with CoreException

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

the class OrganizationalServiceSimpleImpl method findPostoBySigla.

@Override
@Transactional(readOnly = true)
public PostoDTO findPostoBySigla(String sigla) {
    PostoDAO dao = factory.getPostoDAO();
    Posto posto;
    try {
        posto = dao.findBySigla(sigla);
        if (posto != null) {
            return posto.createDTO();
        } else {
            return null;
        }
    } 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) Posto(com.tomasio.projects.trainning.model.Posto) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 78 with CoreException

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

the class OrganizationalServiceSimpleImpl method findAllOrganizacoesByCidadeId.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] findAllOrganizacoesByCidadeId(Long cidadeId) {
    OrganizacaoDAO dao = factory.getOrganizacaoDAO();
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        List<Organizacao> organizacoes = dao.findAllByCidadeId(cidadeId);
        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 79 with CoreException

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

the class OrganizationalServiceSimpleImpl method searchPessoa.

@Override
@Transactional(readOnly = true)
public PessoaDTO[] searchPessoa(String nome, Long organizacaoId) {
    PessoaDAO dao = factory.getPessoaDAO();
    PessoaDTO[] pessoasArray = null;
    try {
        List<Pessoa> pessoas = dao.search(nome, organizacaoId);
        if (pessoas != null) {
            pessoasArray = new PessoaDTO[pessoas.size()];
            for (int i = 0; i < pessoas.size(); i++) {
                pessoasArray[i] = pessoas.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return pessoasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Pessoa(com.tomasio.projects.trainning.model.Pessoa) Transactional(org.springframework.transaction.annotation.Transactional)

Example 80 with CoreException

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

the class OrganizationalServiceSimpleImpl method updatePessoa.

@Override
@Transactional
public void updatePessoa(PessoaDTO pessoa) {
    PessoaDAO dao = factory.getPessoaDAO();
    Pessoa _pessoa = new Pessoa(pessoa);
    try {
        dao.update(_pessoa);
    } catch (DAOException ex) {
        Logger.getLogger(OrganizationalServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException(ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Pessoa(com.tomasio.projects.trainning.model.Pessoa) 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