summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java101
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java26
2 files changed, 64 insertions, 63 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
index 75f18c06..517d2672 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
@@ -132,7 +132,6 @@ public class RaptorControllerAsync extends RestrictedBaseController {
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorControllerAsync.class);
private static final String INVALID_ACTION = "[Controller.processRequest]Invalid raptor action [";
private static final String UNABLE_INSTANTIATE = "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: ";
- private static final String FALSE = "false";
private String viewName;
@@ -198,7 +197,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
String sqlWhole = rr.getReportDataSQL(userId, downloadLimit, request);
request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sqlWhole);
}
- try(OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream())) {
+ try {
+ OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream());
if ("report.download.pdf.session".equals(actionKey)) {
new PdfReportHandler().createPdfFileContent(request, response, 3);
@@ -261,27 +261,27 @@ public class RaptorControllerAsync extends RestrictedBaseController {
} catch (ClassNotFoundException e) {
logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
- + actionKey + "]. ClassNotFoundException: "), e);
+ + actionKey + "]. ClassNotFoundException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (IllegalAccessException e) {
logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
- + actionKey + "]. IllegalAccessException: "), e);
+ + actionKey + "]. IllegalAccessException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (InstantiationException e) {
logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
- + actionKey + "]. InstantiationException: "), e);
+ + actionKey + "]. InstantiationException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (NoSuchMethodException e) {
logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
- + actionKey + "]. NoSuchMethodException: "), e);
+ + actionKey + "]. NoSuchMethodException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (InvocationTargetException e) {
logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
- + actionKey + "]. InvocationTargetException: "), e);
+ + actionKey + "]. InvocationTargetException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} finally {
@@ -590,7 +590,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
fft.setPredefinedValueList(predefinedValueList);
List<IdNameBooleanJSON> predefList = formEditJSON.getPredefinedValueList();
- if (predefList != null && !predefList.isEmpty()) {
+ if (predefList != null && predefList.size() > 0) {
for (IdNameBooleanJSON item : predefList) {
fft.getPredefinedValueList().getPredefinedValue().add(item.getId());
}
@@ -631,7 +631,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
wizardJSON.setTabId("FormEdit");
wizardJSON.setTabName("Form Edit");
String fieldId ="";
- if(rdef.getFormFieldList()==null || rdef.getFormFieldList().getFormField()==null || rdef.getFormFieldList().getFormField().isEmpty())
+ if(rdef.getFormFieldList()==null || rdef.getFormFieldList().getFormField()==null || rdef.getFormFieldList().getFormField().size()==0)
fieldId = "ff1";
else
fieldId = "ff"+(rdef.getFormFieldList().getFormField().size()+1);
@@ -893,9 +893,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
if (id.equals("Create")) {
rdef.persistReport(request);
- } else {
+ } else
persistReportDefinition(request, rdef);
- }
messageJSON.setMessage("Success Definition of given report is saved in session.");
messageJSON.setAnyStacktrace((newReport ? " New Report info is added to Session "
: rdef.getReportID() + "- is Modified and added to session and DB."));
@@ -1168,16 +1167,16 @@ public class RaptorControllerAsync extends RestrictedBaseController {
public @ResponseBody Map<String,String> addSelectedReportUser(
@RequestBody String userIdToAdd, HttpServletRequest request, HttpServletResponse response)
{
- Map<String, String> jsonResponse = new HashMap<>();
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
- jsonResponse.put("status","success");
- jsonResponse.put("userId",userIdToAdd);
+ JsonResponse.put("status","success");
+ JsonResponse.put("userId",userIdToAdd);
String action = "Add User";
rdef.getReportSecurity().addUserAccess(userIdToAdd, "Y");
WizardSequence ws = rdef.getWizardSequence();
ws.performAction(action,rdef);
- return jsonResponse;
+ return JsonResponse;
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
@@ -1189,17 +1188,17 @@ public class RaptorControllerAsync extends RestrictedBaseController {
public @ResponseBody Map<String,String> removeSelectedReportUser(
@RequestBody String userIdToRemove, HttpServletRequest request, HttpServletResponse response)
{
- Map<String, String> jsonResponse = new HashMap<>();
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
- jsonResponse.put("status","success");
- jsonResponse.put("userId",userIdToRemove);
+ JsonResponse.put("status","success");
+ JsonResponse.put("userId",userIdToRemove);
String action = "Delete User";
rdef.getReportSecurity().removeUserAccess(userIdToRemove);
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
WizardSequence ws = rdef.getWizardSequence();
ws.performAction(action,rdef);
- return jsonResponse;
+ return JsonResponse;
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
@@ -1210,16 +1209,16 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/security/addReportRole", method = RequestMethod.POST)
public @ResponseBody Map<String,String> addSelectedReportRole(
@RequestBody String roleIdToAdd, HttpServletRequest request, HttpServletResponse response) {
- Map<String, String> jsonResponse = new HashMap<>();
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
- jsonResponse.put("status","success");
- jsonResponse.put("roleId",roleIdToAdd);
+ JsonResponse.put("status","success");
+ JsonResponse.put("roleId",roleIdToAdd);
String action = "Add Role";
rdef.getReportSecurity().addRoleAccess(roleIdToAdd, "Y");
WizardSequence ws = rdef.getWizardSequence();
ws.performAction(action,rdef);
- return jsonResponse;
+ return JsonResponse;
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
@@ -1231,16 +1230,16 @@ public class RaptorControllerAsync extends RestrictedBaseController {
public @ResponseBody Map<String,String> removeSelectedReportRole(
@RequestBody String roleIdToRemove, HttpServletRequest request, HttpServletResponse response)
{
- Map<String, String> jsonResponse = new HashMap<>();
+ Map<String, String> JsonResponse = new HashMap<String, String>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
- jsonResponse.put("status","success");
- jsonResponse.put("roleId",roleIdToRemove);
+ JsonResponse.put("status","success");
+ JsonResponse.put("roleId",roleIdToRemove);
String action = "Delete Role";
rdef.getReportSecurity().removeRoleAccess(roleIdToRemove);
WizardSequence ws = rdef.getWizardSequence();
ws.performAction(action,rdef);
- return jsonResponse;
+ return JsonResponse;
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
@@ -1253,17 +1252,17 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestBody Map<String,String> securityInfo, HttpServletRequest request, HttpServletResponse response)
{
- Map<String, String> jsonResponse = new HashMap<>();
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
- jsonResponse.put("status","success");
- String ownerUserId = securityInfo.get("userId");
+ JsonResponse.put("status","success");
+ String OwnerUserId = securityInfo.get("userId");
String isPublic = securityInfo.get("isPublic");
boolean rPublic = isPublic.equals("true");
- rdef.getReportSecurity().setOwnerID(ownerUserId);
+ rdef.getReportSecurity().setOwnerID(OwnerUserId);
rdef.setPublic(rPublic);
persistReportDefinition(request, rdef);
- return jsonResponse;
+ return JsonResponse;
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
@@ -1277,11 +1276,11 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@PathVariable("userID") String userId,
@RequestBody String readOnly, HttpServletRequest request, HttpServletResponse response)
{
- Map<String, String> jsonResponse = new HashMap<>();
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
String action ="";
- jsonResponse.put("status","success");
+ JsonResponse.put("status","success");
if (readOnly.equals("N")) {
action = "Grant User Access";
} else {
@@ -1291,7 +1290,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
WizardSequence ws = rdef.getWizardSequence();
ws.performAction(action,rdef);
- return jsonResponse;
+ return JsonResponse;
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
@@ -1304,11 +1303,11 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@PathVariable("roleID") String roleId,
@RequestBody String readOnly, HttpServletRequest request, HttpServletResponse response)
{
- Map<String, String> jsonResponse = new HashMap<>();
+ Map<String, String> JsonResponse = new HashMap<String, String>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
String action ="";
- jsonResponse.put("status","success");
+ JsonResponse.put("status","success");
if (readOnly.equals("N")) {
action = "Grant Role Access";
} else {
@@ -1318,7 +1317,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
WizardSequence ws = rdef.getWizardSequence();
ws.performAction(action,rdef);
- return jsonResponse;
+ return JsonResponse;
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
@@ -1331,7 +1330,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
throws RaptorException {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
- List<IdNameValue> userList = new ArrayList<>();
+ List<IdNameValue> UserList = new ArrayList<>();
List excludeValues = new java.util.ArrayList();
HttpSession session = request.getSession();
String query = Globals.getCustomizedScheduleQueryForUsers();
@@ -1359,9 +1358,9 @@ public class RaptorControllerAsync extends RestrictedBaseController {
} // if
if (!exclude)
- userList.add(value);
+ UserList.add(value);
} // for
- return userList;
+ return UserList;
}
@@ -1394,8 +1393,10 @@ public class RaptorControllerAsync extends RestrictedBaseController {
List<SecurityEntry> reportUserMapList = new ArrayList<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
Vector reportUsers = rdef.getReportUsers(request);
-
- for(Iterator iter=reportUsers.iterator(); iter.hasNext();) {
+ int iCount = 0;
+
+ for(Iterator iter=reportUsers.iterator(); iter.hasNext(); iCount++) {
+ Map<String, String> reportUserMap = new HashMap<String,String>();
SecurityEntry rUser = (SecurityEntry) iter.next();
reportUserMapList.add(rUser);
}
@@ -1559,13 +1560,13 @@ public class RaptorControllerAsync extends RestrictedBaseController {
wizardJSON.setDbInfoList(dbInfoList);
/*Robert add*/
- wizardJSON.setOneTimeRec((rdef != null) ? rdef.getIsOneTimeScheduleAllowed() : FALSE);
- wizardJSON.setHourlyRec((rdef != null) ? rdef.getIsHourlyScheduleAllowed() : FALSE);
- wizardJSON.setDailyRec((rdef != null) ? rdef.getIsDailyScheduleAllowed() : FALSE);
- wizardJSON.setDailyMFRec((rdef != null) ? rdef.getIsDailyMFScheduleAllowed() : FALSE);
- wizardJSON.setWeeklyRec((rdef != null) ? rdef.getIsWeeklyScheduleAllowed() : FALSE);
- wizardJSON.setMonthlyRec((rdef != null) ? rdef.getIsMonthlyScheduleAllowed() : FALSE);
- wizardJSON.setSizedByContent((rdef != null) ? rdef.getSizedByContentOption() : FALSE);
+ wizardJSON.setOneTimeRec((rdef != null) ? rdef.getIsOneTimeScheduleAllowed() : "false");
+ wizardJSON.setHourlyRec((rdef != null) ? rdef.getIsHourlyScheduleAllowed() : "false");
+ wizardJSON.setDailyRec((rdef != null) ? rdef.getIsDailyScheduleAllowed() : "false");
+ wizardJSON.setDailyMFRec((rdef != null) ? rdef.getIsDailyMFScheduleAllowed() : "false");
+ wizardJSON.setWeeklyRec((rdef != null) ? rdef.getIsWeeklyScheduleAllowed() : "false");
+ wizardJSON.setMonthlyRec((rdef != null) ? rdef.getIsMonthlyScheduleAllowed() : "false");
+ wizardJSON.setSizedByContent((rdef != null) ? rdef.getSizedByContentOption() : "false");
wizardJSON.setRepDefType(rdef.getReportDefType());
} else if(wizardJSON.getReportType().equals(AppConstants.RT_DASHBOARD)){
wizardJSON.setDashboardLayoutHTML((rdef != null) ? rdef.getCustomReport().getDashboardLayoutHTML() : null);
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java
index 86f2d912..04e237ae 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/util/Scheduler.java
@@ -59,7 +59,7 @@ public class Scheduler extends TimerTask {
public void start() {
if (timeInterval > 0)
- timer.schedule(this, 0, timeInterval * 1000L);
+ timer.schedule(this, 0, timeInterval * 1000);
}
public void stop() {
@@ -92,18 +92,18 @@ public class Scheduler extends TimerTask {
sendNotifications.send_notification(AppUtils.getSMTPServer(), AppUtils.getSMTPServer(), Globals.getSystemName() ,
AppUtils.getDirectAccessURL(), timeInterval);
- } catch (Exception e) {
- Log.write("[SYSTEM ERROR Scheduler.run] Exception: " + e.getMessage());
- } finally {
- try {
- if (sendNotifications != null) {
- sendNotifications.deInit();
- }
- } catch (SQLException e) {
- Log.write("[SYSTEM ERROR Scheduler.run] Could not close connection: "
- + e.getMessage());
- }
- }
+ } catch (Exception e) {
+ Log.write("[SYSTEM ERROR Scheduler.run] Exception: " + e.getMessage());
+ //e.printStackTrace();
+ }
+ finally {
+
+ try {
+ sendNotifications.deInit();
+ } catch (SQLException e) {
+ Log.write("[SYSTEM ERROR Scheduler.run] Could not close connection: " + e.getMessage());
+ }
+ }
} // run
} // Scheduler