summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java68
1 files changed, 26 insertions, 42 deletions
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 d6ae3e2d..7e76c46f 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
@@ -145,7 +145,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
private static final String REPORT_CSV_DOWNLOAD = "report.csv.download";
private static final String REPORT_DOWNLOAD_EXCEL2007 = "report.download.excel2007";
private static final String REPORT_DOWNLOAD = "report.download";
- private static final String REPORT_DOWNLOAD_PAGE = "report.download.page";
+ private static final String REPORT_DOWNLOAD_PAGE = ";report.download.page";
+ private static final String FALSE = "false";
private void preserveReportRuntimeAsBackup(HttpServletRequest request) {
HttpSession session = request.getSession();
@@ -923,7 +924,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
SearchHandler sh = new SearchHandler();
ReportSearchResultJSON sr = sh.loadReportSearchResult(request);
return sr.getJSONString();
- //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr);
} catch (RaptorException e) {
nextPage = (new ErrorHandler()).processFatalError(request, e);
}
@@ -940,20 +940,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
ChartWebRuntime cwr = new ChartWebRuntime();
return cwr.generateChart(request); //data
} // reportSearchExecute
-
-
- // public String reportRunExecute(HttpServletRequest request, String nextPage) {
-// try {
-// ReportRunHandler rh = new ReportRunHandler();
-// ReportRunResultJSON sr = rh.loadReportRunResult(request);
-// return sr.getJSONString();
-// //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr);
-// } catch (RaptorException e) {
-// nextPage = (new ErrorHandler()).processFatalError(request, e);
-// }
-//
-// return nextPage;
-// }
public String getQuickLinksJSON(HttpServletRequest request, String nextPage) {
String jsonInString = null;
@@ -985,22 +971,22 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^Check " + check + " Admin "+ isAdmin));
- if(check || isAdmin) {
- if(reportID.length()>0) {
- ReportHandler rh = new ReportHandler();
- ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
- request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
- ReportSchedule reportSchedule = null;
- if(rdef!=null) {
- reportSchedule = new ReportSchedule(reportID, AppUtils.getUserID(request), false, request);
- }
- request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
- }
- } else {
- //String message = "You have reached your schedule limit. Please visit this page again after removing your old schedules in \"My Schedule\" section.";
+ if(!(check || isAdmin)) {
String message = "You have reached the scheduled report limit for your Login ID. Please remove any old schedule requests in the \"My Scheduled Reports\" screen before attempting to schedule any additional reports.";
nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message));
+ return nextPage;
}
+
+ if(!reportID.isEmpty()) {
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ ReportSchedule reportSchedule = null;
+ if(rdef!=null) {
+ reportSchedule = new ReportSchedule(reportID, AppUtils.getUserID(request), false, request);
+ }
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ }
} catch(Exception ex) { logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);}
return nextPage;
@@ -1034,12 +1020,13 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
} catch (Exception ex) { logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);}
- if(reportSchedule == null) reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
+ if(reportSchedule == null)
+ reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
String formFields = "";
formFields = reportSchedule.getFormFields();
formFields = (formFields.length()>1)?formFields.substring(1):formFields;
- String formFieldsArr[] = formFields.split("&");
- String sessionParams[] = Globals.getSessionParamsForScheduling().split(",");
+ String[] formFieldsArr = formFields.split("&");
+ String[] sessionParams = Globals.getSessionParamsForScheduling().split(",");
for (int i=0; i<sessionParams.length; i++) {
for (int j = 0; j < formFieldsArr.length; j++) {
@@ -1056,15 +1043,13 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
try {
connection = DbUtils.startTransaction();
wp = new WizardProcessor();
- String toListUpdated = nvl(request.getParameter("toListUpdated"),"false" );
+ String toListUpdated = nvl(request.getParameter("toListUpdated"), FALSE);
reportUpdated = wp.processAdhocSchedule(request, action);
- if(reportUpdated && toListUpdated.equals("false")) {
+ if(reportUpdated && toListUpdated.equals(FALSE)) {
request.setAttribute("message", "Report has been scheduled successfully");
- reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
- //if(AppUtils.getRequestNvlValue(request, AppConstants.RI_SCHEDULE_ID).length()<=0) {
+ reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
reportSchedule.persistScheduleData(connection, request);
DbUtils.commitTransaction(connection);
- //}
}
} catch (ValidationException ve) {
(new ErrorHandler()).processError(request, ve);
@@ -1083,7 +1068,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
} catch (Exception e1) {logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), e1);}
}
request.setAttribute("schedule_only", "Y");
- //request.getSession().removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
return nextPage;
} else {
@@ -1101,8 +1085,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String formFields = "";
formFields = reportSchedule.getFormFields();
formFields = (formFields.length()>1)?formFields.substring(1):formFields;
- String formFieldsArr[] = formFields.split("&");
- String sessionParams[] = Globals.getSessionParamsForScheduling().split(",");
+ String[] formFieldsArr = formFields.split("&");
+ String[] sessionParams = Globals.getSessionParamsForScheduling().split(",");
for (int i=0; i<sessionParams.length; i++) {
for (int j = 0; j < formFieldsArr.length; j++) {
@@ -1152,7 +1136,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
ReportHandler rh = new ReportHandler();
ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
String myScheduleRepID = AppUtils.getRequestNvlValue(request, "myScheduleRepId");
- if (myScheduleRepID.equals(""))
+ if (myScheduleRepID.isEmpty())
myScheduleRepID = "2670";
ReportSchedule reportSchedule = null;
if(rdef!=null) {
@@ -2243,7 +2227,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
dv.setColName(dct.getColName());
dv.setColId(dct.getColId());
- dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+ dv.setNowrap(nvl(dct.getNowrap(),"null").equals(FALSE)?"null":nvl(dct.getNowrap(),"null"));
//Add Drilldown URL to dv
if (nvl(dct.getDrillDownURL()).length() > 0) {