public HomeVisitVo saveHomeVisitAccess(HomeVisitVo homeVisitVo) throws StaleObjectException, UniqueKeyViolationException { DomainFactory factory = getDomainFactory(); if (!homeVisitVo.isValidated()) { throw new DomainRuntimeException("This HomeVisitVo has not been validated"); } if(homeVisitVo.getID_HomeVisit() == null) { if(homeVisitVo.getCareContextIsNotNull()) { HomeVisitVoCollection coll = getHomeVisitVoByCareContext(homeVisitVo.getCareContext()); if(coll != null && coll.size()>0) throw new UniqueKeyViolationException("A Home Visit record already exists for this CareContext. "); } } HomeVisit domHomeVisit = HomeVisitVoAssembler.extractHomeVisit(factory, homeVisitVo); factory.save(domHomeVisit); return HomeVisitVoAssembler.create(domHomeVisit); }
public HomeVisitVo getHomeVisitAccByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { if(voClinicalContactRef == null || voClinicalContactRef.getID_ClinicalContact() == null) throw new DomainRuntimeException("Contact not provided for get call. "); DomainFactory factory = getDomainFactory(); java.util.List home = factory.find("from HomeVisit hv where hv.clinicalContact.id = :contactId", new String[]{"contactId"}, new Object[]{voClinicalContactRef.getID_ClinicalContact()}); if ((home != null) && (home.size()>0)){ HomeVisitVoCollection collHomeVisit = HomeVisitVoAssembler.createHomeVisitVoCollectionFromHomeVisit(home); if(collHomeVisit!=null && collHomeVisit.size()!=0) return collHomeVisit.get(0); } return null; }
public HomeVisitVo getHomeVisitAccByCareContext(CareContextRefVo voCareContextRef) { if(voCareContextRef == null || voCareContextRef.getID_CareContext() == null) throw new DomainRuntimeException("Context not provided for get call. "); DomainFactory factory = getDomainFactory(); java.util.List home = factory.find("from HomeVisit hv where hv.careContext.id = :id and hv.clinicalContact is null", new String[]{"id"}, new Object[]{voCareContextRef.getID_CareContext()}); //WDEV-13700 if (home == null || home.size() == 0) return null; HomeVisitVoCollection collection = HomeVisitVoAssembler.createHomeVisitVoCollectionFromHomeVisit(home); if (collection != null && collection.size() > 0) return collection.get(0); return null; }
public HomeVisitVoCollection getHomeVisitVoByCareContext(CareContextRefVo voCareContext) { String hql = new String("from HomeVisit hv where hv.careContext.id = :CARECONTEXT_ID"); java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", voCareContext.getID_CareContext()); return HomeVisitVoAssembler.createHomeVisitVoCollectionFromHomeVisit(list); }