use of com.tomasio.projects.trainning.model.PreMatricula in project trainning by fernandotomasio.
the class HibernatePreMatriculaDAO method remove.
@Override
public void remove(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
PreMatricula preMatricula = find(id);
try {
session.delete(preMatricula);
} catch (HibernateException e) {
Logger.getLogger(HibernatePreMatriculaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("prematriculas.remove.error"));
}
}
use of com.tomasio.projects.trainning.model.PreMatricula in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method updatePreMatricula.
@Override
@Transactional
public void updatePreMatricula(PreMatriculaDTO preMatricula) {
PreMatriculaDAO dao = factory.getPreMatriculaDAO();
PreMatricula _preMatricula = null;
if (preMatricula instanceof PreMatriculaAlunoDTO) {
_preMatricula = new PreMatriculaAluno((PreMatriculaAlunoDTO) preMatricula);
} else {
_preMatricula = new PreMatriculaInstrutor((PreMatriculaInstrutorDTO) preMatricula);
}
try {
dao.update(_preMatricula);
} 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());
}
}
use of com.tomasio.projects.trainning.model.PreMatricula in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findAllPreMatriculas.
@Override
@Transactional(readOnly = true)
public PreMatriculaDTO[] findAllPreMatriculas() {
PreMatriculaDAO dao = factory.getPreMatriculaDAO();
PreMatriculaDTO[] preMatriculasArray = null;
try {
List<PreMatricula> preMatriculas = dao.findAll();
if (preMatriculas != null) {
preMatriculasArray = new PreMatriculaDTO[preMatriculas.size()];
for (int i = 0; i < preMatriculas.size(); i++) {
preMatriculasArray[i] = preMatriculas.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 preMatriculasArray;
}
use of com.tomasio.projects.trainning.model.PreMatricula in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method hasPreMatriculas.
private boolean hasPreMatriculas(Long id) throws DAOException {
PreMatriculaDAO dao = factory.getPreMatriculaDAO();
List<PreMatricula> alunos = dao.findAllAlunos(id);
if (alunos.size() > 0) {
return true;
}
List<PreMatricula> instrutores = dao.findAllInstrutores(id);
if (instrutores.size() > 0) {
return true;
}
return false;
}
use of com.tomasio.projects.trainning.model.PreMatricula in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findAllPreMatriculasInstrutores.
@Override
@Transactional(readOnly = true)
public PreMatriculaDTO[] findAllPreMatriculasInstrutores(Long turmaId) {
PreMatriculaDAO dao = factory.getPreMatriculaDAO();
PreMatriculaDTO[] preMatriculasArray = null;
try {
List<PreMatricula> preMatriculas = dao.findAllInstrutores(turmaId);
if (preMatriculas != null) {
preMatriculasArray = new PreMatriculaDTO[preMatriculas.size()];
for (int i = 0; i < preMatriculas.size(); i++) {
preMatriculasArray[i] = preMatriculas.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 preMatriculasArray;
}
Aggregations