private void populateChildCollectionFromGrid(MobilisationsVo voMobilisation) { if (form.grdTreatments().getValue() == null) return; if (voMobilisation.getMobilisationsTreatment() == null) voMobilisation.setMobilisationsTreatment(new MobilisationsTreatmentVoCollection()); GenForm.grdTreatmentsRow parentRow = form.grdTreatments().getValue() instanceof MobilisationsShortVo || form.grdTreatments().getValue() instanceof MobilisationsVo ? form.grdTreatments().getSelectedRow() : form.grdTreatments().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voMobilisation.getMobilisationsTreatment().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voMobilisation.getMobilisationsTreatment().add((MobilisationsTreatmentVo) parentRow.getRows().get(i).getValue()); } }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdTreatments().getValue() instanceof MobilisationsVo) form.ctnMob().lyrMob().showtabHeader(); else if (form.grdTreatments().getValue() instanceof MobilisationsShortVo) form.ctnMob().lyrMob().showtabHeader(); else if (form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo) form.ctnMob().lyrMob().showtabDetails(); else form.ctnMob().lyrMob().showtabEmpty(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnMob().lyrMob().showtabHeader(); else form.ctnMob().lyrMob().showtabDetails(); } }
private void newParentNode(MobilisationsVo voNewParent) { if (voNewParent == null) return; MobilisationsShortVo voParentShort = new MobilisationsShortVo(); voParentShort.setAuthoringCP(form.ctnMob().lyrMob().tabHeader().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnMob().lyrMob().tabHeader().dtimAuthoring().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdTreatmentsRow parentRow = form.grdTreatments().getRows().newRow(); if(voParentShort.getAuthoringCP() != null) parentRow.setColTreatment(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdTreatments().setValue(voParentShort); }
public MobilisationsVo getMobilisation(ClinicalContactShortVo voClinicalContact) { if (voClinicalContact == null) throw new RuntimeException("Cannot get Mobilisation record for null Clinical Contact"); StringBuffer query = new StringBuffer("from Mobilisations as m1_1 where m1_1.clinicalContact.id = :CCID order by m1_1.systemInformation.creationDateTime desc "); //wdev-13564 List list = getDomainFactory().find(query.toString(), "CCID", voClinicalContact.getID_ClinicalContact()); if (list == null || list.size() == 0) return null; //else if (list.size() > 1) // throw new RuntimeException("More than one Mobilisation found for the current Clinical Contact"); MobilisationsVoCollection voList = MobilisationsVoAssembler.createMobilisationsVoCollectionFromMobilisations(list); if (voList.size() > 0) return voList.get(0); return null; }
private void expandParentNode(grdTreatmentsRow parRow) { if (parRow.getValue() instanceof MobilisationsShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((MobilisationsShortVo)parRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; MobilisationsVo 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)); form.getLocalContext().setUpdatingParentInstance(voParentInstance); parRow.setBackColor(Color.Beige); } if (voParentInstance.getMobilisationsTreatment() != null) { parRow.setValue(voParentInstance); parRow.setExpanded(true); populateChildNodes(parRow, voParentInstance.getMobilisationsTreatment()); } populateParentInstanceControls(voParentInstance); }
private MobilisationsVo getParentFromDomain(MobilisationsShortVo voMobilisationsShort) { if(Boolean.TRUE.equals(engine.isRIEMode())) //wdev-13564 return domain.getMobilisationById(voMobilisationsShort); //wdev-13564 else return domain.getMobilisation(voMobilisationsShort.getClinicalContact()); }
private void populateParentInstanceControls(MobilisationsVo voMobilisationParent) { if(voMobilisationParent != null) { form.ctnMob().lyrMob().tabHeader().dtimAuthoring().setValue(voMobilisationParent.getAuthoringDateTime()); if(voMobilisationParent.getAuthoringCP() != null) form.ctnMob().lyrMob().tabHeader().qmbAuthoringCP().newRow(voMobilisationParent.getAuthoringCP(), voMobilisationParent.getAuthoringCP().toString()); form.ctnMob().lyrMob().tabHeader().qmbAuthoringCP().setValue(voMobilisationParent.getAuthoringCP()); } }
private void updateInstance() { form.getLocalContext().setUpdatingParent(new Boolean(form.grdTreatments().getValue() instanceof MobilisationsShortVo || form.grdTreatments().getValue() instanceof MobilisationsVo)); form.setMode(FormMode.EDIT); if (form.grdTreatments().getValue() instanceof MobilisationsTreatmentVo) { MobilisationsTreatmentVo voCachedChild = (MobilisationsTreatmentVo) form.grdTreatments().getValue(); if (voCachedChild.getID_MobilisationsTreatment() == null) { populateChildInstanceControls(voCachedChild); } } disableHeaderInfo(); }
private void newParentInstance() { MobilisationsVo voNewParent = new MobilisationsVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); voNewParent.setAuthoringCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setMobilisationsTreatment(new MobilisationsTreatmentVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); form.getLocalContext().setUpdatingParentInstance(voNewParent); enableParentControls(); }
public MobilisationsVo save(MobilisationsVo voMobilisations)throws StaleObjectException, UniqueKeyViolationException { if(!voMobilisations.isValidated()) throw new DomainRuntimeException("This Mobilisation has not been validated"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer("from Mobilisations as mb "); if(voMobilisations.getID_Mobilisations() == null) hql.append(" where (mb.clinicalContact.id = " + voMobilisations.getClinicalContact().getID_ClinicalContact() + ")"); else hql.append(" where (mb.clinicalContact.id = " + voMobilisations.getClinicalContact().getID_ClinicalContact() + ") and mb.id <> " + voMobilisations.getID_Mobilisations()); List list = (factory.find(hql.toString())); if(list.size() > 0) { MobilisationsVoCollection tempCol = MobilisationsVoAssembler.createMobilisationsVoCollectionFromMobilisations(list); //wdev-13513 if(tempCol != null && tempCol.size() > 0) //wdev-13513 throw new DomainRuntimeException("A record exists for this clinical contact, the screen will be refreshed"); } ims.therapies.treatment.domain.objects.Mobilisations domMobilisation = MobilisationsVoAssembler.extractMobilisations(factory, voMobilisations); factory.save(domMobilisation); return MobilisationsVoAssembler.create(domMobilisation); }
public MobilisationsVo getMobilisationById(MobilisationsRefVo record) { if(record == null || record.getID_Mobilisations() == null) return null; DomainFactory factory = getDomainFactory(); ims.therapies.treatment.domain.objects.Mobilisations doMobilisations = (ims.therapies.treatment.domain.objects.Mobilisations) factory.getDomainObject(ims.therapies.treatment.domain.objects.Mobilisations.class, record.getID_Mobilisations()); MobilisationsVo vo = MobilisationsVoAssembler.create(doMobilisations); return vo; }