use of com.tomasio.projects.trainning.model.Plano 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.model.Plano 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.model.Plano 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