public DrivingVo saveDriving(DrivingVo driving) throws StaleObjectException { if (!driving.isValidated()) { throw new DomainRuntimeException("This WheelchairSkillsVo has not been validated"); } if(driving.getID_Driving() == null) { if(driving.getCareContext() != null) { if(driving.getCareContext() != null) { DrivingVoCollection coll = getDrivingByCareContext(driving.getCareContext()); if(coll != null && coll.size()>0) throw new DomainRuntimeException("A Driving record already exists for current CareContext."); } } } DomainFactory factory = getDomainFactory(); Driving domDriving = DrivingVoAssembler.extractDriving(factory, driving); factory.save(domDriving); return DrivingVoAssembler.create(domDriving); }
public DrivingVoCollection getDrivingByCareContext(CareContextRefVo voCareContext) { if(voCareContext == null) throw new CodingRuntimeException("ElectrotherapyPneumatic Filter not provided for get call. "); String hql = new String("from Driving d where d.careContext.id = :CARECONTEXT_ID order by d.systemInformation.creationDateTime desc"); java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", voCareContext.getID_CareContext()); if (list.size() == 0) return null; DrivingVoCollection coll = DrivingVoAssembler.createDrivingVoCollectionFromDriving(list); return coll; }