private void populateInstanceControls(AdviceLeafletsForPresentingProblemConfigVo adviceLeaflet) { form.grdProblems().getRows().clear(); if (adviceLeaflet == null) { form.lblTemplateName().setValue(form.getLocalContext().getselectedTemplate().getName()); form.chkTemplateAvailable().setValue(null); return; } form.lblTemplateName().setValue(adviceLeaflet.getTemplate().getName()); form.chkTemplateAvailable().setValue(adviceLeaflet.getIsGenericAdviceLeaflet()); populateProblemsGrid(adviceLeaflet.getProblems()); }
public AdviceLeafletsForPresentingProblemConfigVo getAdviceLeafletByTemplate(TemplateBoRefVo templateRef) { if (templateRef == null || templateRef.getID_TemplateBo() == null) { throw new CodingRuntimeException("Cannot get AdviceLeafletsForPresentingProblemConfigVo on null Id for Template "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select advice from AdviceLeafletsConfig as advice where advice.template.id = :templID "); List<?> list = factory.find(hql.toString(), new String[] { "templID" }, new Object[] { templateRef.getID_TemplateBo() }); AdviceLeafletsForPresentingProblemConfigVoCollection listAdvice = AdviceLeafletsForPresentingProblemConfigVoAssembler.createAdviceLeafletsForPresentingProblemConfigVoCollectionFromAdviceLeafletsConfig(list); if (listAdvice!=null && listAdvice.size()>0) { return listAdvice.get(0); } return null; }
public Boolean isStale(AdviceLeafletsForPresentingProblemConfigVo adviceLeafletToSave) { if (adviceLeafletToSave == null || adviceLeafletToSave.getID_AdviceLeafletsConfig() == null) { throw new CodingRuntimeException("Cannot get AdviceLeafletsForPresentingProblemConfigVo on null Id "); } DomainFactory factory = getDomainFactory(); AdviceLeafletsConfig domainAdviceLeaflet = (AdviceLeafletsConfig) factory.getDomainObject(AdviceLeafletsConfig.class, adviceLeafletToSave.getID_AdviceLeafletsConfig()); if (domainAdviceLeaflet == null) { return true; } if (domainAdviceLeaflet.getVersion() > adviceLeafletToSave.getVersion_AdviceLeafletsConfig()) { return true; } return false; }
private void populateInstanceControls(AdviceLeafletsForPresentingProblemConfigVo adviceLeaflet) { form.grdProblems().getRows().clear(); if (adviceLeaflet == null) { form.lblTemplateName().setValue(form.getLocalContext().getselectedTemplate().getName()); form.chkTemplateAvailable().setValue(null); return; } form.lblTemplateName().setValue(adviceLeaflet.getTemplate()!=null ? adviceLeaflet.getTemplate().getName() : null);//WDEV-20437 form.chkTemplateAvailable().setValue(adviceLeaflet.getIsGenericAdviceLeaflet()); form.txtPrePrintedAdviceLeaflet().setValue(adviceLeaflet.getAdviceLeafletName());//WDEV-20437 populateProblemsGrid(adviceLeaflet.getProblems()); }
public AdviceLeafletsForPresentingProblemConfigVo getAdviceLeafletByName(String advLeafletName) { if (advLeafletName == null || advLeafletName.length()==0) { throw new CodingRuntimeException("Cannot get AdviceLeafletsForPresentingProblemConfigVo on null Name "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select advice from AdviceLeafletsConfig as advice where advice.adviceLeafletName= :advLeafletName "); List<?> list = factory.find(hql.toString(), new String[] { "advLeafletName" }, new Object[] { advLeafletName }); if (list==null || list.size()==0) { return null; } return AdviceLeafletsForPresentingProblemConfigVoAssembler.create((AdviceLeafletsConfig)(list.get(0))); }
private boolean save() { AdviceLeafletsForPresentingProblemConfigVo adviceLeafletToSave = populateDataFromScreen(form.getLocalContext().getcurrentAdviceLeaflet()); String[] errors = adviceLeafletToSave.validate(); if (errors != null && errors.length > 0) { engine.showErrors(errors); return false; } // Check SOE if (adviceLeafletToSave.getID_AdviceLeafletsConfigIsNotNull() && domain.isStale(adviceLeafletToSave)) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); // form.getLocalContext().setselectedClinicianNote(null); open(); return false; } try { form.getLocalContext().setcurrentAdviceLeaflet(domain.save(adviceLeafletToSave)); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } return true; }
public AdviceLeafletsForPresentingProblemConfigVo save(AdviceLeafletsForPresentingProblemConfigVo adviceLeafletToSave) throws StaleObjectException { if (adviceLeafletToSave == null) throw new CodingRuntimeException("Cannot save null AdviceLeafletsForPresentingProblemConfigVo "); if (!adviceLeafletToSave.isValidated()) throw new DomainRuntimeException("AdviceLeafletsForPresentingProblemConfigVo Not Validated."); DomainFactory factory = getDomainFactory(); AdviceLeafletsConfig domainAdviceLeaflet = AdviceLeafletsForPresentingProblemConfigVoAssembler.extractAdviceLeafletsConfig(factory, adviceLeafletToSave); factory.save(domainAdviceLeaflet); return AdviceLeafletsForPresentingProblemConfigVoAssembler.create(domainAdviceLeaflet); }
public AdviceLeafletsForPresentingProblemConfigVo getAdviceLeaflet(AdviceLeafletsConfigRefVo adviceLeaflet) { if (adviceLeaflet == null || adviceLeaflet.getID_AdviceLeafletsConfig() == null) { throw new CodingRuntimeException("Cannot get AdviceLeafletsForPresentingProblemConfigVo on null Id "); } DomainFactory factory = getDomainFactory(); AdviceLeafletsConfig domainAdviceLeaflet = (AdviceLeafletsConfig) factory.getDomainObject(AdviceLeafletsConfig.class, adviceLeaflet.getID_AdviceLeafletsConfig()); return AdviceLeafletsForPresentingProblemConfigVoAssembler.create(domainAdviceLeaflet); }
private boolean save() { AdviceLeafletsForPresentingProblemConfigVo adviceLeafletToSave = populateDataFromScreen(form.getLocalContext().getcurrentAdviceLeaflet()); String[] errors = adviceLeafletToSave.validate(getUIErrors(adviceLeafletToSave.getID_AdviceLeafletsConfig()==null)); //WDEV-20437 if (errors != null && errors.length > 0) { engine.showErrors(errors); return false; } // Check SOE if (adviceLeafletToSave.getID_AdviceLeafletsConfig()==null && (adviceLeafletToSave.getTemplate()!=null && domain.getAdviceLeafletByTemplate(adviceLeafletToSave.getTemplate())!=null)) //WDEV-20437 { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } try { form.getLocalContext().setcurrentAdviceLeaflet(domain.save(adviceLeafletToSave)); } catch (StaleObjectException e) { engine.showMessage(ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); open(); return false; } return true; }
private void addRowPrePrintedAdvLeaflets(AdviceLeafletsForPresentingProblemConfigVo advLeaflet) { if (advLeaflet==null) return; grdPrePrintedAdviceLeafletSearchRow row = form.grdPrePrintedAdviceLeafletSearch().getRows().newRow(); row.setcolPrePrintedAdviceLeaflet(advLeaflet.getAdviceLeafletName()); row.setTooltipForcolPrePrintedAdviceLeaflet(advLeaflet.getAdviceLeafletName()); row.setValue(advLeaflet); }