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); }
private void open() { clearFields(); form.setMode(FormMode.VIEW); form.getLocalContext().setDrivingVo(null); form.qmbAuthoringCP().setEnabled(false); form.dtimAuthoring().setEnabled(false); DrivingVo voDriving = null; if(form.getGlobalContext().Core.getCurrentCareContextIsNotNull()){ DrivingVoCollection coll = domain.getDrivingByCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if(coll!=null && coll.size()>0 ) voDriving = coll.get(0); } if(voDriving!=null){ populateScreenFromData(voDriving); form.btnUpdate().setVisible(true); form.btnNew().setVisible(false); } else{ LoadGrid(); form.btnUpdate().setVisible(false); form.btnNew().setVisible(true); } }
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; }