/** * getReport */ @SuppressWarnings("unchecked") public ims.admin.vo.ReportVo getReport(ims.core.admin.vo.TemplateBoRefVo templateRef) { if(templateRef == null || templateRef.getID_TemplateBo() == null) throw new CodingRuntimeException("The TemplateBoRefVo cannot be null !"); DomainFactory domainFactory = getDomainFactory(); List list = domainFactory.find("select r from ReportBo as r join r.templates as t where (t.id = :tid)", new String[] {"tid"}, new Object[] {templateRef.getID_TemplateBo()}, 1); if(list == null || list.size() == 0) return null; return ReportVoAssembler.create((ReportBo)list.get(0)); }
private ReportVo getReportByImsId(String imsId) { StringBuffer hql = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Integer> values = new ArrayList<Integer>(); hql.append("from ReportBo as report where report.ImsId =:imsId"); markers.add("imsId"); values.add(new Integer(imsId).intValue()); DomainFactory factory = getDomainFactory(); List list = factory.find(hql.toString(), markers, values); ReportVoCollection result = ReportVoAssembler.createReportVoCollectionFromReportBo(list); return result != null ? result.get(0) : null; }
/** * List reports assigned to a Form */ @SuppressWarnings("unchecked") public ims.admin.vo.ReportVoCollection listAssignedReports(Integer formId) { DomainFactory factory = getDomainFactory(); ims.admin.vo.ReportVoCollection collection = new ims.admin.vo.ReportVoCollection(); List reps = factory.find("from FormReportBo fr where fr.form.id = :formId and fr.report.isActive = :isActive", new String[]{"formId", "isActive"}, new Object[]{formId, Boolean.TRUE}); if (reps != null && !reps.isEmpty()) { for (Iterator iter = reps.iterator(); iter.hasNext();) { FormReportBo element = (FormReportBo) iter.next(); collection.add(ReportVoAssembler.create(element.getReport())); } } return collection; }
public ReportVoCollection listAssignedReports(Integer formId) { /* DomainFactory factory = getDomainFactory(); List reps = factory.find("from FormReportBo fr where fr.form.id = :formId", new String[]{"formId"}, new Object[]{formId}); return ReportVoAssembler.createReportVoCollectionFromReportBo(reps); */ DomainFactory factory = getDomainFactory(); ims.admin.vo.ReportVoCollection collection = new ims.admin.vo.ReportVoCollection(); List reps = factory.find("from FormReportBo fr where fr.form.id = :formId", new String[]{"formId"}, new Object[]{formId}); if (reps != null && !reps.isEmpty()) { for (Iterator iter = reps.iterator(); iter.hasNext();) { FormReportBo element = (FormReportBo) iter.next(); collection.add(ReportVoAssembler.create(element.getReport())); } } return collection; }
/** * List reports assigned to a Form */ @SuppressWarnings("unchecked") public ims.admin.vo.ReportVoCollection listAssignedReports(Integer formId) { DomainFactory factory = getDomainFactory(); ims.admin.vo.ReportVoCollection collection = new ims.admin.vo.ReportVoCollection(); List reps = factory.find("from FormReportBo fr where fr.form.id = :formId and fr.report.isActive = :isActive and fr.report.templates.isActive = 1", new String[]{"formId", "isActive"}, new Object[]{formId, Boolean.TRUE});//WDEV-23731 if (reps != null && !reps.isEmpty()) { for (Iterator iter = reps.iterator(); iter.hasNext();) { FormReportBo element = (FormReportBo) iter.next(); collection.add(ReportVoAssembler.create(element.getReport())); } } return collection; }
/** * listReports */ public ims.admin.vo.ReportVoCollection listReports() { DomainFactory factory = getDomainFactory(); List reps = factory.find("from ReportBo rep where rep.isActive = :active", new String[]{"active"}, new Object[]{Boolean.TRUE}); return ReportVoAssembler.createReportVoCollectionFromReportBo(reps).sort(); }
/** * List all reports in the system */ @SuppressWarnings("unchecked") public ims.admin.vo.ReportVoCollection listReports() { DomainFactory factory = getDomainFactory(); String hqlString = "from ReportBo rep where rep.isActive = :ACTIVE"; List reports = factory.find(hqlString, new String[] {"ACTIVE"}, new Object[] {Boolean.TRUE}); return ReportVoAssembler.createReportVoCollectionFromReportBo(reports); }
private ReportVo getReport(String reportId) { DomainFactory factory = getDomainFactory(); ReportBo boReport = (ReportBo) factory.getDomainObject(ReportBo.class, new Integer(reportId).intValue()); return ReportVoAssembler.create(boReport); }
@SuppressWarnings("unchecked") public ReportVoCollection searchReports(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 rep from ReportsCategory as cat right 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 :reportName"); //wdev-14251 markers.add("reportName"); values.add(reportName.toUpperCase()); //wdev-14251 andStr = " and "; cond.append(andStr + "upper(tpl.name) like :templateName"); //wdev-14251 markers.add("templateName"); values.add(templateName.toUpperCase()); //wdev-14251 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 ReportVoAssembler.createReportVoCollectionFromReportBo(list).sort(); }