public AdviceLeafletsVoCollection listAdviceLeaflets(CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from AdviceLeaflets t "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (refCareContext != null) { hql.append(andStr + " t.careContext.id = :cc"); markers.add("cc"); values.add(refCareContext.getID_CareContext()); andStr = " and "; } if (markers.size() > 0) query += " where "; query += hql.toString(); List adviceList = factory.find(query, markers, values); return AdviceLeafletsVoAssembler.createAdviceLeafletsVoCollectionFromAdviceLeaflets(adviceList); }
private void populateAdviceLeafletsGrid() { AdviceLeafletsVoCollection voColl = domain.listAdviceLeaflets(form.getGlobalContext().Core.getCurrentCareContext()); if(form.getLocalContext().getVoAdviceLeafletsIsNotNull()) form.getLocalContext().setVoAdviceLeaflets(domain.getAdviceLeaflets(form.getLocalContext().getVoAdviceLeaflets()));//WDEV-7044 if (voColl != null) { GenForm.grdLeafletsRow row = null; for(int i=0;i<voColl.size();i++) { row = form.grdLeaflets().getRows().newRow(); AdviceLeafletsVo voAdviceLeaflets = voColl.get(i); row.setValue(voAdviceLeaflets); if(voAdviceLeaflets.getAdviceLeaflet() != null) row.setcolAdvLeaflet(voAdviceLeaflets.getAdviceLeaflet().toString()); if(voAdviceLeaflets.getLeafletVersion() != null) row.setcolVersionNo(voAdviceLeaflets.getLeafletVersion().toString()); if(voAdviceLeaflets.getDateGiven() != null) row.setcolDateGiven(voAdviceLeaflets.getDateGiven().toString()); if(voAdviceLeaflets.getGivenTo() != null) row.setcolGivenTo(voAdviceLeaflets.getGivenTo().toString()); if(voAdviceLeaflets.equals(form.getLocalContext().getVoAdviceLeaflets())) //WDEV-7044 { form.grdLeaflets().setValue(voAdviceLeaflets); } } if(form.grdLeaflets().getValue() != null) refreshDetails(); } }