use of com.tomasio.projects.trainning.model.Area 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.model.Area 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.model.Area 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.model.Area in project trainning by fernandotomasio.
the class HibernateAreaDAO method remove.
@Override
public void remove(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
Area area = (Area) session.get(Area.class, id);
try {
session.delete(area);
} catch (HibernateException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("areas.remove.error"));
}
}
use of com.tomasio.projects.trainning.model.Area in project trainning by fernandotomasio.
the class PlanningServiceSimpleImpl method findAllResponsaveisAnalise.
@Override
@Transactional(readOnly = true)
public ResponsavelAreaDTO[] findAllResponsaveisAnalise(Long planejamentoId, Long areaId) {
AreaDAO areaDAO = factory.getAreaDAO();
Area area = null;
try {
area = areaDAO.find(areaId);
} catch (DAOException ex) {
Logger.getLogger(PlanningServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
}
List<AreaDTO> areasAnalise = this.arrangeAreasByHierarchyUp(area.createDTO());
ResponsavelAreaDTO[] responsaveisAreas = findAllResponsaveisAreas(planejamentoId);
List<ResponsavelAreaDTO> responsaveisAnalise = new ArrayList<ResponsavelAreaDTO>();
for (AreaDTO areaAnalise : areasAnalise) {
for (ResponsavelAreaDTO responsavelArea : responsaveisAreas) {
if (responsavelArea.getArea().equals(areaAnalise)) {
responsaveisAnalise.add(responsavelArea);
// break;
}
}
}
return responsaveisAnalise.toArray(new ResponsavelAreaDTO[responsaveisAnalise.size()]);
}
Aggregations