summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java257
1 files changed, 113 insertions, 144 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 9e11affe..84649e06 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
@@ -129,6 +129,8 @@ import com.fasterxml.jackson.databind.SerializationFeature;
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 String viewName;
@@ -143,9 +145,9 @@ public class RaptorControllerAsync extends RestrictedBaseController {
HttpSession session = request.getSession();
User user = UserUtils.getUserSession(request);
- if (actionKey.equals("report.download.excel2007.session") || actionKey.equals("report.download.csv.session")
- || actionKey.equals("report.download.excel.session")
- || actionKey.equals("report.download.pdf.session")) {
+ if ("report.download.excel2007.session".equals(actionKey) || "report.download.csv.session".equals(actionKey)
+ || "report.download.excel.session".equals(actionKey)
+ || "report.download.pdf.session".equals(actionKey)) {
if (session != null && user != null) {
ServletContext servletContext = request.getSession().getServletContext();
if (!Globals.isSystemInitialized()) {
@@ -155,7 +157,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
ReportData rd = null;
String parent = "";
int parentFlag = 0;
- if (!nvl(request.getParameter("parent"), "").equals("N"))
+ if (!"N".equals(nvl(request.getParameter("parent"), "")))
parent = nvl(request.getParameter("parent"), "");
if (parent.startsWith("parent_"))
parentFlag = 1;
@@ -183,33 +185,35 @@ public class RaptorControllerAsync extends RestrictedBaseController {
if (rd == null)
rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
}
- String user_id = AppUtils.getUserID(request);
+ String userId = AppUtils.getUserID(request);
int downloadLimit = 0;
if (rr != null)
downloadLimit = (rr.getMaxRowsInExcelDownload() > 0) ? rr.getMaxRowsInExcelDownload()
: Globals.getDownloadLimit();
- if (actionKey.equals("report.csv.download"))
+ if ("report.csv.download".equals(actionKey))
downloadLimit = Globals.getCSVDownloadLimit();
- String sql_whole = rr.getReportDataSQL(user_id, downloadLimit, request);
- request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole);
+ if(rr != null) {
+ String sqlWhole = rr.getReportDataSQL(userId, downloadLimit, request);
+ request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sqlWhole);
+ }
try {
OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream());
- if (actionKey.equals("report.download.pdf.session")) {
+ if ("report.download.pdf.session".equals(actionKey)) {
new PdfReportHandler().createPdfFileContent(request, response, 3);
- } else if (actionKey.equals("report.download.csv.session")) {
+ } else if ("report.download.csv.session".equals(actionKey)) {
(new ReportHandler()).createCSVFileContent(out, rd, rr, request, response);
- } else if (actionKey.equals("report.download.excel.session")) {
- new ReportHandler().createExcelFileContent(out, rd, rr, request, response, user_id, 3); // 3
+ } else if ("report.download.excel.session".equals(actionKey)) {
+ new ReportHandler().createExcelFileContent(out, rd, rr, request, response, userId, 3); // 3
// whole
} else {
- new ReportHandler().createExcel2007FileContent(out, rd, rr, request, response, user_id, 3); // 3
+ new ReportHandler().createExcel2007FileContent(out, rd, rr, request, response, userId, 3); // 3
// whole
}
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger,
- "[Controller.processRequest]Invalid raptor action [" + actionKey + "].", e);
+ INVALID_ACTION + actionKey + "].", e);
}
} else {
response.sendRedirect("login.htm");
@@ -227,10 +231,10 @@ public class RaptorControllerAsync extends RestrictedBaseController {
throw new RaptorRuntimeException("Action not found");
} catch (RaptorException e) {
logger.error(EELFLoggerDelegate.errorLogger,
- "[Controller.processRequest]Invalid raptor action [" + actionKey + "].", e);
+ INVALID_ACTION + actionKey + "].", e);
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
- new RaptorRuntimeException("[Controller.processRequest]Invalid raptor action [" + actionKey
+ new RaptorRuntimeException(INVALID_ACTION + actionKey
+ "]. Exception: " + e.getMessage()));
}
@@ -249,46 +253,36 @@ public class RaptorControllerAsync extends RestrictedBaseController {
;
viewName = (String) handlerMethod.invoke(handler, paramValues);
- if (!actionKey.equals("chart.run"))
+ if (!"chart.run".equals(actionKey))
response.setContentType("application/json");
else
response.setContentType("text/html");
} catch (ClassNotFoundException e) {
- logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action ["
+ logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
+ actionKey + "]. ClassNotFoundException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
- new RaptorRuntimeException(
- "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
- + e.getMessage()));
+ new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (IllegalAccessException e) {
- logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action ["
+ logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
+ actionKey + "]. IllegalAccessException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
- new RaptorRuntimeException(
- "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
- + e.getMessage()));
+ new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (InstantiationException e) {
- logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action ["
+ logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
+ actionKey + "]. InstantiationException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
- new RaptorRuntimeException(
- "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
- + e.getMessage()));
+ new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (NoSuchMethodException e) {
- logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action ["
+ logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
+ actionKey + "]. NoSuchMethodException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
- new RaptorRuntimeException(
- "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
- + e.getMessage()));
+ new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} catch (InvocationTargetException e) {
- logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action ["
+ logger.debug(EELFLoggerDelegate.debugLogger, (INVALID_ACTION
+ actionKey + "]. InvocationTargetException: " + e.getMessage()));
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
- new RaptorRuntimeException(
- "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
- + e.getMessage()));
+ new RaptorRuntimeException(UNABLE_INSTANTIATE + e.getMessage()));
} finally {
PrintWriter out = response.getWriter();
out.write(viewName);
@@ -303,7 +297,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/drill_down_param/{parameter}", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody List<DrillDownParamDef> getDrillDownParamDef (@PathVariable("parameter") String parameter, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
+ {
List<DrillDownParamDef> list = new ArrayList<>();
String[] tmepArray = null;
if(parameter!=null){
@@ -317,11 +311,11 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/list_columns", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody ArrayList<ColumnJSON> listColumns(HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
+ {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
List<DataColumnType> reportColumnList = rdef.getAllColumns();
- ArrayList<ColumnJSON> listJSON = new ArrayList<ColumnJSON>();
- ColumnJSON columnJSON = new ColumnJSON();
+ ArrayList<ColumnJSON> listJSON = new ArrayList<>();
+ ColumnJSON columnJSON;
for (DataColumnType reportColumnType : reportColumnList) {
columnJSON = new ColumnJSON();
@@ -334,7 +328,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/list_drilldown_reports", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody ArrayList<ColumnJSON> list_drilldown_reports(HttpServletRequest request,
- HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletResponse response) throws RaptorException {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
Vector<IdNameValue> publicReportIdNames = DataCache.getPublicReportIdNames();
Vector groupReportIdNames = DataCache.getGroupAccessibleReportIdNames(AppUtils.getUserID(request),
@@ -342,8 +336,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
Vector privateReportIdNames = DataCache.getPrivateAccessibleReportIdNames(AppUtils.getUserID(request),
AppUtils.getUserRoles(request));
- ArrayList<ColumnJSON> listJSON = new ArrayList<ColumnJSON>();
- ColumnJSON columnJSON = new ColumnJSON();
+ ArrayList<ColumnJSON> listJSON = new ArrayList<>();
+ ColumnJSON columnJSON;
ServletContext servletContext = request.getSession().getServletContext();
if (!Globals.isSystemInitialized()) {
@@ -351,7 +345,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
for (int i = 0; i < publicReportIdNames.size(); i++) {
- IdNameValue reportIdName = (IdNameValue) publicReportIdNames.get(i);
+ IdNameValue reportIdName = publicReportIdNames.get(i);
columnJSON = new ColumnJSON();
columnJSON.setId(reportIdName.getId());
columnJSON.setName("Public Report: " + reportIdName.getName());
@@ -382,10 +376,10 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/list_formfields", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody ArrayList<SearchFieldJSON> listFormFields(HttpServletRequest request,
- HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletResponse response) {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
- ArrayList<SearchFieldJSON> listJSON = new ArrayList<SearchFieldJSON>();
- SearchFieldJSON fieldJSON = new SearchFieldJSON();
+ ArrayList<SearchFieldJSON> listJSON = new ArrayList<>();
+ SearchFieldJSON fieldJSON;
if (rdef.getFormFieldList() != null) {
for (Iterator iter = rdef.getFormFieldList().getFormField().iterator(); iter.hasNext();) {
fieldJSON = new SearchFieldJSON();
@@ -404,12 +398,12 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/list_child_report_col/{reportID}", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody ArrayList<ColumnJSON> listChildReportCols(@PathVariable("reportID") String reportID,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletRequest request, HttpServletResponse response) throws RaptorException {
ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, reportID, false);
List<DataColumnType> reportColumnList = ddRr.getAllColumns();
- ArrayList<ColumnJSON> listJSON = new ArrayList<ColumnJSON>();
- ColumnJSON columnJSON = new ColumnJSON();
+ ArrayList<ColumnJSON> listJSON = new ArrayList<>();
+ ColumnJSON columnJSON;
for (DataColumnType reportColumnType : reportColumnList) {
columnJSON = new ColumnJSON();
@@ -422,10 +416,10 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/list_child_report_ff/{reportID}", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody ArrayList<SearchFieldJSON> listChildReportFormFields(@PathVariable("reportID") String reportID,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletRequest request, HttpServletResponse response) throws RaptorException {
ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, reportID, false);
- ArrayList<SearchFieldJSON> listJSON = new ArrayList<SearchFieldJSON>();
- SearchFieldJSON fieldJSON = new SearchFieldJSON();
+ ArrayList<SearchFieldJSON> listJSON = new ArrayList<>();
+ SearchFieldJSON fieldJSON;
ReportFormFields ddReportFormFields = ddRr.getReportFormFields();
if (ddReportFormFields != null) {
@@ -444,7 +438,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "report/wizard/copy_report/{reportID}", method = RequestMethod.GET, produces = "application/json")
public @ResponseBody MessageJSON copyReport(@PathVariable("reportID") String reportID, HttpServletRequest request,
- HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletResponse response){
MessageJSON messageJSON = new MessageJSON();
try {
@@ -471,7 +465,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "report/wizard/import_report", method = RequestMethod.POST, consumes = "application/json")
public @ResponseBody MessageJSON importReport(@RequestBody ImportJSON importJSON, HttpServletRequest request,
- HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletResponse response) {
MessageJSON messageJSON = new MessageJSON();
try {
String reportXML = importJSON.getReportXML();
@@ -502,7 +496,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "report/wizard/save_formfield_tab_data", method = RequestMethod.POST)
public @ResponseBody MessageJSON saveFFTabWiseData(@RequestBody FormEditJSON formEditJSON,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletRequest request, HttpServletResponse response) {
ReportDefinition rdef = null;
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
@@ -559,8 +553,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "report/wizard/add_formfield_tab_data", method = RequestMethod.POST)
public @ResponseBody MessageJSON addFFTabWiseData(@RequestBody FormEditJSON formEditJSON,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
- ReportDefinition rdef = null;
+ HttpServletRequest request, HttpServletResponse response) {
+ ReportDefinition rdef;
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
MessageJSON messageJSON = new MessageJSON();
@@ -605,8 +599,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "report/wizard/save_col_tab_data", method = RequestMethod.POST)
public @ResponseBody MessageJSON saveColTabWiseData(@RequestBody ColumnEditJSON columnEditJSON,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
- ReportDefinition rdef = null;
+ HttpServletRequest request, HttpServletResponse response) {
+ ReportDefinition rdef;
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
MessageJSON messageJSON = new MessageJSON();
@@ -617,7 +611,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
List<DataColumnType> reportColumnList = rdef.getAllColumns();
for (DataColumnType reportColumnType : reportColumnList) {
- // columnJSON = new ColumnJSON();
+
if (reportColumnType.getColId().equals(colId)) {
reportColumnType.setColName(columnEditJSON.getColName());
reportColumnType.setDependsOnFormField(columnEditJSON.getDepeondsOnForField()==null?"":columnEditJSON.getDepeondsOnForField());
@@ -667,10 +661,10 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "report/wizard/save_def_tab_data/{id}", method = RequestMethod.POST)
public @ResponseBody MessageJSON saveDefTabWiseData(@PathVariable("id") String id,
@RequestBody DefinitionJSON definitionJSON, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
- ReportDefinition rdef = null;
- ReportRuntime rr = null;
- boolean newReport = false;
+ {
+ ReportDefinition rdef;
+ ReportRuntime rr;
+ boolean newReport;
MessageJSON messageJSON = new MessageJSON();
try {
String copyReportEvent = (String)request.getSession().getAttribute("COPY_REPORT_EVENT");
@@ -732,9 +726,6 @@ public class RaptorControllerAsync extends RestrictedBaseController {
catch (Exception e) {}
rdef.setDBType(dbType);
String reportName = definitionJSON.getReportName();
- String errorString = "";
- if (AppUtils.nvl(reportName).length() <= 0)
- errorString = "ReportName cannot be null;";
rdef.setReportName(reportName);
String reportDescr = definitionJSON.getReportDescr();
@@ -848,8 +839,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/retrieve_form_tab_wise_data/{id}",
"/report/wizard/retrieve_form_tab_wise_data/{id}/{action}" }, method = RequestMethod.GET)
public @ResponseBody FormEditJSON retrieveFormTabWiseData(@PathVariable Map<String, String> pathVariables,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
- ReportDefinition rdef = null;
+ HttpServletRequest request, HttpServletResponse response) {
+ ReportDefinition rdef;
String id = "";
String action = "";
String detailId = "";
@@ -906,8 +897,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
PredefinedValueList preDefined = fft.getPredefinedValueList();
if (preDefined != null) {
- List<IdNameBooleanJSON> preDefinedList = new ArrayList<IdNameBooleanJSON>();
- IdNameBooleanJSON idNameBooleanJSON = new IdNameBooleanJSON();
+ List<IdNameBooleanJSON> preDefinedList = new ArrayList<>();
+ IdNameBooleanJSON idNameBooleanJSON;
for (String v : preDefined.getPredefinedValue()) {
idNameBooleanJSON = new IdNameBooleanJSON();
@@ -936,8 +927,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/retrieve_col_tab_wise_data/{id}" }, method = RequestMethod.GET)
public @ResponseBody ColumnEditJSON retrieveColTabWiseData(@PathVariable Map<String, String> pathVariables,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
- ReportDefinition rdef = null;
+ HttpServletRequest request, HttpServletResponse response) {
+ ReportDefinition rdef;
String id = "";
ColumnEditJSON wizardJSON = new ColumnEditJSON();
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
@@ -996,19 +987,15 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/retrieve_sql_tab_wise_data/{id}",
"/report/wizard/retrieve_sql_tab_wise_data/" }, method = RequestMethod.GET)
public @ResponseBody QueryJSON retrieveSqlTabWiseData(@PathVariable Map<String, String> pathVariables,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
+ HttpServletRequest request, HttpServletResponse response) throws RaptorException {
ReportDefinition rdef = null;
- ReportRuntime rr = null;
+ ReportRuntime rr;
String id = "";
- String detailId = "";
QueryJSON wizardJSON = new QueryJSON();
if (pathVariables.containsKey("id")) {
id = pathVariables.get("id");
}
- if (pathVariables.containsKey("detailId")) {
- detailId = pathVariables.get("detailId");
- }
ServletContext servletContext = request.getSession().getServletContext();
if (!Globals.isSystemInitialized()) {
Globals.initializeSystem(servletContext);
@@ -1043,7 +1030,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/retrieveTotalForTheColList" }, method = RequestMethod.GET)
public @ResponseBody List<IdNameValue> getTotalForTheCol(HttpServletRequest request)
- throws IOException, RaptorException {
+ {
IdNameList idNameList = AppConstants.TOTAL_FUNCTIONS;
List<IdNameValue> list = new ArrayList<>();
for(int i=0; i<idNameList.getCount(); i++)
@@ -1054,8 +1041,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/security/retrieveReportUserList" }, method = RequestMethod.GET)
public @ResponseBody List<SecurityEntry> getReportUserList(HttpServletRequest request)
- throws IOException, RaptorException {
- List<SecurityEntry> reportUserList = new ArrayList<SecurityEntry>();
+ throws RaptorException {
+ List<SecurityEntry> reportUserList = new ArrayList<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
Vector reportUsers = rdef.getReportUsers(request);
for(Iterator iter=reportUsers.iterator(); iter.hasNext();) {
@@ -1067,8 +1054,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/security/retrieveReportRoleList" }, method = RequestMethod.GET)
public @ResponseBody List<IdNameValue> getReportRoleList(HttpServletRequest request)
- throws IOException, RaptorException {
- List<IdNameValue> reportRoleList = new ArrayList<IdNameValue>();
+ throws RaptorException {
+ List<IdNameValue> reportRoleList = new ArrayList<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
Vector reportRoles = rdef.getReportRoles(request);
Vector remainingRoles = Utils.getRolesNotInList(reportRoles,request);
@@ -1081,16 +1068,15 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/security/retrieveReportUserList_query" }, method = RequestMethod.GET)
public @ResponseBody List<Map<String, String>> getReportUserListQuery(HttpServletRequest request)
- throws IOException, RaptorException {
+ {
List<Map<String, String>> reportUserList = new ArrayList();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
String reportId = rdef.getReportID();
- Map<String, Object> params = new HashMap<String, Object>();
+ Map<String, Object> params = new HashMap<>();
params.put("report_id", new Long(reportId));
List<ReportUserRole> queriedUserList = getDataAccessService().executeNamedQuery("getReportSecurityUsers", params, null);
for (int i=0; i<queriedUserList.size();i++){
- Map<String, String> reportUser = new HashMap<String, String>();
- Object tmp = queriedUserList.get(i);
+ Map<String, String> reportUser = new HashMap<>();
reportUser.put("rep_id", queriedUserList.get(i).toString());
reportUser.put("order_no", queriedUserList.get(i).getOrderNo().toString());
reportUser.put("user_id", queriedUserList.get(i).getUserId().toString());
@@ -1106,8 +1092,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/security/addReportUser", method = RequestMethod.POST)
public @ResponseBody Map<String,String> addSelectedReportUser(
@RequestBody String userIdToAdd, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
- Map<String, String> JsonResponse = new HashMap<String, String>();
+ {
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
JsonResponse.put("status","success");
@@ -1127,8 +1113,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/security/removeReportUser", method = RequestMethod.POST)
public @ResponseBody Map<String,String> removeSelectedReportUser(
@RequestBody String userIdToRemove, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
- Map<String, String> JsonResponse = new HashMap<String, String>();
+ {
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
JsonResponse.put("status","success");
@@ -1148,9 +1134,8 @@ 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)
- throws IOException, RaptorException {
- Map<String, String> JsonResponse = new HashMap<String, String>();
+ @RequestBody String roleIdToAdd, HttpServletRequest request, HttpServletResponse response) {
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
JsonResponse.put("status","success");
@@ -1170,7 +1155,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/security/removeReportRole", method = RequestMethod.POST)
public @ResponseBody Map<String,String> removeSelectedReportRole(
@RequestBody String roleIdToRemove, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
+ {
Map<String, String> JsonResponse = new HashMap<String, String>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
@@ -1191,9 +1176,9 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/security/updateReportSecurityInfo", method = RequestMethod.POST)
public @ResponseBody Map<String,String> updateReportSecurityInfo(
@RequestBody Map<String,String> securityInfo, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
+ {
- Map<String, String> JsonResponse = new HashMap<String, String>();
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
JsonResponse.put("status","success");
@@ -1216,8 +1201,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
public @ResponseBody Map<String,String> toggleUserEditAccess(
@PathVariable("userID") String userId,
@RequestBody String readOnly, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
- Map<String, String> JsonResponse = new HashMap<String, String>();
+ {
+ Map<String, String> JsonResponse = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
String action ="";
@@ -1243,7 +1228,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
public @ResponseBody Map<String,String> toggleRoleEditAccess(
@PathVariable("roleID") String roleId,
@RequestBody String readOnly, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
+ {
Map<String, String> JsonResponse = new HashMap<String, String>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
try {
@@ -1268,10 +1253,10 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/security/retrieveReportOwner" }, method = RequestMethod.GET)
public @ResponseBody List<IdNameValue> getReportOwnerInList(HttpServletRequest request)
- throws IOException, RaptorException {
+ throws RaptorException {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
- List<IdNameValue> UserList = new ArrayList<IdNameValue>();
+ List<IdNameValue> UserList = new ArrayList<>();
List excludeValues = new java.util.ArrayList();
HttpSession session = request.getSession();
String query = Globals.getCustomizedScheduleQueryForUsers();
@@ -1287,7 +1272,6 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
boolean isAdmin = AppUtils.isAdminUser(request);
Vector allUsers = AppUtils.getAllUsers(query, param, isAdmin);
- Vector result = new Vector(allUsers.size());
for (Iterator iter = allUsers.iterator(); iter.hasNext();) {
IdNameValue value = (IdNameValue) iter.next();
@@ -1308,8 +1292,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/security/getReportSecurityInfo" }, method = RequestMethod.GET)
public @ResponseBody Map<String,String> getReportSecurityInfo(HttpServletRequest request)
- throws IOException, RaptorException {
- Map<String, String> securityInfoMap = new HashMap<String,String>();
+ {
+ Map<String, String> securityInfoMap = new HashMap<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
String isPublic = Boolean.toString(rdef.isPublic());
String createUser = AppUtils.getUserName(rdef.getCreateID());
@@ -1330,9 +1314,9 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/security/getReportSecurityUsers" }, method = RequestMethod.GET)
public @ResponseBody List<SecurityEntry> getReportSecurityUsers(HttpServletRequest request)
- throws IOException, RaptorException {
+ throws RaptorException {
- List<SecurityEntry> reportUserMapList = new ArrayList<SecurityEntry>();
+ List<SecurityEntry> reportUserMapList = new ArrayList<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
Vector reportUsers = rdef.getReportUsers(request);
int iCount = 0;
@@ -1349,14 +1333,13 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/security/getReportSecurityRoles" }, method = RequestMethod.GET)
public @ResponseBody List<SecurityEntry> getReportSecurityRoles(HttpServletRequest request)
- throws IOException, RaptorException {
+ throws RaptorException {
- List<SecurityEntry> reportRoleList = new ArrayList<SecurityEntry>();
+ List<SecurityEntry> reportRoleList = new ArrayList<>();
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
Vector reportRoles = rdef.getReportRoles(request);
- int iCount = 0;
- for(Iterator iter=reportRoles.iterator(); iter.hasNext(); iCount++) {
+ for(Iterator iter=reportRoles.iterator(); iter.hasNext(); ) {
SecurityEntry rRole = (SecurityEntry) iter.next();
reportRoleList.add(rRole);
}
@@ -1368,21 +1351,15 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = { "/report/wizard/retrieve_def_tab_wise_data/{id}",
"/report/wizard/retrieve_def_tab_wise_data/{id}/{detailId}" }, method = RequestMethod.GET)
public @ResponseBody DefinitionJSON retrieveDefTabWiseData(@PathVariable Map<String, String> pathVariables,
- HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
- ReportDefinition rdef = null;
- ReportRuntime rr = null;
- boolean newReport = false;
+ HttpServletRequest request, HttpServletResponse response) throws RaptorException {
+ ReportDefinition rdef;
+ ReportRuntime rr;
String tabId = "Def";
String id = "";
if (pathVariables.containsKey("id")) {
id = pathVariables.get("id");
}
-
- String detailId = "";
- if (pathVariables.containsKey("detailId")) {
- detailId = pathVariables.get("detailId");
- }
ServletContext servletContext = request.getSession().getServletContext();
if (!Globals.isSystemInitialized()) {
@@ -1391,13 +1368,11 @@ public class RaptorControllerAsync extends RestrictedBaseController {
String copyReportEvent = (String)request.getSession().getAttribute("COPY_REPORT_EVENT");
if (tabId.equals("Def") && id.equals("InSession") || "true".equals(copyReportEvent)) {
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
- newReport = false;
} else if (tabId.equals("Def") && id.equals("Create")) {
removeVariablesFromSession(request);
rdef = (new ReportHandler()).loadReportDefinition(request, "-1");
rdef.setReportType(AppConstants.RT_LINEAR);
- newReport = true;
} else if (tabId.equals("Def") && AppUtils.nvl(id).length() > 0) {
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
@@ -1417,7 +1392,6 @@ public class RaptorControllerAsync extends RestrictedBaseController {
rdef = (new ReportHandler()).loadReportDefinition(request, id);
request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
}
- newReport = false;
} else {
rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
@@ -1531,7 +1505,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/retrieve_data/{validate}", method = RequestMethod.POST)
public @ResponseBody RaptorResponse retrieveDataForGivenQuery(@PathVariable("validate") boolean validate,
@RequestBody QueryJSON queryJSON, HttpServletRequest request, HttpServletResponse response)
- throws IOException, RaptorException {
+ throws RaptorException {
RaptorResponse raptorResponse = new RaptorResponse();
String sql = queryJSON.getQuery();
String jsonInString = "";
@@ -1584,7 +1558,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb
: rdef.getDBInfo();
String userId = AppUtils.getUserID(request);
- // String userId = "1";
+
sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId);
sql = Utils.replaceInString(sql, "[USERID]", userId);
String[] reqParameters = Globals.getRequestParams().split(",");
@@ -1621,25 +1595,20 @@ public class RaptorControllerAsync extends RestrictedBaseController {
rdef.parseReportSQL(query,validate);
queryResultJSON.setQuery(query);
- int numColumns = ds.getColumnCount();
queryResultJSON.setTotalRows(ds.getRowCount());
- int count = 0;
- Map<String, String> dvJSON = null;
- ArrayList<String> colList = new ArrayList<String>();
- ArrayList<Map<String, String>> reportDataRows = new ArrayList<Map<String, String>>();
+ Map<String, String> dvJSON;
+ ArrayList<String> colList = new ArrayList<>();
+ ArrayList<Map<String, String>> reportDataRows = new ArrayList<>();
if (!ds.isEmpty()) {
- count = 0;
for (int i = 0; i < ds.getColumnCount(); i++) {
colList.add(ds.getColumnName(i));
}
queryResultJSON.setReportDataColumns(colList);
if (queryResultJSON.getTotalRows() > 0) {
- count = 0;
- dvJSON = new HashMap<String, String>();
for (int r = 0; r < Math.min(ds.getRowCount(), 100); r++) {
- dvJSON = new HashMap<String, String>();
+ dvJSON = new HashMap<>();
for (int c = 0; c < ds.getColumnCount(); c++) {
try {
dvJSON.put(ds.getColumnName(c), ds.getString(r, c));
@@ -1730,7 +1699,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "/report/wizard/get_report_log/{reportID}", method = RequestMethod.GET)
public @ResponseBody ArrayList<ReportLogEntry> getLogs(@PathVariable("reportID") String reportId, HttpServletRequest request,
- HttpServletResponse ReportLogEntry) throws IOException {
+ HttpServletResponse ReportLogEntry) {
ArrayList<ReportLogEntry> arrayList = new ArrayList<>();
try {
Vector<ReportLogEntry> v = ReportLoader.loadReportLogEntries(reportId);
@@ -1746,7 +1715,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "save_chart", method = RequestMethod.POST)
public void reportChartReceive(@RequestBody ChartJSON chartJSON, HttpServletRequest request,
- HttpServletResponse response) throws IOException {
+ HttpServletResponse response) {
ReportRuntime reportRuntime;
reportRuntime = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); // changing
// session
@@ -1777,7 +1746,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
List<DataColumnType> reportCols = reportRuntime.getAllColumns();
for (Iterator<DataColumnType> iter = reportCols.iterator(); iter.hasNext();) {
- DataColumnType dct = (DataColumnType) iter.next();
+ DataColumnType dct = iter.next();
if (dct.getColId().equals(domainAxis)) {
dct.setColOnChart(AppConstants.GC_LEGEND);
} else {
@@ -1786,14 +1755,14 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
CategoryAxisJSON categoryAxisJSON = chartJSON.getCategoryAxisJSON();
- String categoryAxis = null;
+ String categoryAxis;
categoryAxis = (categoryAxisJSON != null ? categoryAxisJSON.getValue() : "");
reportCols = reportRuntime.getAllColumns();
for (Iterator<DataColumnType> iter = reportCols.iterator(); iter.hasNext();) {
- DataColumnType dct = (DataColumnType) iter.next();
+ DataColumnType dct = iter.next();
if (dct.getColId().equals(categoryAxis)) {
dct.setChartSeries(true);
} else {
@@ -1816,7 +1785,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
String rangeLineType = AppUtils.nvl(rangeAxisJSON.getRangeLineType());
rangefor: for (Iterator<DataColumnType> iterator = reportCols.iterator(); iterator.hasNext();) {
- DataColumnType dct = (DataColumnType) iterator.next();
+ DataColumnType dct = iterator.next();
if (dct.getColId().equals(rangeAxis)) {
if(removeRangeAxisMap.contains(rangeAxis))
dct.setChartSeq(-1); // if we set it to -1, means this range axis will not be included
@@ -1896,7 +1865,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
reportRuntime.setRightMargin(chartJSON.getCommonChartOptions().getRightMargin());
for (Iterator<DataColumnType> iterator = reportCols.iterator(); iterator.hasNext();) {
- DataColumnType dct = (DataColumnType) iterator.next();
+ DataColumnType dct = iterator.next();
if (!(AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)
|| (dct.getChartSeq() != null && dct.getChartSeq() > 0) || dct.isChartSeries())) {
dct.setChartSeq(-1);