public boolean checkDuplicatePregnancyObservation(Individual mother) { List<PregnancyObservation> list = genericDao.findListByProperty(PregnancyObservation.class, "mother", mother); for (PregnancyObservation item : list) { if (item.getStatus().equals(siteProperties.getDataStatusPendingCode())) return false; } return true; }
@Transactional(rollbackFor = Exception.class) public void closePregnancyObservation(Individual mother) { List<PregnancyObservation> obs = genericDao.findListByProperty(PregnancyObservation.class, "mother", mother); for (PregnancyObservation ob : obs) { if (ob.getStatus().equals(siteProperties.getDataStatusPendingCode())) { // found the corresponding pregnancy observation // now close it ob.setStatus(siteProperties.getDataStatusClosedCode()); genericDao.update(ob); break; } } }