diff options
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java index 0bdcc6fd..687b9c4d 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java @@ -130,11 +130,7 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { char[] buffer = new char[512]; Reader in = null; in = new InputStreamReader(clob.getAsciiStream()); - // if(obj instanceof oracle.sql.CLOB) { - // in = ((oracle.sql.CLOB) obj).getCharacterStream(); - // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) { - // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream(); - // } + while ((len = in.read(buffer)) != -1) sb.append(buffer, 0, len); in.close(); @@ -191,7 +187,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { rs.updateString("report_xml", reportXML); rs.updateRow(); connection.commit(); - // sb.append(rs.getString(1)); } else { throw new RaptorException( "Report " + reportID + NOT_FOUND_IN_DB); @@ -286,7 +281,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static boolean isReportsAlreadyScheduled(String reportID) throws RaptorException { - // String sql = "select rep_id from cr_report_schedule where rep_id = ?"; String sql = Globals.getIsReportAlreadyScheduled(); Connection connection = DbUtils.getConnection(); @@ -360,11 +354,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[userID]", userID); DataSet ds = DbUtils.executeQuery(sql); - // DataSet ds = DbUtils - // .executeQuery("SELECT cr.rep_id, cr.title FROM cr_report cr WHERE nvl(cr.owner_id, cr.create_id) - // = " - // + userID); - for (int i = 0; i < ds.getRowCount(); i++) reportIdNames.add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); } catch (Exception e) { @@ -458,9 +447,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) roleList.append("," + ((String) iter.next())); - // DataSet ds = DbUtils.executeQuery("SELECT cr.rep_id, cr.title FROM - // cr_report cr WHERE cr.public_yn = 'Y' AND cr.menu_id = - // '"+nvls(menuId)+"' AND cr.menu_approved_yn = 'Y' ORDER BY cr.title"); // Copied from SearchHandler and simplified /* * String query = "SELECT cr.rep_id, " + "cr.title, " + "cr.descr " + "FROM cr_report cr, " + @@ -590,10 +576,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[roleList.toString()]", roleList.toString()); sql = sql.replace("[folderId]", folderId); - // String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID; - // String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID - // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)"; - String user_sql = Globals.getLoadFolderReportsUser(); user_sql = user_sql.replace("[userID]", userID); String public_sql = Globals.getLoadFolderReportsPublicSql(); @@ -632,7 +614,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { */ ReportSearchResult rsr = new ReportSearchResult(-1, ds.getRowCount(), 6, 7); rsr.parseData(ds, request); - // rsr.truncateToPage(pageNo); return rsr; } // loadFolderReports @@ -687,9 +668,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[userID]", userID); sql = sql.replace("[roleList.toString()]", roleList.toString()); - // DataSet ds = DbUtils - // .executeQuery(query.toString()); - DataSet ds = DbUtils .executeQuery(sql); HashMap map = new HashMap(); @@ -725,9 +703,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[userID]", userID); sql = sql.replace("[roleList.toString()]", roleList.toString()); - // DataSet ds = DbUtils - // .executeQuery(query.toString()); - DataSet ds = DbUtils .executeQuery(sql); @@ -749,18 +724,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { * append(" and action = 'Report Execution Time' and a.rep_id = cr.rep_id order by log_time desc) x where rownum <= 6 ) y where rownum >= 1" * ); */ - // DataSet ds = DbUtils - // .executeQuery( - // " SELECT a.file_name, b.title,to_char(a.dwnld_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS') as time, - // "+ - // " a.dwnld_start_time " + - // " FROM cr_report_dwnld_log a, cr_report b where a.user_id = "+userID +" and "+ - // " a.rep_id = b.rep_id and (a.dwnld_start_time) >= to_date(to_char(sysdate-24/24, 'mm/dd/yyyy'), - // 'mm/dd/yyyy') " + - // " and a.record_ready_time is not null " + - // " order by a.dwnld_start_time desc"); - // DataSet ds = DbUtils - // .executeQuery(query.toString()); String sql = Globals.getLoadMyRecentLinks(); sql = sql.replace("[userID]", userID); @@ -784,10 +747,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { String userID, String action, String executionTime, String form_fields) throws RaptorException { if (form_fields.length() >= 4000) form_fields = ""; - // String stmt = "INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, - // form_fields) VALUES(" - // + reportID + ", SYSDATE, " + userID + ", '" + action + "' , '" + executionTime + "', '"+ - // form_fields +"')"; String stmt = Globals.getCreateReportLogEntry(); stmt = stmt.replace("[reportID]", reportID); @@ -864,11 +823,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { * + nvls(reportId)+ " and rl.action != 'Report Run' and fuser.user_id = rl.user_id" ); * query.append(" ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100"); */ - // DataSet ds = DbUtils - // .executeQuery("SELECT x.log_time, x.user_id, x.action FROM (SELECT TO_CHAR(rl.log_time, 'Month - // DD, YYYY HH:MI:SS AM') log_time, rl.user_id, rl.action FROM cr_report_log rl WHERE rl.rep_id = " - // + nvls(reportId) + " ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100"); - // DataSet ds = DbUtils.executeQuery(query.toString()); String sql = Globals.getLoadReportLogEntries(); sql = sql.replace("[AppUtils.getRaptorActionURL()]", AppUtils.getRaptorActionURL()); @@ -893,9 +847,7 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { String userId = AppUtils.getUserID(request); if (AppUtils.isAdminUser(request)) return true; - // String query = "select crs.sched_user_id, count(*) from cr_report_schedule crs where - // sched_user_id = " + userId + " group by crs.sched_user_id having count(*) >= " + - // Globals.getScheduleLimit(); + String query = Globals.getDoesUserCanScheduleReport(); query = query.replace("[userId]", userId); query = query.replace("[Globals.getScheduleLimit()]", String.valueOf(Globals.getScheduleLimit())); @@ -910,7 +862,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { logger.debug(EELFLoggerDelegate.debugLogger, ("scheduleId " + scheduleId)); if (scheduleId == null || scheduleId.trim().length() <= 0) return !flagLimit; - // query = "select crs.schedule_id from cr_report_schedule crs where schedule_id = " + scheduleId; query = Globals.getDoesUserCanSchedule(); query = query.replace("[scheduleId]", scheduleId); @@ -927,7 +878,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getSystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate,'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheSystemDateTime(); DataSet ds = DbUtils.executeQuery(query); @@ -940,7 +890,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getNextDaySystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate+1,'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheNextDayDateTime(); DataSet ds = DbUtils.executeQuery(query); String timeStr = ""; @@ -952,7 +901,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getNext15MinutesOfSystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate+15/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheNextFifteenMinDateTime(); DataSet ds = DbUtils.executeQuery(query); @@ -965,7 +913,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getNext30MinutesOfSystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate+30/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheNextThirtyMinDateTime(); DataSet ds = DbUtils.executeQuery(query); String timeStr = ""; @@ -997,7 +944,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { public static HashMap loadPDFImgLookUp() throws RaptorException { StringBuffer query = new StringBuffer(""); HashMap pdfImgMap = new HashMap(); - // query.append("select image_id, image_loc from cr_raptor_pdf_img"); query.append(Globals.getLoadPdfImgLookup()); DataSet ds = DbUtils.executeQuery(query.toString()); for (int i = 0; i < ds.getRowCount(); i++) { @@ -1009,7 +955,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { public static HashMap loadActionImgLookUp() throws RaptorException { StringBuffer query = new StringBuffer(""); HashMap pdfImgMap = new HashMap(); - // query.append("select image_id, image_loc from cr_raptor_action_img"); query.append(Globals.getLoadActionImgLookup()); DataSet ds = DbUtils.executeQuery(query.toString()); for (int i = 0; i < ds.getRowCount(); i++) { |