private void expandParentNode(grdThermalRow selectedRow) { if (selectedRow.getValue() instanceof ThermalShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ThermalShortVo)selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; ThermalVo 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.getThermalActivity() != null) { selectedRow.setValue(voParentInstance); selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getThermalActivity()); } populateParentInstanceControls(voParentInstance); }
private void populateChildCollectionFromGrid(ThermalVo voThermal) { if (form.grdThermal().getValue() == null) return; if (voThermal.getThermalActivity() == null) voThermal.setThermalActivity(new ThermalActivityVoCollection()); GenForm.grdThermalRow parentRow = form.grdThermal().getValue() instanceof ThermalShortVo || form.grdThermal().getValue() instanceof ThermalVo ? form.grdThermal().getSelectedRow() : form.grdThermal().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voThermal.getThermalActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voThermal.getThermalActivity().add((ThermalActivityVo) parentRow.getRows().get(i).getValue()); } }
public ims.therapies.vo.ThermalVo saveThermalDetails(ims.therapies.vo.ThermalVo voThermal) throws StaleObjectException, UniqueKeyViolationException { if(voThermal == null) throw new DomainRuntimeException("Cannot save null Thermal record"); // Ensure the value object has been validated if (!voThermal.isValidated()) throw new DomainRuntimeException("Thermal Record has not been validated"); /* WDEV-13649if(voThermal.getID_Thermal() == null) { List list = Thermal.listThermalByClinicalContact(getDomainFactory(), (ims.core.admin.domain.objects.ClinicalContact) getDomainFactory().getDomainObject(voThermal.getClinicalContact())); if (list != null && list.size() > 0) throw new StaleObjectException((Thermal)list.get(0)); }*/ DomainFactory factory = getDomainFactory(); Thermal domThermal = ThermalVoAssembler.extractThermal(factory, voThermal); factory.save(domThermal); return ThermalVoAssembler.create(domThermal); }
private void getSelectedInstance() { // In update mode we can select nodes without displaying anything but the context // menus can change based on what's selected so we need to update them if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } if(form.grdThermal().getValue() instanceof ThermalVo) { populateParentInstanceControls((ThermalVo) form.grdThermal().getValue()); } if(form.grdThermal().getValue() instanceof ThermalShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((ThermalShortVo) form.grdThermal().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdThermal().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getThermalActivity()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdThermal().getValue() instanceof ThermalActivityVo) { GenForm.grdThermalRow parentRow = form.grdThermal().getSelectedRow().getParentRow(); populateParentInstanceControls((ThermalVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((ThermalVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((ThermalActivityVo) form.grdThermal().getValue()); populateChildInstanceControls(form.getLocalContext().getSelectedChildInstance()); } if(form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()) form.getLocalContext().setGoldenInstanceSelected(new Boolean(form.getLocalContext().getSelectedParentInstance().getClinicalContact().getID_ClinicalContact().equals(form.getGlobalContext().Core.getCurrentClinicalContact().getID_ClinicalContact()))); updateControlsState(); }
private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdThermal().getValue() instanceof ThermalShortVo) form.ctnTherapy().lyrThermal().showtabHeader(); else if(form.grdThermal().getValue() instanceof ThermalVo) form.ctnTherapy().lyrThermal().showtabHeader(); else if (form.grdThermal().getValue() instanceof ThermalActivityVo) form.ctnTherapy().lyrThermal().showtabDetails(); //enableParentControls(false); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnTherapy().lyrThermal().showtabHeader(); else form.ctnTherapy().lyrThermal().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_ThermalIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record } }
private void populateParentInstanceControls(ThermalVo voThermalParent) { if(voThermalParent != null) { form.ctnTherapy().lyrThermal().tabHeader().dtimAuthoring().setValue(voThermalParent.getAuthoringDateTime()); if(voThermalParent.getAuthoringCPIsNotNull()) form.ctnTherapy().lyrThermal().tabHeader().qmbAuthoringCP().newRow(voThermalParent.getAuthoringCP(), voThermalParent.getAuthoringCP().toString()); form.ctnTherapy().lyrThermal().tabHeader().qmbAuthoringCP().setValue(voThermalParent.getAuthoringCP()); } }
private boolean newParentNode(ThermalVo voNewParent) { if (voNewParent == null) return true; ThermalShortVo voParentShort = new ThermalShortVo(); voParentShort.setAuthoringCP(form.ctnTherapy().lyrThermal().tabHeader().qmbAuthoringCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnTherapy().lyrThermal().tabHeader().dtimAuthoring().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); String[] errors = voParentShort.validate(); if(errors != null && errors.length > 0) { engine.showErrors(errors); return false; } GenForm.grdThermalRow parentRow = form.grdThermal().getRows().newRow(); parentRow.setcolThermalTypeParent(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdThermal().setValue(voParentShort); return true; }
private void newParentInstance() { ThermalVo voNewParent = new ThermalVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); if(voHcp != null) voNewParent.setAuthoringCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setThermalActivity(new ThermalActivityVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }
public ThermalVo getThermalDetailsByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { if (voClinicalContactRef == null) throw new RuntimeException("Cannot get ThermalVo for null ClinicalContactRefVo"); List list = Thermal.listThermalByClinicalContact(getDomainFactory(), (ims.core.admin.domain.objects.ClinicalContact) getDomainFactory().getDomainObject(voClinicalContactRef)); if (list == null || list.size() == 0) return null; // WDEV-13649else if (list.size() > 1) // WDEV-13649 throw new CodingRuntimeException("More than one Thermal found for the current Clinical Contact"); return ThermalVoAssembler.createThermalVoCollectionFromThermal(list).get(0); }
public ThermalVo getThermal(ThermalRefVo thermal) { if(thermal == null || thermal.getID_Thermal() == null) throw new CodingRuntimeException("Can not get Thermal on null Id."); return ThermalVoAssembler.create((Thermal) getDomainFactory().getDomainObject(Thermal.class, thermal.getID_Thermal())); }