private void showHeaderOrDetailsTab() { if (form.getMode().equals(FormMode.VIEW)) { // In view mode just show the selected node if (form.grdActivity().getValue() instanceof RemedialShortVo) form.ctnRemedial().lyrRemedial().showtabHeader(); else if(form.grdActivity().getValue() instanceof RemedialVo) form.ctnRemedial().lyrRemedial().showtabHeader(); else if (form.grdActivity().getValue() instanceof RemedialActivityVo) form.ctnRemedial().lyrRemedial().showtabDetails(); } else { if (form.getLocalContext().getUpdatingParent().equals(Boolean.TRUE)) form.ctnRemedial().lyrRemedial().showtabHeader(); else form.ctnRemedial().lyrRemedial().showtabDetails(); if (form.getLocalContext().getSelectedParentInstanceIsNotNull() && (form.getLocalContext().getSelectedParentInstance().getID_RemedialIsNotNull())) enableParentControls(false); //on update else enableParentControls(true); //new record } }
private boolean newParentNode(RemedialVo voNewParent) { if (voNewParent == null) return true; if(form.ctnRemedial().lyrRemedial().tabHeader().qmbAuthoringHCP().getValue()==null || form.ctnRemedial().lyrRemedial().tabHeader().dtimAuthoring().getValue()==null) { return false; } RemedialShortVo voParentShort = new RemedialShortVo(); voParentShort.setAuthoringCP(form.ctnRemedial().lyrRemedial().tabHeader().qmbAuthoringHCP().getValue()); voParentShort.setAuthoringDateTime(form.ctnRemedial().lyrRemedial().tabHeader().dtimAuthoring().getValue()); voParentShort.setClinicalContact(voNewParent.getClinicalContact()); GenForm.grdActivityRow parentRow = form.grdActivity().getRows().newRow(); parentRow.setColActivity(voParentShort.getAuthoringDateTime().toString()+ " - " + voParentShort.getAuthoringCP().toString()); parentRow.setValue(voParentShort); parentRow.setBackColor(Color.Beige); form.getLocalContext().setGoldenInstanceSelected(new Boolean(true)); parentRow.setExpanded(true); form.grdActivity().setValue(voParentShort); return true; }
private void populateChildCollectionFromGrid(RemedialVo voRemedial) { if (form.grdActivity().getValue() == null) return; if (voRemedial.getRemedialActivity() == null) voRemedial.setRemedialActivity(new RemedialActivityVoCollection()); GenForm.grdActivityRow parentRow = form.grdActivity().getValue() instanceof RemedialShortVo || form.grdActivity().getValue() instanceof RemedialVo ? form.grdActivity().getSelectedRow() : form.grdActivity().getSelectedRow().getParentRow(); if (parentRow.getRows().size() > 0 ) voRemedial.getRemedialActivity().clear(); for (int i=0; i < parentRow.getRows().size(); i++) { voRemedial.getRemedialActivity().add((RemedialActivityVo) parentRow.getRows().get(i).getValue()); } }
/** * Get the current Remedial record for the Clinical Contact */ public ims.therapies.vo.RemedialVo getRemedialVoByClinicalContact(ClinicalContactRefVo voClinicalContactRef) { //return RemedialVoAssembler.create(Remedial.getRemedialFromClinicalContact(getDomainFactory(), voClinicalContactRef.getID_ClinicalContact())); //WDEV-15078 if(voClinicalContactRef == null || voClinicalContactRef.getID_ClinicalContact()==null ) throw new CodingRuntimeException("Can not get RemedialVo value on null ClinicalContact."); StringBuffer hql = new StringBuffer(); hql.append("select remedial from Remedial as remedial "); hql.append("where remedial.clinicalContact.id = :clinicalId "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"clinicalId"}, new Object[] {voClinicalContactRef.getID_ClinicalContact()}); if (list!=null && list.size()>0) { return RemedialVoAssembler.createRemedialVoCollectionFromRemedial(list).get(0); } return null; }
private void getSelectedInstance() { if (form.getMode().equals(FormMode.EDIT)) { updateContextMenusState(); return; } //expand the selected parent if(form.grdActivity().getValue() instanceof RemedialVo) { populateParentInstanceControls((RemedialVo) form.grdActivity().getValue()); } else if(form.grdActivity().getValue() instanceof RemedialShortVo) { form.getLocalContext().setSelectedParentInstance(getParentFromDomain((RemedialShortVo)form.grdActivity().getValue())); populateParentInstanceControls(form.getLocalContext().getSelectedParentInstance()); populateChildNodes(form.grdActivity().getSelectedRow(),form.getLocalContext().getSelectedParentInstance().getRemedialActivity()); form.getLocalContext().setSelectedChildInstance(null); clearChildInstanceControls(); } else if(form.grdActivity().getValue() instanceof RemedialActivityVo) { GenForm.grdActivityRow parentRow = form.grdActivity().getSelectedRow().getParentRow(); populateParentInstanceControls((RemedialVo) parentRow.getValue()); form.getLocalContext().setSelectedParentInstance((RemedialVo) parentRow.getValue()); form.getLocalContext().setSelectedChildInstance((RemedialActivityVo) form.grdActivity().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 populateParentInstanceControls(RemedialVo voRemedialParent) { if(voRemedialParent != null) { form.ctnRemedial().lyrRemedial().tabHeader().dtimAuthoring().setValue(voRemedialParent.getAuthoringDateTime()); if(voRemedialParent.getAuthoringCPIsNotNull()) form.ctnRemedial().lyrRemedial().tabHeader().qmbAuthoringHCP().newRow(voRemedialParent.getAuthoringCP(), voRemedialParent.getAuthoringCP().toString()); form.ctnRemedial().lyrRemedial().tabHeader().qmbAuthoringHCP().setValue(voRemedialParent.getAuthoringCP()); form.ctnRemedial().lyrRemedial().tabHeader().cmbLocation().setValue(voRemedialParent.getRemedialLocation()); } }
private void expandParentNode(grdActivityRow selectedRow) { if (selectedRow.getValue() instanceof RemedialShortVo == false ) return; form.getLocalContext().setSelectedParentInstance(getParentFromDomain((RemedialShortVo) selectedRow.getValue())); if (form.getLocalContext().getSelectedParentInstance() == null ) return; //RemedialVo voParentInstance = form.getLocalContext().getSelectedParentInstance(); //WDEV-15078 RemedialVo voParentInstance = domain.getRemedial((RemedialShortVo)selectedRow.getValue()); 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.getRemedialActivity() != null) { selectedRow.setValue(voParentInstance); selectedRow.setExpanded(true); populateChildNodes(selectedRow, voParentInstance.getRemedialActivity()); } populateParentInstanceControls(voParentInstance); }
private void newParentInstance() { RemedialVo voNewParent = new RemedialVo(); Hcp voHcp = (Hcp) domain.getHcpUser(); if(voHcp != null) voNewParent.setAuthoringCP(voHcp); voNewParent.setAuthoringDateTime(new DateTime()); voNewParent.setClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact()); voNewParent.setRemedialActivity(new RemedialActivityVoCollection()); populateParentInstanceControls(voNewParent); form.getLocalContext().setSelectedParentInstance(voNewParent); }
public RemedialVo saveRemedialVo(RemedialVo voRemedial) throws StaleObjectException { // Ensure the value object has been validated if (!voRemedial.isValidated()) throw new DomainRuntimeException("Remedial has not been validated"); DomainFactory factory = getDomainFactory(); Remedial doRemedial = RemedialVoAssembler.extractRemedial(factory, voRemedial); factory.save(doRemedial); return RemedialVoAssembler.create(doRemedial); }
public RemedialVo getRemedial(RemedialRefVo remedialRef) { if (remedialRef==null || remedialRef.getID_Remedial()==null) { throw new CodingRuntimeException("Cannot get Remedial on null Id for Remedial "); } DomainFactory factory = getDomainFactory(); Remedial domainRemedial = (Remedial)factory.getDomainObject(Remedial.class, remedialRef.getID_Remedial()); return RemedialVoAssembler.create(domainRemedial); }