use of com.tomasio.projects.trainning.model.Campo in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findCampo.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public CampoDTO findCampo(Long id) {
CampoDAO dao = factory.getCampoDAO();
Campo campo = null;
try {
campo = 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 (campo != null) {
return campo.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.model.Campo in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method createCampo.
@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createCampo(CampoDTO campo) {
CampoDAO dao = factory.getCampoDAO();
Campo model = new Campo(campo);
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.Campo in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method updateCampo.
@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateCampo(CampoDTO campo) {
CampoDAO dao = factory.getCampoDAO();
Campo model = new Campo(campo);
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.Campo in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findAllCampos.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public CampoDTO[] findAllCampos() {
CampoDAO dao = factory.getCampoDAO();
CampoDTO[] camposArray = null;
try {
List<Campo> campos = dao.findAll();
camposArray = new CampoDTO[campos.size()];
for (int i = 0; i < camposArray.length; i++) {
camposArray[i] = campos.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.toString());
}
return camposArray;
}
Aggregations