summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/main/java
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-05-24 13:47:57 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-24 13:47:57 +0000
commit05251c21933d0c1b448024a06b9593f152104c6d (patch)
tree28cb4dff494c93217d9b4c321b4b6e55271a93b3 /ecomp-sdk/epsdk-analytics/src/main/java
parentfe21b923536c4652cd422a41e10dcca5d9200632 (diff)
parent8372992aa8ab421edda05e145be66d5532d592c4 (diff)
Merge "Removed code smells in some components"
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/AntBuild.java3
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/config/ConfigLoader.java4
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Action.java1
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java172
4 files changed, 4 insertions, 176 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/AntBuild.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/AntBuild.java
index 3e106ab9..7f1c7433 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/AntBuild.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/AntBuild.java
@@ -65,9 +65,6 @@ public class AntBuild {
URL manifestUrl = new URL("jar:" + classContainer + "!/META-INF/MANIFEST.MF");
Manifest manifest = new Manifest(manifestUrl.openStream());
- //JarFile jar = new JarFile("../lib/raptor_classes.jar");
- //Manifest manifest = jar.getManifest();
-
Attributes attribs = manifest.getMainAttributes();
Iterator it = attribs.entrySet().iterator();
while(it.hasNext()) {
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/config/ConfigLoader.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/config/ConfigLoader.java
index a21400ca..de62b738 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/config/ConfigLoader.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/config/ConfigLoader.java
@@ -49,8 +49,6 @@ import org.onap.portalsdk.analytics.controller.ActionMapping;
import org.onap.portalsdk.analytics.util.Log;
public class ConfigLoader {
- // public static final String RAPTOR_ACTION_MAP =
- // "raptor_action_map.properties";
private static final String P_FILE_EXTENSION = ".properties";
@@ -189,8 +187,6 @@ public class ConfigLoader {
ActionMapping actionMapping = new ActionMapping();
String pLine = null;
- // BufferedReader pFile = new BufferedReader(new
- // InputStreamReader(servletContext.getResourceAsStream(internalFilesPath+RAPTOR_ACTION_MAP)));
BufferedReader pFile = new BufferedReader(new StringReader(raptorActionMapString));
while ((pLine = pFile.readLine()) != null)
if (pLine.trim().length() > 0)
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Action.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Action.java
index a3a5c60f..81ed950b 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Action.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Action.java
@@ -63,7 +63,6 @@ public class Action extends org.onap.portalsdk.analytics.RaptorObject {
Action a = new Action();
StringTokenizer st = new StringTokenizer(configFileEntry, "| \t", false);
- // if(st.hasMoreTokens())
a.setAction(st.nextToken());
a.setControllerClass(st.nextToken());
a.setControllerMethod(st.nextToken());
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
index 0846efda..1cc75b5e 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
@@ -488,11 +488,9 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REP_ID, reportID);
// get dashboard HTML from report runtime. getListOfReportsFromDashBoardHTML
String strHTML = rr.getDashboardLayoutHTML();
- //System.out.println("StrHTML " + strHTML);
// call getListOfReportsFromDashBoardHTML returns HashMap
TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML);
- //System.out.println("Size " + hashMap.size());
Set set = treeMap.entrySet();
String value = "";
@@ -566,30 +564,21 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
if(buildReportdata) {
reportDataMap.put(new Integer(entry.getKey().toString()), rd);
reportChartDataMap.put(new Integer(entry.getKey().toString()), ds);
- //reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));
}
}
- /*if(widthFlag ==1) request.getSession().setAttribute("extendedWidth", "Y");
- else request.getSession().removeAttribute("extendedWidth");
- if(heightFlag ==1) request.getSession().setAttribute("extendedHeight", "Y");
- else request.getSession().removeAttribute("extendedHeight");
- */
request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap));
request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request
if(buildReportdata) {
request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap));
request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP, new TreeMap(reportDataMap));
request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP, new TreeMap(reportChartDataMap));
- }
- //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1);
- //return nextPage;
+ }
} else {
// Ends
-// debugLogger.debug("Action Handler *****************" + new java.util.Date()+ " " + isGoBackAction);
ReportHandler rh = new ReportHandler();
//rr = null; // COMMENT THIS LINE
boolean resetParams = AppUtils.getRequestFlag(request,
@@ -608,42 +597,18 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
return nextPage;
}
-
- /*if (isGoBackAction) {
-// debugLogger.debug("Report back in action handler " + ((ReportRuntime) request.getSession().getAttribute(
-// AppConstants.SI_REPORT_RUN_BACKUP))!=null?((ReportRuntime) request.getSession().getAttribute(
-// AppConstants.SI_REPORT_RUN_BACKUP)).getReportID():((ReportRuntime) request.getSession().getAttribute(
-// AppConstants.SI_REPORT_RUN_BACKUP)));
- rr = null;
- rr = getReportRuntimeFromBackup(request);
- if (rr == null)
- throw new Exception("[ActionHandler.reportRun] Report backup not found");
- reportID = rr.getReportID();
- } else {*/
logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule "));
//TODO differentiate Schedule with other actions
-// if(isEmailAttachment) {
-//
-// } else {
-//
-// }
+
rr = rh.loadReportRuntime(request, reportID);
//setParamValues called for Drilldown to display formfield
- //rr.setParamValues(request, false,true);
//} // else
ArrayList aL = (ArrayList)request.getSession().getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
ReportRuntime aLR = null;
if(aL != null) {
-// for (int i = 1; i < aL.size(); i++) {
-// aLR = (ReportRuntime) aL.get(i);
-// if (!aLR.getReportID().equals(reportID)) {
-// request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y");
-// }
-// }
-// if(reportID.equals(reportIDFromSession)) {
aLR = (ReportRuntime) aL.get(0);
if (aLR!=null && !aLR.getReportID().equals(reportID)) {
request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y");
@@ -683,7 +648,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String limit = nvl(request.getParameter("download_limit"),"1000");
downloadLimit = Integer.parseInt(limit);
}
- //if (action.startsWith("mobile")) rr.setPageSize(5);
long reportTime = System.currentTimeMillis();
if (!rr.getReportType().equals(AppConstants.RT_HIVE))
rd = rr.loadReportData(pageNo, userId, downloadLimit,request,false /*download*/);
@@ -692,12 +656,9 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading report data --- " + (System.currentTimeMillis() - reportTime)));
ReportData rd_whole = null;
boolean hideReportMap = rr.isDisplayOptionHideMap()||AppUtils.getRequestNvlValue(request, "noMap").equals("Y");
-/* if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && rr.getReportMap()!=null){
- rd_whole = rr.loadReportData(-1, userId, downloadLimit,request);
- }
-*/
+
+
request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
- //if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && (rr.getReportMap()!=null && rr.getReportMap().getLatColumn()!=null && rr.getReportMap().getLongColumn()!=null)) {
if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
String sqlWhole = rr.getReportDataSQL(userId, downloadLimit, request);
request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sqlWhole);
@@ -742,7 +703,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_TEXT, formFields);
} else {
- //rr.logReportRun(userId, String.valueOf(totalTime),formFields);
if(rd!=null && !action.equals("report.run.container"))
rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
}
@@ -751,12 +711,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
rr.logReportExecutionTimeFromLogList(userId, String.valueOf(totalTime),formFields);
}
-/* if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) {
- reportID = (String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID);
- ReportRuntime rrDash = rh1.loadReportRuntime(request, reportID, true, 1);
- request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rrDash);
- }
-*/
if(rr.isDrillDownURLInPopupPresent()) {
request.getSession().setAttribute(PARENT+rr.getReportID()+"_rr", rr);
request.getSession().setAttribute(PARENT+rr.getReportID()+"_rd", rd);
@@ -798,8 +752,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
ReportJSONRuntime reportJSONRuntime = rr.createReportJSONRuntime(request, rd);
ObjectMapper mapper = new ObjectMapper();
- //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
- //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String jsonInString = "";
@@ -829,8 +781,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
errorJSONRuntime.setErrormessage(e.getMessage());
errorJSONRuntime.setStacktrace(getStackTrace(e));
ObjectMapper mapper = new ObjectMapper();
- //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
- //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String jsonInString = "";
@@ -853,8 +803,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
errorJSONRuntime.setErrormessage(ex.getMessage());
errorJSONRuntime.setStacktrace(getStackTrace(ex));
ObjectMapper mapper = new ObjectMapper();
- //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
- //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String jsonInString = "";
@@ -865,7 +813,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
return jsonInString;
}
- //nextPage = (new ErrorHandler()).processFatalError(request, e);
} catch (Exception t) {
logger.error(EELFLoggerDelegate.errorLogger,t.getMessage(), t);
@@ -879,8 +826,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
errorJSONRuntime.setErrormessage(t.toString());
errorJSONRuntime.setStacktrace(getStackTrace(t));
ObjectMapper mapper = new ObjectMapper();
- //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
- //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String jsonInString = "";
@@ -893,7 +838,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
return jsonInString;
}
- //return nextPage;
} // reportRun
public static String getStackTrace(Throwable aThrowable) {
@@ -1141,17 +1085,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
/****Remove Report Data from Session when Javascript throw error on onSubmit***/
public String removeReportDataFromSession (HttpServletRequest request, String nextPage) {
HttpSession session = request.getSession(false);
-/* if (session.getAttribute(AppConstants.RI_REPORT_DATA)!=null)
- request.getSession().removeAttribute(AppConstants.RI_REPORT_DATA);
- if (request.getAttribute(AppConstants.RI_REPORT_DATA)!=null)
- request.removeAttribute(AppConstants.RI_REPORT_DATA);
- if (session.getAttribute(AppConstants.RI_CHART_DATA)!=null)
- request.getSession().removeAttribute(AppConstants.RI_CHART_DATA);
- if (request.getAttribute(AppConstants.RI_CHART_DATA)!=null)
- request.removeAttribute(AppConstants.RI_CHART_DATA);
-*/ /*if (session.getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null)
- request.getSession().removeAttribute(AppConstants.SI_REPORT_RUNTIME);*/
- //request.setAttribute(AppConstants.RI_RESET_ACTION, "Y");
return nextPage;
} // processScheduleDelete
@@ -1216,10 +1149,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
AppConstants.SI_REPORT_DEFINITION);
WizardSequence ws = rdef.getWizardSequence();
- //debugLogger.debug("Step Count " + ws.getStepCount());
- //debugLogger.debug("Dashboard " + ((ws instanceof WizardSequenceDashboard) ? ws.getStepCount(): "Not a Dashboard"));
- //debugLogger.debug("GO TO STEP LENGTH " + goToStep.length());
- //debugLogger.debug("NumDash Cols in Action Handler " + AppUtils.getRequestNvlValue(request, "numDashCols"));
if (goToStep.length() > 0)
ws.performGoToStep(goToStep);
else
@@ -1236,7 +1165,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
} // reportWizard
public String refreshCache ( HttpServletRequest request, String nextPage ) {
- //DataCache.refreshReportTableSources();
removeVariablesFromSession(request);
DataCache.refreshAll();
Globals.getAppUtils().resetUserCache();
@@ -1249,8 +1177,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
ReportDefinition rdef = ReportDefinition.createBlank(request);
request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
- // request.setAttribute(AppConstants.RI_CUR_STEP,
- // AppConstants.WS_DEFINITION);
DataCache.refreshReportTableSources();
request.getSession().removeAttribute("remoteDB");
} catch (RaptorException e) {
@@ -1293,8 +1219,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
rdef.getWizardSequence().performGoToStep(AppConstants.WS_DEFINITION);
request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
- // request.setAttribute(AppConstants.RI_CUR_STEP,
- // AppConstants.WS_DEFINITION);
} catch (RaptorException e) {
nextPage = (new ErrorHandler()).processFatalError(request, e);
}
@@ -1325,12 +1249,10 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
ReportLoader.deleteReportRecord(reportID);
return "{\"deleted\":true}";
- //nextPage = reportSearchExecute(request, nextPage);
} catch (RaptorException e) {
nextPage = (new ErrorHandler()).processFatalError(request, e);
}
- //return nextPage;
return "{\"deleted\":false}";
} // reportDelete
@@ -1419,7 +1341,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
lookup.setOldSql(oldSQL);
}
- //lookup.loadData("0");
}
if(lookup instanceof IdNameSql) ((IdNameSql)lookup).setDataSizeUsedinPopup(-3); // -3 indicates to run the count sql for pagination.
}
@@ -1611,8 +1532,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
request.setAttribute("msg_align", " align=center");
request.setAttribute(AppConstants.RI_PAGE_TITLE, "Test Scheduler Condition");
- // request.setAttribute(AppConstants.RI_PAGE_SUBTITLE, ...);
- //String query = "SELECT 1 FROM DUAL WHERE EXISTS (" + sql + ")";
String query = Globals.getTestSchedCondPopup();
query = query.replace("[sql]", sql);
@@ -1622,13 +1541,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb
: rdef.getDBInfo();
ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix);
- // if ( (remoteDbPrefix!=null) &&
- // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) {
- // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix);
- // ds = RemDbUtils.executeQuery(query);
- // }
- // else
- // ds = DbUtils.executeQuery(query);
if (ds.getRowCount() == 0)
request
.setAttribute(AppConstants.RI_FORMATTED_SQL,
@@ -1638,7 +1550,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
.setAttribute(AppConstants.RI_FORMATTED_SQL,
"<br><b>Condition satisfied</b> - email notification will be send.<br><br>");
} catch (Exception e) {
- // nextPage = (new ErrorHandler()).processFatalError(request, e);
request.setAttribute(AppConstants.RI_FORMATTED_SQL, "<br><b>SQL ERROR</b> "
+ e.getMessage() + "<br>Email notification will NOT be send.<br><br>");
}
@@ -1669,13 +1580,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
FormFieldType fft = (FormFieldType) iter.next();
String fieldId = fft.getFieldId();
String fieldDisplay = rdef.getFormFieldDisplayName(fft);
- /*
- * if(paramValues.isParameterMultiValue(fieldId))
- * generatedSQL = Utils.replaceInString(generatedSQL,
- * fieldDisplay, nvl(formatListValue((String)
- * paramValues.get(fieldId), null, false, false, null),
- * "NULL")); else
- */
sql = Utils.replaceInString(sql, fieldDisplay, "NULL");
} // for
} // if
@@ -1699,25 +1603,13 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
if(session != null ) {
for (int i = 0; i < sessionParameters.length; i++) {
- //if(!sessionParameters[i].startsWith("ff"))
- //sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
- //else {
logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i])));
sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
- //}
}
}
logger.debug(EELFLoggerDelegate.debugLogger, ("After testRunSQL " + sql));
ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix, true);
- // if ( (remoteDbPrefix!=null) &&
- // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) {
- // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix);
- // ds = RemDbUtils.executeQuery(sql,
- // Globals.getDefaultPageSize()+1);
- // }
- // else
- // ds = DbUtils.executeQuery(sql, Globals.getDefaultPageSize()+1);
if (chkFormFieldSQL && ds.getRowCount() > 0) {
String id = ds.getString(0, "id");
String name = ds.getString(0, "name");
@@ -1783,12 +1675,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
if(isFromSchedule) {
String reportID = null;
String report_email_sent_log_id = AppUtils.getRequestValue(request, "log_id");
- /*String query = "Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG" +
- " where rownum = 1" +
- " and gen_key='"+pdfAttachmentKey.trim()+"'" +
- " and log_id ="+report_email_sent_log_id.trim() +
- " and (sysdate - sent_date) < 1 ";*/
-
String query = Globals.getDownloadAllEmailSent();
query = query.replace("[pdfAttachmentKey.trim()]", pdfAttachmentKey.trim());
query = query.replace("[report_email_sent_log_id.trim()]", report_email_sent_log_id.trim());
@@ -1813,7 +1699,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String d_sql = Globals.getDownloadAllGenKey();
d_sql = d_sql.replace("[pdfAttachmentKey]", pdfAttachmentKey);
- //ds = DbUtils.executeQuery("select schedule_id from cr_report_email_sent_log u where U.GEN_KEY = '"+ pdfAttachmentKey + "'");
ds = DbUtils.executeQuery(d_sql);
for (int i = 0; i < ds.getRowCount(); i++) {
@@ -1824,13 +1709,9 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String fileName = FilenameUtils.normalize(rr.getReportID()+"_"+userId+"_"+timestamp);
boolean flag = false;
logger.debug(EELFLoggerDelegate.debugLogger, (""+Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr)));
- // if(Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr)) {
- // flag = true;
- // }
if(flag){
String strFileName = Utils.getLatestDownloadableFile(rr.getReportID()+"_"+userId+"_"+dateStr);
- //debugLogger.debug("File Name " + strFileName);
StringBuffer messageBuffer = new StringBuffer("");
messageBuffer.append("Download data file using the following link<BR>");
messageBuffer.append("<a href=\"" + request.getContextPath() + "/raptor/dwnld/data/" +
@@ -1867,8 +1748,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
logger.debug(EELFLoggerDelegate.debugLogger, ("************************"));
logger.debug(EELFLoggerDelegate.debugLogger, (rr.parseReportSQL(rr.getWholeSQL())));
xmlOut.println(rr.parseReportSQL(rr.getWholeSQL()));
- //xmlOut.println("******************");
- //xmlOut.println(rr.getWholeSQL());
xmlOut.flush();
xmlOut.close();
} catch (IOException e) {logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);}
@@ -1885,7 +1764,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
logger.debug(EELFLoggerDelegate.debugLogger, ("Command " + command));
Process downloadProcess = runtime.exec(command.toString());
logger.debug(EELFLoggerDelegate.debugLogger, ("Command Executed "));
- //Connection connection = DbUtils.getConnection();
Enumeration enum1 = rr.getParamKeys();
String value = "";
String paramStr = "";
@@ -1902,26 +1780,9 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
StringBuffer retrieveUserEmailQry = null;
ArrayList userEmailList = new ArrayList();
if(nvl(scheduleId).length()>0) {
- /*retrieveUserEmailQry = new StringBuffer();
- retrieveUserEmailQry.append(" SELECT ");
- retrieveUserEmailQry.append(" au.user_id ");
- retrieveUserEmailQry.append(" FROM ");
- retrieveUserEmailQry.append(" (SELECT rs.schedule_id, rs.rep_id FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.run_date IS NOT NULL ");
- retrieveUserEmailQry.append(" AND rs.schedule_id = " + scheduleId + " ) x, cr_report r, app_user au ");
- retrieveUserEmailQry.append(" WHERE ");
- retrieveUserEmailQry.append("x.rep_id = r.rep_id ");
- retrieveUserEmailQry.append(" AND au.user_id IN (SELECT rsu.user_id FROM cr_report_schedule_users rsu WHERE rsu.schedule_id = x.schedule_id and rsu.schedule_id = " + scheduleId );
- retrieveUserEmailQry.append(" UNION ");
- retrieveUserEmailQry.append(" SELECT ur.user_id FROM fn_user_role ur ");
- retrieveUserEmailQry.append(" WHERE ur.role_id IN ");
- retrieveUserEmailQry.append(" (SELECT rsu2.role_id FROM cr_report_schedule_users rsu2 ");
- retrieveUserEmailQry.append(" WHERE rsu2.schedule_id = x.schedule_id and ");
- retrieveUserEmailQry.append(" rsu2.schedule_id = "+ scheduleId + ")) ");*/
String r_sql = Globals.getDownloadAllRetrieve();
r_sql = r_sql.replace("[scheduleId]", scheduleId);
-
- // DataSet ds = DbUtils.executeQuery(retrieveUserEmailQry.toString());
DataSet ds = DbUtils.executeQuery(r_sql);
for (int i = 0; i < ds.getRowCount(); i++) {
@@ -1929,7 +1790,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
}
- // String insertQry = "insert into cr_report_dwnld_log (user_id,rep_id,file_name,dwnld_start_time,filter_params) values (?,?,?,?,?)";
String insertQry = Globals.getDownloadAllInsert();
@@ -1962,30 +1822,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
} catch (Exception ex) {
throw new RaptorException (ex);
}
- //DbUtils.commitTransaction(connection);
- //DbUtils.clearConnection(connection);
-
-
-
-// debugLogger.debug("|"+downloadProcess.toString() + "|");
-// if (downloadProcess == null)
-// throw new Exception("unable to create a process for command:" +
-// command);
-// int retCode= 1;
-// try {
-// retCode= downloadProcess.waitFor();
-// } catch (InterruptedException e){
-// e.printStackTrace();
-// }
-// debugLogger.debug("retCode " + retCode);
-// Process child = rtime.exec("/bin/bash");
-// BufferedWriter outCommand = new BufferedWriter(new
-// OutputStreamWriter(child.getOutputStream()));
-// outCommand.write(Globals.getShellScriptName());
-// outCommand.flush();
-// int retCode = child.waitFor();
-// debugLogger.debug("RetCode " + retCode);
- //request.setAttribute(MESSAGE, "Shell Script is running in the background. You'll get an email once it is done");
}
return nextPage;