@SuppressWarnings("unchecked") public ReportsCategoryListVoCollection listCategories() { StringBuffer hql = new StringBuffer(); hql.append("from ReportsCategory as r1_1"); hql.append(" where r1_1.isRIE is null"); DomainFactory factory = getDomainFactory(); List list = factory.find(hql.toString()); return ReportsCategoryListVoAssembler.createReportsCategoryListVoCollectionFromReportsCategory(list).sort(); }
/** * list the categories */ @SuppressWarnings("unchecked") public ims.admin.vo.ReportsCategoryListVoCollection searchCategories(String reportName, String templateName, ReportsCategoryRefVo categoryRef) { StringBuffer hql = new StringBuffer(); StringBuffer cond = new StringBuffer(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append("select distinct cat from ReportsCategory as cat left join cat.reports as rep left join rep.templates as tpl "); cond.append(andStr + "rep.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); andStr = " and "; cond.append(andStr + "UPPER(rep.reportName) like UPPER(:reportName)"); markers.add("reportName"); values.add(reportName); andStr = " and "; cond.append(andStr + "tpl.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); andStr = " and "; cond.append(andStr + "UPPER(tpl.name) like UPPER(:templateName)"); markers.add("templateName"); values.add(templateName); andStr = " and "; if(categoryRef != null && categoryRef.getID_ReportsCategoryIsNotNull()) { cond.append(andStr + "cat.id = :catId"); markers.add("catId"); values.add(categoryRef.getID_ReportsCategory()); andStr = " and "; } if (andStr.equals(" and ")) { hql.append(" where "); } hql.append(cond.toString()); DomainFactory factory = getDomainFactory(); List list = factory.find(hql.toString(), markers, values); return ReportsCategoryListVoAssembler.createReportsCategoryListVoCollectionFromReportsCategory(list).sort(); }
@SuppressWarnings("unchecked") public ReportsCategoryListVoCollection searchCategories(String reportName, String templateName, ReportsCategoryRefVo categoryRef) { StringBuffer hql = new StringBuffer(); StringBuffer cond = new StringBuffer(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; hql.append("select distinct cat from ReportsCategory as cat left join cat.reports as rep left join rep.templates as tpl "); cond.append(andStr + "rep.isActive = :isActive"); markers.add("isActive"); values.add(Boolean.TRUE); andStr = " and "; cond.append(andStr + "rep.reportName like :reportName"); markers.add("reportName"); values.add(reportName); andStr = " and "; cond.append(andStr + "tpl.name like :templateName"); markers.add("templateName"); values.add(templateName); andStr = " and "; if(categoryRef != null && categoryRef.getID_ReportsCategoryIsNotNull()) { cond.append(andStr + "cat.id = :catId"); markers.add("catId"); values.add(categoryRef.getID_ReportsCategory()); andStr = " and "; } if (andStr.equals(" and ")) { hql.append(" where "); } hql.append(cond.toString()); DomainFactory factory = getDomainFactory(); List list = factory.find(hql.toString(), markers, values); return ReportsCategoryListVoAssembler.createReportsCategoryListVoCollectionFromReportsCategory(list).sort(); }