try {
InitialContext ctx = new InitialContext();
Object oh = ctx.lookup("local/AdvancedSearch");
AdvancedSearchLocalHome cfh = (AdvancedSearchLocalHome) javax.rmi.PortableRemoteObject.narrow(oh,
com.centraview.advancedsearch.AdvancedSearchLocalHome.class);
AdvancedSearchLocal localAdvancedSearch = (AdvancedSearchLocal) cfh.create();
localAdvancedSearch.setDataSource(this.dataSource);
ReportLocalHome reportHome = EntityHomeFactory.getReportLocalHome();
ReportLocal reportLocal = reportHome.findByPrimaryKey(new ReportPK(reportId, this.dataSource));
resultVO.setReportId(reportLocal.getReportId());
resultVO.setModuleId(reportLocal.getModuleId());
resultVO.setName(reportLocal.getName());
resultVO.setSearchCriteria(getSearchCriteriaString(userId, reportId));
// get report dates
java.sql.Date fromDate = reportLocal.getDateFrom();
java.sql.Date toDate = reportLocal.getDateTo();
resultVO.setDateRange(fromDate, toDate);
String where = localAdvancedSearch.getWhereClauseForReport(userId, search, "");
ReportBuilder reportbuilder = null;
switch (reportId) {
case ReportBuilder.CONTACTS1_REPORT_ID: // Contacts1
case ReportBuilder.CONTACTS2_REPORT_ID: // Contacts2
{
reportbuilder = new Contacts1ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.HR1_REPORT_ID: // Hr1
{
reportbuilder = new Hr1ReportBuilder(fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.HR2_REPORT_ID: // Hr2
{
reportbuilder = new Hr2ReportBuilder(fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.HR3_REPORT_ID: // Hr3
case ReportBuilder.HR4_REPORT_ID: // Hr4
{
where = localAdvancedSearch.getWhereClauseForReport(userId, search, "tsl");
reportbuilder = new Hr3ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.ACTIVITIES1_REPORT_ID: // Activities1
case ReportBuilder.ACTIVITIES2_REPORT_ID: // Activities2
{
where = localAdvancedSearch.getWhereClauseForReport(userId, search, "act");
reportbuilder = new Activities1ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.SALES1_REPORT_ID: // Sales1
case ReportBuilder.SALES2_REPORT_ID: // Sales2
{
where = localAdvancedSearch.getWhereClauseForReport(userId, search, "op");
reportbuilder = new Sales1ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.SALES3_REPORT_ID: // Sales3
{
where = localAdvancedSearch.getWhereClauseForReport(userId, search, "pi");
reportbuilder = new Sales3ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.SALES4_REPORT_ID: // Sales4
{
// where =
// localAdvancedSearch.getWhereClauseByReportIdWithAlias(userId,
// reportId, reportLocal.getModuleId(),"cvord");
reportbuilder = new Sales4ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.PROJECTS1_REPORT_ID: // Project1
{
where = localAdvancedSearch.getWhereClauseForReport(userId, search, "task");
reportbuilder = new Project1ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.SUPPORT1_REPORT_ID: // Support1
case ReportBuilder.SUPPORT2_REPORT_ID: // Support2
case ReportBuilder.SUPPORT3_REPORT_ID: // Support3
{
where = localAdvancedSearch.getWhereClauseForReport(userId, search, "tick");
reportbuilder = new Support1ReportBuilder(reportId, fromDate, toDate, this.dataSource, where);
break;
}
case ReportBuilder.INDIVIDUAL_NOTE_ID: