Search in sources :

Example 1 with ItemAtaDAO

use of com.tomasio.projects.trainning.dao.ItemAtaDAO in project trainning by fernandotomasio.

the class AtaServiceSimpleImpl method findAllItensAtasByUser.

@Override
@Transactional(readOnly = true)
public ItemAtaDTO[] findAllItensAtasByUser(String user) {
    ItemAtaDAO dao = factory.getItemAtaDAO();
    ItemAtaDTO[] itensArray = null;
    try {
        List<ItemAtaDTO> itensAtas = dao.findAllByUser(user);
        if (itensAtas != null) {
            itensArray = new ItemAtaDTO[itensAtas.size()];
            itensAtas.toArray(itensArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return itensArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ItemAtaDTO(com.tomasio.projects.trainning.dto.ItemAtaDTO) ItemAtaDAO(com.tomasio.projects.trainning.dao.ItemAtaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with ItemAtaDAO

use of com.tomasio.projects.trainning.dao.ItemAtaDAO in project trainning by fernandotomasio.

the class AtaServiceSimpleImpl method createItemAta.

@Override
@Transactional
public Long createItemAta(ItemAtaDTO itemAta) {
    ItemAtaDAO dao = factory.getItemAtaDAO();
    ItemAta _itemAta = null;
    if (itemAta instanceof AcaoDTO) {
        _itemAta = new Acao((AcaoDTO) itemAta);
    }
    if (itemAta instanceof DecisaoDTO) {
        _itemAta = new Decisao((DecisaoDTO) itemAta);
    }
    if (itemAta instanceof ComentarioDTO) {
        _itemAta = new Comentario((ComentarioDTO) itemAta);
    }
    Long id = null;
    try {
        id = dao.create(_itemAta);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return id;
}
Also used : AcaoDTO(com.tomasio.projects.trainning.dto.AcaoDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ItemAta(com.tomasio.projects.trainning.model.ItemAta) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ComentarioDTO(com.tomasio.projects.trainning.dto.ComentarioDTO) DecisaoDTO(com.tomasio.projects.trainning.dto.DecisaoDTO) ItemAtaDAO(com.tomasio.projects.trainning.dao.ItemAtaDAO) Comentario(com.tomasio.projects.trainning.model.Comentario) Acao(com.tomasio.projects.trainning.model.Acao) Decisao(com.tomasio.projects.trainning.model.Decisao) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with ItemAtaDAO

use of com.tomasio.projects.trainning.dao.ItemAtaDAO in project trainning by fernandotomasio.

the class AtaServiceSimpleImpl method findAllItensAtasByItemPlanejamentoId.

@Override
@Transactional(readOnly = true)
public ItemAtaDTO[] findAllItensAtasByItemPlanejamentoId(Long itemPlanejamentoId) {
    ItemAtaDAO dao = factory.getItemAtaDAO();
    ItemAtaDTO[] itensArray = null;
    try {
        List<ItemAtaDTO> itensAtas = dao.findAllByItemPlanejamentoId(itemPlanejamentoId);
        if (itensAtas != null) {
            itensArray = new ItemAtaDTO[itensAtas.size()];
            itensAtas.toArray(itensArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return itensArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ItemAtaDTO(com.tomasio.projects.trainning.dto.ItemAtaDTO) ItemAtaDAO(com.tomasio.projects.trainning.dao.ItemAtaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with ItemAtaDAO

use of com.tomasio.projects.trainning.dao.ItemAtaDAO in project trainning by fernandotomasio.

the class AtaServiceSimpleImpl method findAllItensAtas.

@Override
@Transactional(readOnly = true)
public ItemAtaDTO[] findAllItensAtas() {
    ItemAtaDAO dao = factory.getItemAtaDAO();
    ItemAtaDTO[] itensArray = null;
    try {
        List<ItemAtaDTO> itensAtas = dao.findAll();
        if (itensAtas != null) {
            itensArray = new ItemAtaDTO[itensAtas.size()];
            itensAtas.toArray(itensArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return itensArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ItemAtaDTO(com.tomasio.projects.trainning.dto.ItemAtaDTO) ItemAtaDAO(com.tomasio.projects.trainning.dao.ItemAtaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ItemAtaDAO

use of com.tomasio.projects.trainning.dao.ItemAtaDAO in project trainning by fernandotomasio.

the class AtaServiceSimpleImpl method findItemAta.

@Override
@Transactional(readOnly = true)
public ItemAtaDTO findItemAta(Long id) {
    ItemAtaDAO dao = factory.getItemAtaDAO();
    ItemAtaDTO itemAta = null;
    try {
        itemAta = dao.find(id);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return itemAta;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ItemAtaDTO(com.tomasio.projects.trainning.dto.ItemAtaDTO) ItemAtaDAO(com.tomasio.projects.trainning.dao.ItemAtaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ItemAtaDAO (com.tomasio.projects.trainning.dao.ItemAtaDAO)5 DAOException (com.tomasio.projects.trainning.exception.DAOException)5 CoreException (com.tomasio.projects.trainning.exeption.CoreException)5 Transactional (org.springframework.transaction.annotation.Transactional)5 ItemAtaDTO (com.tomasio.projects.trainning.dto.ItemAtaDTO)4 AcaoDTO (com.tomasio.projects.trainning.dto.AcaoDTO)1 ComentarioDTO (com.tomasio.projects.trainning.dto.ComentarioDTO)1 DecisaoDTO (com.tomasio.projects.trainning.dto.DecisaoDTO)1 Acao (com.tomasio.projects.trainning.model.Acao)1 Comentario (com.tomasio.projects.trainning.model.Comentario)1 Decisao (com.tomasio.projects.trainning.model.Decisao)1 ItemAta (com.tomasio.projects.trainning.model.ItemAta)1