use of com.tomasio.projects.trainning.dao.AreaDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method findArea.
@Override
@Transactional(readOnly = true)
public AreaDTO findArea(Long id) {
AreaDAO dao = factory.getAreaDAO();
Area area = null;
try {
area = dao.find(id);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
if (!(area == null)) {
return area.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.dao.AreaDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method updateArea.
@Override
@Transactional
public void updateArea(AreaDTO area) {
AreaDAO dao = factory.getAreaDAO();
Area _area = new Area(area);
try {
dao.update(_area);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
}
use of com.tomasio.projects.trainning.dao.AreaDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method findAllAreas.
@Override
@Transactional(readOnly = true)
public AreaDTO[] findAllAreas() {
AreaDAO dao = factory.getAreaDAO();
AreaDTO[] areasArray = null;
try {
List<Area> areas = dao.findAll();
if (areas != null) {
areasArray = new AreaDTO[areas.size()];
for (int i = 0; i < areas.size(); i++) {
areasArray[i] = areas.get(i).createDTO();
}
}
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return areasArray;
}
use of com.tomasio.projects.trainning.dao.AreaDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method findAllAreasExcept.
@Override
@Transactional(readOnly = true)
public AreaDTO[] findAllAreasExcept(Long areaId) {
AreaDAO dao = factory.getAreaDAO();
AreaDTO[] areasArray = null;
try {
List<Area> areas = dao.findAll();
if (areas != null) {
List<Area> filtered_areas = new ArrayList<Area>();
for (Area area : areas) {
if (!area.getId().equals(areaId)) {
filtered_areas.add(area);
}
}
areasArray = new AreaDTO[filtered_areas.size()];
for (int i = 0; i < filtered_areas.size(); i++) {
areasArray[i] = filtered_areas.get(i).createDTO();
}
}
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return areasArray;
}
use of com.tomasio.projects.trainning.dao.AreaDAO in project trainning by fernandotomasio.
the class TrainningServiceSimpleImpl method findAllAreasByPlanejamentoId.
@Override
@Transactional(readOnly = true)
public AreaDTO[] findAllAreasByPlanejamentoId(Long planejamentoId) {
AreaDAO dao = factory.getAreaDAO();
AreaDTO[] areasArray = null;
try {
List<Area> areas = dao.findAllAreasByPlanejamento(planejamentoId);
if (areas != null) {
areasArray = new AreaDTO[areas.size()];
for (int i = 0; i < areas.size(); i++) {
areasArray[i] = areas.get(i).createDTO();
}
}
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
}
return areasArray;
}
Aggregations