use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method createDisciplina.
@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createDisciplina(DisciplinaDTO disciplina) {
DisciplinaDAO dao = factory.getDisciplinaDAO();
Disciplina model = new Disciplina(disciplina);
Long id = null;
try {
id = dao.create(model);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
} catch (Exception ex) {
throw new CoreException("Erro de sistema: " + ex.getMessage());
}
return id;
}
use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method updateDisciplina.
@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateDisciplina(DisciplinaDTO disciplina) {
DisciplinaDAO dao = factory.getDisciplinaDAO();
Disciplina model = new Disciplina(disciplina);
try {
dao.update(model);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
} catch (Exception ex) {
throw new CoreException("Erro de sistema: " + ex.getMessage());
}
}
use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findDisciplina.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public DisciplinaDTO findDisciplina(Long id) {
DisciplinaDAO dao = factory.getDisciplinaDAO();
Disciplina disciplina = null;
try {
disciplina = dao.find(id);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
} catch (Exception ex) {
throw new CoreException("Erro de sistema: " + ex.getMessage());
}
if (disciplina != null) {
return disciplina.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findAllDisciplinasByPUD.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public DisciplinaDTO[] findAllDisciplinasByPUD(Long pudId) {
DisciplinaDAO dao = factory.getDisciplinaDAO();
DisciplinaDTO[] disciplinasArray = null;
try {
List<Disciplina> disciplinas = dao.findAllByPUD(pudId);
disciplinasArray = new DisciplinaDTO[disciplinas.size()];
for (int i = 0; i < disciplinasArray.length; i++) {
disciplinasArray[i] = disciplinas.get(i).createDTO();
}
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
} catch (Exception ex) {
throw new CoreException("Erro de sistema: " + ex.getMessage());
}
return disciplinasArray;
}
Aggregations