private void open() { clear(); resetContextVariables(); if(form.getGlobalContext().Core.getCurrentCareContextIsNotNull()){ form.getLocalContext().setLeisureActivities(null); LeisureActivitiesVoCollection coll = domain.getLeisureActivitiesVoByCareContext(form.getGlobalContext().Core.getCurrentCareContext()); if(coll!=null && coll.size()>0) form.getLocalContext().setLeisureActivities(coll.get(0)); } populateControls(form.getLocalContext().getLeisureActivities()); form.setMode(FormMode.VIEW); }
public void save(LeisureActivitiesVo voLeisureActivities) throws StaleObjectException, UniqueKeyViolationException { if(!voLeisureActivities.isValidated()) throw new DomainRuntimeException("This Leisure Activity has not been validated"); if(voLeisureActivities.getID_LeisureActivities() == null) { if(voLeisureActivities.getCareContextIsNotNull()) { LeisureActivitiesVoCollection coll = getLeisureActivitiesVoByCareContext(voLeisureActivities.getCareContext()); if(coll != null && coll.size()>0) throw new DomainRuntimeException("A Leisure record already exists for this CareContext. "); } } DomainFactory factory = getDomainFactory(); LeisureActivities doLeisureActivities = LeisureActivitiesVoAssembler.extractLeisureActivities(factory, voLeisureActivities); factory.save(doLeisureActivities); }
public LeisureActivitiesVoCollection getLeisureActivitiesVoByCareContext(CareContextRefVo voCareContext) { String hql = new String("from LeisureActivities l where l.careContext.id = :CARECONTEXT_ID order by l.systemInformation.creationDateTime desc "); java.util.List list = getDomainFactory().find(hql, "CARECONTEXT_ID", voCareContext.getID_CareContext()); return LeisureActivitiesVoAssembler.createLeisureActivitiesVoCollectionFromLeisureActivities(list); }