use of com.tomasio.projects.trainning.dto.PlanoDTO 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.dto.PlanoDTO 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.dto.PlanoDTO 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;
}
}
use of com.tomasio.projects.trainning.dto.PlanoDTO in project trainning by fernandotomasio.
the class ImportPlanosImpl method execute.
@Override
public void execute() {
try {
DAOFactory factory = DAOUtil.getDAOFactory();
PlanoDAO dao = factory.getPlanoDAO();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/dctp?user=root&password=123456");
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery("SELECT * FROM plano");
while (rs.next()) {
String sigla = rs.getString("Plano");
String descricao = rs.getString("Plano");
PlanoDTO plano = new PlanoDTO();
plano.setSigla(sigla);
plano.setDescricao(descricao);
// dao.create(plano);
}
conn.close();
} catch (SQLException ex) {
Logger.getLogger(ImportCursosImpl.class.getName()).log(Level.SEVERE, null, ex);
}
// catch (DAOException ex) {
// Logger.getLogger(ImportCursosImpl.class.getName()).log(Level.SEVERE, null, ex);
// }
}
use of com.tomasio.projects.trainning.dto.PlanoDTO in project trainning by fernandotomasio.
the class Plano method createDTO.
public PlanoDTO createDTO() {
PlanoDTO dto = createDTOWithoutDependencies();
dto.setSigla(this.sigla);
dto.setDescricao(this.descricao);
dto.setId(this.id);
dto.setDiasIndicacaoInicio(diasIndicacaoInicio);
dto.setDiasIndicacaoTermino(diasIndicacaoTermino);
dto.setObjectId(this.getObjectId());
return dto;
}
Aggregations