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; }
private void doSearchPrePrintedLeaflets() { AdviceLeafletsForPresentingProblemConfigVoCollection collPrePrintedAdviceleaflets = domain.listPrePrintedAdviceLeaflet(form.txtPrePrintedAdviceLeafletSearch().getValue()); if (collPrePrintedAdviceleaflets==null || collPrePrintedAdviceleaflets.size()==0) engine.showMessage("No Pre-Printed Advice Leaflets found."); populatePrePrintedAdvLeaflets(collPrePrintedAdviceleaflets); }
private void populatePrePrintedAdvLeaflets(AdviceLeafletsForPresentingProblemConfigVoCollection collPrePrintedAdviceleaflets) { form.grdPrePrintedAdviceLeafletSearch().getRows().clear(); if (collPrePrintedAdviceleaflets==null || collPrePrintedAdviceleaflets.size()==0) return; for (int i=0;i<collPrePrintedAdviceleaflets.size();i++) { addRowPrePrintedAdvLeaflets(collPrePrintedAdviceleaflets.get(i)); } form.grdPrePrintedAdviceLeafletSearch().setValue(form.getLocalContext().getcurrentAdviceLeaflet()); }
public AdviceLeafletsForPresentingProblemConfigVoCollection listPrePrintedAdviceLeaflet(String prePrintedAdviceLeafletName) { StringBuffer hql = new StringBuffer(); StringBuffer hqlConditions = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String andStr = " "; hql.append("select advLeaflet from AdviceLeafletsConfig as advLeaflet "); hqlConditions.append(andStr + " advLeaflet.template is null "); andStr = " and "; if (prePrintedAdviceLeafletName !=null) { hqlConditions.append(andStr + " UPPER(advLeaflet.adviceLeafletName) like UPPER(:advLeafletName) "); markers.add("advLeafletName"); values.add("%" + prePrintedAdviceLeafletName + "%"); //WDEV-20825 andStr = " and "; } if (hqlConditions.length() > 0) { hqlConditions.insert(0, " where ("); hqlConditions.append(" ) "); } hql.append(hqlConditions.toString() + " order by UPPER(advLeaflet.adviceLeafletName)"); DomainFactory factory = getDomainFactory(); List <?>list = factory.find(hql.toString(), markers, values); return AdviceLeafletsForPresentingProblemConfigVoAssembler.createAdviceLeafletsForPresentingProblemConfigVoCollectionFromAdviceLeafletsConfig(list); }