public void save(WorkOnAdmissionVo voWorkOnAdmission) throws StaleObjectException, UniqueKeyViolationException { if(!voWorkOnAdmission.isValidated()) throw new DomainRuntimeException("This Work On Admission has not been validated"); if(voWorkOnAdmission.getID_WorkOnAdmission() == null) { if(voWorkOnAdmission.getCareContext() != null) { WorkOnAdmissionVo voWorkOnAdmissiontemp = get(voWorkOnAdmission.getCareContext()); if(voWorkOnAdmissiontemp != null) throw new DomainRuntimeException("A Work On Admission record already exists for this CareContext."); } } DomainFactory factory = getDomainFactory(); WorkOnAdmission doWorkOnAdmiss = WorkOnAdmissionVoAssembler.extractWorkOnAdmission(factory, voWorkOnAdmission); factory.save(doWorkOnAdmiss); }
public WorkOnAdmissionVo get(CareContextRefVo voCareContext) { if(voCareContext == null) throw new CodingRuntimeException("Work On Admission Filter not provided for get call. "); String hql = new String("from WorkOnAdmission w where w.careContext.id = :CARECONTEXT_ID and w.isRIE is null order by w.systemInformation.creationDateTime desc "); java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", voCareContext.getID_CareContext()); if (list.size() == 0) return null; return WorkOnAdmissionVoAssembler.createWorkOnAdmissionVoCollectionFromWorkOnAdmission(list).get(0); }