private void populateChildCollectionFromGrid(RehabilitationVo voRehab) { if (form.grdActivity().getValue() == null) return; if (voRehab.getRehabActivity() == null) voRehab.setRehabActivity(new RehabilitationActivityVoCollection()); GenForm.grdActivityRow parentRow = form.grdActivity().getValue() instanceof RehabilitationShortVo ? form.grdActivity().getSelectedRow() : form.grdActivity().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voRehab.getRehabActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voRehab.getRehabActivity().add((RehabilitationActivityVo) parentRow.getRows().get(i).getValue()); } }
/** * Save a rehab Record for a Clinical Contact */ public ims.therapies.vo.RehabilitationVo saveRehabVo(ims.therapies.vo.RehabilitationVo voRehab) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException { // Ensure the value object has been validated if (!voRehab.isValidated()) throw new DomainRuntimeException("Rehabilitation has not been validated"); if (voRehab.getID_Rehabilitation() == null && getRehabVo(voRehab.getClinicalContact()) != null) throw new UniqueKeyViolationException("The screen will be refreshed."); DomainFactory factory = getDomainFactory(); Rehabilitation doRehab = RehabilitationVoAssembler.extractRehabilitation(factory, voRehab); factory.save(doRehab); return RehabilitationVoAssembler.create(doRehab); }
private boolean newParentNode(RehabilitationVo voNewParent) { if (voNewParent == null) return true; RehabilitationShortVo voParentShort = new RehabilitationShortVo(); voParentShort.setAuthoringCP(form.ctnDetail().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnDetail().dtimAuthoring().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); String[] errors = voParentShort.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } GenForm.grdActivityRow parentRow = form.grdActivity().getRows().newRow(); StringBuffer text = new StringBuffer(); if(voParentShort.getAuthoringDateTime()!=null){ text.append(voParentShort.getAuthoringDateTime().toString()); text.append(" "); } if(voParentShort.getAuthoringCP()!=null) text.append(voParentShort.getAuthoringCP().toString()); parentRow.setColDateTime(text.toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdActivity().setValue(voParentShort); return true; }
/** * @calls the Domain Get for the selected node.. * */ private void expandParentNode(GenForm.grdActivityRow selectedRow) { if (selectedRow.getValue() instanceof RehabilitationShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((RehabilitationShortVo) selectedRow.getValue())); form.getLocalContext().setParentInstance(form.getLocalContext().getSelectedParentInstance()); //wdev-13599 if (form.getLocalContext().getSelectedParentInstance() == null ) return; RehabilitationVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull() && (voParentInstance.getClinicalContact().getID_ClinicalContact().equals (form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))) { // If this is the Golden Node then we'll colour it golden (ok then beige). form.getLocalContext().setGoldenInstanceFound(new Boolean(true)); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); selectedRow.setBackColor(Color.Beige); } if (voParentInstance.getRehabActivityIsNotNull()) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getRehabActivity()); } populateParentInstanceControls(voParentInstance); }
private RehabilitationVo getParentFromDomain(RehabilitationShortVo voRehabShort) { if(engine.isRIEMode()) //wdev-13599 return domain.getRehabById(voRehabShort); else return domain.getRehabVo(voRehabShort.getClinicalContact()); }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdActivity().getValue() instanceof RehabilitationShortVo || form.grdActivity().getValue() instanceof RehabilitationVo)); form.setMode(FormMode.EDIT); if (form.grdActivity().getValue() instanceof RehabilitationActivityVo) { RehabilitationActivityVo voCachedChild = (RehabilitationActivityVo) form.grdActivity().getValue(); if (voCachedChild.getID_RehabilitationActivity() == null) { populateChildInstanceControlsForUpdate(voCachedChild); } } }
private void newParentInstance() { RehabilitationVo voNewParent = new RehabilitationVo(); voNewParent.setAuthoringCP((Hcp) domain.getHcpUser()); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setRehabActivity(new RehabilitationActivityVoCollection()); populateParentInstanceControls(voNewParent); loadEquipment(); loadAdaptation(); loadTechnique(); form.getLocalContext().setSelectedParentInstance(voNewParent); form.getLocalContext().setParentInstance(voNewParent); //wdev-13599 }
private void populateParentInstanceControls(RehabilitationVo voParent) { if(voParent != null) { form.ctnDetail().dtimAuthoring().setValue(voParent.getAuthoringDateTime()); if (voParent.getAuthoringCPIsNotNull()) { form.ctnDetail().qmbAuthoringCP().newRow(voParent.getAuthoringCP(), voParent.getAuthoringCP().toString()); form.ctnDetail().qmbAuthoringCP().setValue(voParent.getAuthoringCP()); } else form.ctnDetail().qmbAuthoringCP().setValue(null); } }
/** * Get the current Rehab record for the Clinical Contact */ public ims.therapies.vo.RehabilitationVo getRehabVo(ims.core.vo.ClinicalContactShortVo voClinicalContactShort) { RehabilitationVoCollection voRehabColl = new RehabilitationVoCollection(); DomainFactory factory = getDomainFactory(); String hql = " from Rehabilitation rehab "; StringBuffer condStr = new StringBuffer(); String andStr = " "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if(voClinicalContactShort !=null) { condStr.append(andStr + " rehab.clinicalContact.id = :id_ClinicalContact"); markers.add("id_ClinicalContact"); values.add(voClinicalContactShort.getID_ClinicalContact()); andStr = " and "; } if (andStr.equals(" and ")) hql += " where "; hql += condStr.toString(); voRehabColl = RehabilitationVoAssembler.createRehabilitationVoCollectionFromRehabilitation(factory.find(hql, markers, values)); if(voRehabColl.size()>0) return voRehabColl.get(0); else return null; }
private void populateParentInstanceData(RehabilitationVo voRehab) { voRehab.setAuthoringCP(form.ctnDetail().qmbAuthoringCP().getValue()); voRehab.setAuthoringDateTime(form.ctnDetail().dtimAuthoring().getValue()); }