use of com.tomasio.projects.trainning.dao.PlanoDAO 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;
}
use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method searchPlanoByDescricao.
@Override
@Transactional(readOnly = true)
public PlanoDTO[] searchPlanoByDescricao(String term) {
PlanoDAO dao = factory.getPlanoDAO();
PlanoDTO[] planosArray = null;
try {
List<Plano> planos = dao.searchByDescricao(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;
}
use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method findPlanoBySigla.
@Override
@Transactional(readOnly = true)
public PlanoDTO findPlanoBySigla(String sigla) {
PlanoDAO dao = factory.getPlanoDAO();
Plano plano = null;
try {
plano = dao.findBySigla(sigla);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
if (plano != null) {
return plano.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method findAllPlanos.
@Override
@Transactional(readOnly = true)
public PlanoDTO[] findAllPlanos() {
PlanoDAO dao = factory.getPlanoDAO();
List<Plano> planos = (List<Plano>) findAll(dao);
List<PlanoDTO> dtos = new ArrayList<>();
assemblyDTO(dtos, planos, PlanoDTO.class, Plano.class);
PlanoDTO[] resultArray = dtos.toArray(new PlanoDTO[dtos.size()]);
return resultArray;
}
use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method findPlano.
@Override
@Transactional(readOnly = true)
public PlanoDTO findPlano(Long id) {
PlanoDAO dao = factory.getPlanoDAO();
Plano plano = (Plano) find(dao, id);
if (plano != null) {
PlanoDTO dto = new PlanoDTO();
assemblyDTO(dto, plano);
return dto;
} else {
return null;
}
}
Aggregations