/** * saves Work On Discharge record */ public void save(ims.therapies.vo.WorkOnDischargeVo voWorkOnDischarge) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if(!voWorkOnDischarge.isValidated()) throw new DomainRuntimeException("This Work On Discharge has not been validated"); if(voWorkOnDischarge.getID_WorkOnDischarge() == null) { if(voWorkOnDischarge.getCareContext() != null) { WorkOnDischargeVo voWorkOnDischargetemp = get(voWorkOnDischarge.getCareContext()); if(voWorkOnDischargetemp != null) throw new DomainRuntimeException("A Work On Discharge record already exists for this CareContext. "); } } DomainFactory factory = getDomainFactory(); WorkOnDischarge doWorkOnDischarge = WorkOnDischargeVoAssembler.extractWorkOnDischarge(factory, voWorkOnDischarge); factory.save(doWorkOnDischarge); }
/** * get Work on Discharge record for ClinicalContact */ public ims.therapies.vo.WorkOnDischargeVo get(CareContextRefVo voCareContext) { if(voCareContext == null) throw new CodingRuntimeException("Work on Discharg Filter not provided for get call. "); String hql = new String("from WorkOnDischarge 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 WorkOnDischargeVoAssembler.createWorkOnDischargeVoCollectionFromWorkOnDischarge(list).get(0); }