public ims.clinical.vo.RACPPlanAdviceVo getPlanAdviceForClinicalContact(CareContextRefVo refVoCareContext) { if (refVoCareContext == null) throw new CodingRuntimeException("Cannot get RACPPlanAdviceRefVo for null ClinicalContactRefVo"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" from RACPPlanAdvice rpa where "); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); hql.append(" rpa.careContext.id = :ccId"); markers.add("ccId"); values.add(refVoCareContext.getID_CareContext()); List listRACPPlanAdvice = factory.find(hql.toString(), markers,values); if(listRACPPlanAdvice != null && listRACPPlanAdvice.size() > 0) { RACPPlanAdviceVoCollection voColl = RACPPlanAdviceVoAssembler.createRACPPlanAdviceVoCollectionFromRACPPlanAdvice(listRACPPlanAdvice); if(voColl != null && voColl.size() > 0) return voColl.get(0); } return null; }
public ims.clinical.vo.RACPPlanAdviceVo savePlanAdviceVo(ims.clinical.vo.RACPPlanAdviceVo voPlanAdvice) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { if (voPlanAdvice == null || !voPlanAdvice.isValidated()) throw new CodingRuntimeException("Plan Advice is null or has not been validated"); DomainFactory factory=getDomainFactory(); RACPPlanAdvice doRACPPlanAdvice = RACPPlanAdviceVoAssembler.extractRACPPlanAdvice(factory, voPlanAdvice); factory.save(doRACPPlanAdvice); return RACPPlanAdviceVoAssembler.create(doRACPPlanAdvice); }