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 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))); }
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); }
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); }