private void expandParentNode(gridDetailsRow selectedRow) { if (selectedRow.getValue() instanceof BobathShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((BobathShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; BobathVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); if(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.getBobathTreatment() != null) { selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getBobathTreatment()); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(BobathVo voBobath) { if (form.gridDetails().getValue() == null) return; if (voBobath.getBobathTreatment() == null) voBobath.setBobathTreatment(new BobathTreatmentVoCollection()); GenForm.gridDetailsRow parentRow = form.gridDetails().getValue() instanceof BobathVo || form.gridDetails().getValue() instanceof BobathShortVo ? form.gridDetails().getSelectedRow() : form.gridDetails().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voBobath.getBobathTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voBobath.getBobathTreatment().add((BobathTreatmentVo) parentRow.getRows().get(i).getValue()); } }
/** * save a Bobath record * @throws UniqueKeyViolationException */ public BobathVo saveBoBath(BobathVo voBobath) throws ims.domain.exceptions.StaleObjectException, UniqueKeyViolationException { if(!voBobath.isValidated()) throw new DomainRuntimeException("BoBath Value Object has not been validated"); if (voBobath.getID_Bobath() == null && getBoBath(voBobath.getClinicalContact()) != null) throw new UniqueKeyViolationException("The screen will be refreshed."); DomainFactory factory = getDomainFactory(); Bobath doBobath = BobathVoAssembler.extractBobath(factory,voBobath); factory.save(doBobath); return BobathVoAssembler.create(doBobath); }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.gridDetails().getValue() instanceof BobathShortVo) form.ctnDetail().lyrBoBath().showtabBoBath(); else if (form.gridDetails().getValue() instanceof BobathVo) form.ctnDetail().lyrBoBath().showtabBoBath(); else if (form.gridDetails().getValue() instanceof BobathTreatmentVo) form.ctnDetail().lyrBoBath().showtabAreaDetail(); enableParentControls(false); } else { if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_BobathIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnDetail().lyrBoBath().showtabBoBath(); else form.ctnDetail().lyrBoBath().showtabAreaDetail(); } }
private void populateParentInstanceControls(BobathVo voBobathParent) { if(voBobathParent != null) { form.ctnDetail().lyrBoBath().tabBoBath().dtimAuthoring().setValue(voBobathParent.getAuthoringDateTime()); if(voBobathParent.getAuthoringHCPIsNotNull()) form.ctnDetail().lyrBoBath().tabBoBath().qmbAuthoringCP().newRow(voBobathParent.getAuthoringHCP(), voBobathParent.getAuthoringHCP().toString()); form.ctnDetail().lyrBoBath().tabBoBath().qmbAuthoringCP().setValue(voBobathParent.getAuthoringHCP()); } }
private BobathVo getParentFromDomain(BobathShortVo voBoBathShort) { if( engine.isRIEMode()) return domain.getBoBathById(voBoBathShort); //wdev-13807 else return domain.getBoBath(voBoBathShort.getClinicalContact()); }
private boolean newParentNode(BobathVo voNewParent) { if (voNewParent == null) return true; BobathShortVo voParentShort = new BobathShortVo(); voParentShort.setAuthoringHCP(form.ctnDetail().lyrBoBath().tabBoBath().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnDetail().lyrBoBath().tabBoBath().dtimAuthoring().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); String[] errors = voParentShort.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } GenForm.gridDetailsRow parentRow = form.gridDetails().getRows().newRow(); parentRow.setColAreaTreated(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringHCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); form.getLocalContext().setUpdatingParentInstance(voParentShort); parentRow.setExpanded(true); form.gridDetails().setValue(voParentShort); return true; }
private void newParentInstance() { BobathVo voNewParent = new BobathVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); if(voHcp != null) voNewParent.setAuthoringHCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setBobathTreatment(new BobathTreatmentVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }
/** * get Bobath record for a clinical contact */ public BobathVo getBoBath(ims.core.vo.ClinicalContactShortVo voClinicalContact) { if(voClinicalContact == null) throw new CodingRuntimeException("Bobath Filter not provided for get call. "); String hql = new String("from Bobath b where b.clinicalContact.id = :CLINICAL_CONTACT_ID"); BobathVoCollection bobaths = BobathVoAssembler.createBobathVoCollectionFromBobath(getDomainFactory().find(hql, "CLINICAL_CONTACT_ID", voClinicalContact.getID_ClinicalContact())); if (bobaths.size() > 0) return bobaths.get(0); return null; }
public BobathVo getBoBathById(BobathRefVo recordID) { if( recordID == null) return null; Bobath doBobath = (Bobath)getDomainFactory().getDomainObject(Bobath.class, recordID.getID_Bobath()); return BobathVoAssembler.create(doBobath); }