/** * Get Form Commenced */ public ims.nursing.vo.ObservationForm getFormsCommencement(Integer formCommenceID) { DomainFactory factory = getDomainFactory(); ObservationForm formComm = (ObservationForm)factory.getDomainObject(ObservationForm.class, formCommenceID); return (ObservationFormAssembler.create(formComm)); }
/** * Includes both Insert and Update actions */ public ims.nursing.vo.ObservationForm saveFormsCommenced(ims.nursing.vo.ObservationForm formsCommenced) throws StaleObjectException { // Ensure the value object has been validated if (!formsCommenced.isValidated()) throw new DomainRuntimeException("Forms commenced has not been validated"); DomainFactory factory = getDomainFactory(); ObservationForm domFormComm = ObservationFormAssembler.extractObservationForm(factory, formsCommenced); factory.save(domFormComm); return (ObservationFormAssembler.create(domFormComm)); }
/** * List Forms Commencement */ public ObservationFormCollection listFormsCommencement(ObservationForm voObservationForm) { ObservationFormCollection voCollObservationForm = new ObservationFormCollection(); if (voCollObservationForm == null) return voCollObservationForm; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from ObservationForm t "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (voObservationForm.getCareContextIsNotNull()) { hql.append(andStr + " t.careContext.id = :cc"); markers.add("cc"); values.add(voObservationForm.getCareContext().getID_CareContext()); andStr = " and "; if (voObservationForm.getIsStoppedIsNotNull()) { hql.append(andStr + " t.isStopped = :stopped"); markers.add("stopped"); values.add(voObservationForm.getIsStopped()); andStr = " and "; } } if (andStr.equals(" and ")) query += " where "; query += hql.toString(); List procs = factory.find(query, markers, values); return ObservationFormAssembler.createObservationFormCollectionFromObservationForm(procs).sort(SortOrder.DESCENDING); }