use of com.tomasio.projects.trainning.model.Turma in project trainning by fernandotomasio.
the class PlanningServiceSimpleImpl method createTurma.
@Override
@Transactional
public Long createTurma(TurmaDTO turma) {
TurmaDAO dao = factory.getTurmaDAO();
Turma _turma = new TurmaPlanejada((TurmaPlanejadaDTO) turma);
Long id = null;
try {
id = dao.create(_turma);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return id;
}
use of com.tomasio.projects.trainning.model.Turma in project trainning by fernandotomasio.
the class PlanningServiceSimpleImpl method findTurma.
@Override
@Transactional(readOnly = true)
public TurmaDTO findTurma(Long id) {
TurmaDAO dao = factory.getTurmaDAO();
Turma turma = null;
try {
turma = dao.find(id);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
if (turma != null) {
return (TurmaPlanejadaDTO) turma.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.model.Turma in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findAllTurmas.
@Override
@Transactional(readOnly = true)
public TurmaDTO[] findAllTurmas(Long[] ids) {
if (ids == null || ids.length <= 0) {
return new TurmaDTO[0];
}
TurmaDAO dao = factory.getTurmaDAO();
TurmaDTO[] turmasArray = null;
try {
List<Turma> turmas = dao.findAll(Arrays.asList(ids));
// }
if (turmas != null) {
turmasArray = new TurmaDTO[turmas.size()];
for (int i = 0; i < turmas.size(); i++) {
turmasArray[i] = turmas.get(i).createDTOWithoutDependencies();
}
}
} catch (DAOException ex) {
ex.printStackTrace();
throw new CoreException(ex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
}
return turmasArray;
}
use of com.tomasio.projects.trainning.model.Turma in project trainning by fernandotomasio.
the class HibernateTurmaDAO method instantiateTurma.
@SuppressWarnings("unused")
private Turma instantiateTurma(TurmaDTO dto) {
Turma turma;
if (dto instanceof TurmaEfetivaDTO) {
TurmaEfetivaDTO aux = (TurmaEfetivaDTO) dto;
turma = new TurmaEfetiva(aux);
} else {
TurmaPlanejadaDTO aux = (TurmaPlanejadaDTO) dto;
turma = new TurmaPlanejada(aux);
}
return turma;
}
use of com.tomasio.projects.trainning.model.Turma in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findTurmaEfetiva.
@Override
@Transactional(readOnly = true)
public TurmaEfetivaDTO findTurmaEfetiva(Long turmaId) {
TurmaDAO dao = factory.getTurmaDAO();
Turma turma = null;
try {
turma = dao.find(turmaId);
} catch (DAOException ex) {
ex.printStackTrace();
throw new CoreException(ex.getMessage());
} catch (Exception ex) {
ex.printStackTrace();
throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
}
if (turma != null) {
// proccessarPendencias((TurmaEfetiva) turma);
TurmaEfetivaDTO dto = (TurmaEfetivaDTO) turma.createDTO();
return dto;
} else {
return null;
}
}
Aggregations