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/controller/ActionHandler.java84
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java20
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java476
-rw-r--r--ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java4
-rw-r--r--ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java2
-rw-r--r--ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java135
-rw-r--r--ecomp-sdk/epsdk-music/src/test/java/org/onap/portalapp/music/conf/MusicSessionTest.java9
7 files changed, 317 insertions, 413 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 e976f144..1eea72e1 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
@@ -137,6 +137,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
+ private static final String PARENT = "parent_";
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ActionHandler.class);
private void preserveReportRuntimeAsBackup(HttpServletRequest request) {
@@ -146,54 +147,36 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
if(session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST)!=null)
repAl = ((ArrayList)session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST));
int index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.DRILLDOWN_INDEX), "0"));
- int form_index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.FORM_DRILLDOWN_INDEX), "0"));
- int flag = 0;
- if(repAl ==null || repAl.size() <= 0) {
- //session.setAttribute(AppConstants.SI_BACKUP_FOR_REP_ID, ((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID());
- //session.setAttribute(AppConstants.SI_REPORT_RUN_BACKUP, request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
+ int formIndex = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.FORM_DRILLDOWN_INDEX), "0"));
+
+ if(repAl ==null || repAl.isEmpty()) {
repAl = new ArrayList();
repAl.add((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
} else {
if(Globals.getMaxDrillDownLevel() < repAl.size()) {
repAl.remove(0);
- if(index > 0) index--;
+ if(index > 0)
+ {
+ index--;
+ }
} else if(index < repAl.size())
repAl.remove(index);
repAl.add(index, (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
}
index = index + 1;
// needed to differentiate form and report index to store form parameters for ZK
- form_index = form_index + 1;
- session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+ formIndex = formIndex + 1;
+ session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(formIndex));
session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
request.getSession().setAttribute(AppConstants.DRILLDOWN_REPORTS_LIST, repAl);
} // preserveReportRuntimeAsBackup
- private void clearReportRuntimeBackup(HttpServletRequest request) {
-// debugLogger.debug("in Action Handler clear is been called.");
- HttpSession session = request.getSession();
- session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
- session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
- request.removeAttribute(AppConstants.DRILLDOWN_INDEX);
- request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
- Enumeration<String> enum1 = session.getAttributeNames();
- String attributeName = "";
- while(enum1.hasMoreElements()) {
- attributeName = enum1.nextElement();
- if(attributeName.startsWith("parent_")) {
- session.removeAttribute(attributeName);
- }
- }
- //request.getSession().removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
- //request.getSession().removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
- } // clearReportRuntimeBackup
-
- private boolean isDashboardInDrillDownList(HttpServletRequest request) throws RaptorException {
+ private boolean isDashboardInDrillDownList(HttpServletRequest request) {
ArrayList aL = (ArrayList) request.getSession().getAttribute(
AppConstants.DRILLDOWN_REPORTS_LIST);
ReportRuntime rr = null;
- if(aL ==null || aL.size() <= 0) {
+ if(aL ==null || aL.isEmpty()) {
return false;
} else {
for (int i =0; i<aL.size(); i++) {
@@ -204,33 +187,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
return false;
}
- private ReportRuntime getReportRuntimeFromBackup(HttpServletRequest request) {
- ArrayList aL = (ArrayList) request.getSession().getAttribute(
- AppConstants.DRILLDOWN_REPORTS_LIST);
- ReportRuntime rr = null;
- HttpSession session = request.getSession();
- /*if(aL==null || (aL.size() <=0) ) {
- rr = (ReportRuntime) request.getSession().getAttribute(
- AppConstants.SI_REPORT_RUN_BACKUP);
- request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
- } else {*/
- //clearReportRuntimeBackup(request);
-
- int index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.DRILLDOWN_INDEX), "0"));
- int form_index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.FORM_DRILLDOWN_INDEX), "0"));
- index = index>0 ? --index : 0;
- form_index = form_index>0 ? --form_index : 0;
- request.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
- session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
- request.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
- session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
-
- rr = (ReportRuntime)aL.get(index);
- request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
- //clearReportRuntimeBackup(request);
- //}
- return rr;
- } // getReportRuntimeFromBackup
public String reportRun(HttpServletRequest request, String nextPage) {
String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
@@ -259,8 +215,14 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String pdfAttachmentKey = AppUtils.getRequestNvlValue(request, "pdfAttachmentKey");
String parent = "";
int parentFlag = 0;
- if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
- if(parent.startsWith("parent_")) parentFlag = 1;
+ if(!"N".equals(nvl(request.getParameter("parent"), "")))
+ {
+ parent = nvl(request.getParameter("parent"), "");
+ }
+ if(parent.startsWith(PARENT))
+ {
+ parentFlag = 1;
+ }
if (pdfAttachmentKey.length()<=0) {
if(actionKey.equals("report.download.page") || actionKey.equals("report.download") || actionKey.equals("report.download.pdf") || actionKey.equals("report.download.excel2007") || actionKey.equals("report.csv.download") || actionKey.equals("report.text.download")) {
@@ -810,8 +772,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
*/
if(rr.isDrillDownURLInPopupPresent()) {
- request.getSession().setAttribute("parent_"+rr.getReportID()+"_rr", rr);
- request.getSession().setAttribute("parent_"+rr.getReportID()+"_rd", rd);
+ request.getSession().setAttribute(PARENT+rr.getReportID()+"_rr", rr);
+ request.getSession().setAttribute(PARENT+rr.getReportID()+"_rd", rd);
}
if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
@@ -2112,7 +2074,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String attributeName = "";
while(enum1.hasMoreElements()) {
attributeName = enum1.nextElement();
- if(attributeName.startsWith("parent_")) {
+ if(attributeName.startsWith(PARENT)) {
session.removeAttribute(attributeName);
}
}
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java
index 403c6b6b..1a31e604 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java
@@ -68,13 +68,12 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
public void processError(HttpServletRequest request, String errorMsg) {
- //Log.write(errorMsg, 2);
logger.error(EELFLoggerDelegate.debugLogger, (errorMsg));
- ArrayList error_list = (ArrayList) request.getAttribute(AppConstants.RI_ERROR_LIST);
- if (error_list == null)
- error_list = new ArrayList(1);
- error_list.add(errorMsg);
- request.setAttribute(AppConstants.RI_ERROR_LIST, error_list);
+ ArrayList errorList = (ArrayList) request.getAttribute(AppConstants.RI_ERROR_LIST);
+ if (errorList == null)
+ errorList = new ArrayList(1);
+ errorList.add(errorMsg);
+ request.setAttribute(AppConstants.RI_ERROR_LIST, errorList);
} // processError
public void processError(HttpServletRequest request, RaptorException e) {
@@ -83,7 +82,7 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject {
private String getSessionLog(HttpServletRequest request) {
String[] sessionVariablesToLog = Globals.getLogVariablesInSession().split(",");
- StringBuffer sessionLogStrBuf = new StringBuffer("\n");
+ StringBuilder sessionLogStrBuf = new StringBuilder("\n");
sessionLogStrBuf.append("***** ADDITIONAL INFORMATION ******");
HttpSession session = request.getSession();
ReportRuntime rr = (ReportRuntime) session.getAttribute(AppConstants.SI_REPORT_RUNTIME);
@@ -106,7 +105,6 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject {
return sessionLogStrBuf.toString();
}
public String processFatalError(HttpServletRequest request, RaptorException e) {
- //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
if (e instanceof ReportSQLException) {
String errorSQL = ((ReportSQLException) e).getReportSQL();
@@ -120,28 +118,25 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject {
} // processFatalError
public String processFatalErrorJSON(HttpServletRequest request, RaptorException e) {
- //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
if (e instanceof ReportSQLException) {
String errorSQL = ((ReportSQLException) e).getReportSQL();
if (nvl(errorSQL).length() > 0)
request.setAttribute("c_error_sql", errorSQL);
} // if
- //AppUtils.processErrorNotification(request, e);
request.setAttribute(AppConstants.RI_EXCEPTION, e);
ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
errorJSONRuntime.setErrormessage(e.toString());
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 = "";
try {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
} catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + ex.getClass().getName() + "]: " + nvl(ex.getMessage())+" "+ getSessionLog(request) + ex.getMessage()),AlarmSeverityEnum.MAJOR);
ex.printStackTrace();
}
@@ -155,7 +150,6 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject {
return result.toString();
}
public String processFatalErrorWMenu(HttpServletRequest request, RaptorException e) {
- //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
if (e instanceof ReportSQLException) {
String errorSQL = ((ReportSQLException) e).getReportSQL();
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java
index 47af1b71..f0829d29 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java
@@ -33,7 +33,7 @@
*
* ============LICENSE_END============================================
*
- *
+ *
*/
package org.onap.portalsdk.analytics.controller;
@@ -80,35 +80,36 @@ import org.onap.portalsdk.analytics.xmlobj.SemaphoreType;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
/**<HR/>
- * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
* <HR/>
*
* --------------------------------------------------------------------------------------------------<BR/>
- * <B>WizardProcessor.java</B> - This class is used to process the user input provided in the wizard.<BR/>
+ * <B>WizardProcessor.java</B> - This class is used to process the user input provided in the wizard.<BR/>
* It is called in creation as well as updation process. It builds report xml via JAXB using user<BR/>
* input. This is vital one, to store meta information of each report<BR/>
* ---------------------------------------------------------------------------------------------------<BR/>
*
*
* <U>Change Log</U><BR/><BR/>
- *
- * 31-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> For Time Series multi series property is exposed. </LI></UL>
- * 28-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> If user login id is null, it would display user name when user is added for schedule. </LI></UL>
- * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
- * 12-Aug-2009 : Version 8.5 (Sundar); <UL><LI> For Line Charts too options are captured and rendering is customized. </LI></UL>
- * 29-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Maximum Excel Download size would be persisted if changed. </LI></UL>
- * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Schedule feature is added to Dashboard Reports. </LI></UL>
+ *
+ * 31-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> For Time Series multi series property is exposed. </LI></UL>
+ * 28-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> If user login id is null, it would display user name when user is added for schedule. </LI></UL>
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 12-Aug-2009 : Version 8.5 (Sundar); <UL><LI> For Line Charts too options are captured and rendering is customized. </LI></UL>
+ * 29-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Maximum Excel Download size would be persisted if changed. </LI></UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Schedule feature is added to Dashboard Reports. </LI></UL>
* 29-Jun-2009 : Version 8.4 (Sundar); <UL><LI> Options for <I>Compare to Previous year Chart</I> are processed.</LI>
* <LI> In the Bar chart Last Occuring Series/Category can be plotted as Bar or Line Renderer. </LI>
- * </UL>
- * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI> processChart method is modified to accommodate creating
- * Bar Charts, Time Difference Charts and adding generic chart options.</LI></UL>
- *
+ * </UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI> processChart method is modified to accommodate creating
+ * Bar Charts, Time Difference Charts and adding generic chart options.</LI></UL>
+ *
*/
public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WizardProcessor.class);
+
public static Calendar getCalendar(XMLGregorianCalendar xmlCalendar){
- // log.debug("Zone ID is " + xmlCalendar.getTimezone());
TimeZone timeZone = xmlCalendar.getTimeZone(xmlCalendar.getTimezone());
Calendar calendar = Calendar.getInstance(timeZone);
calendar.set(Calendar.YEAR,xmlCalendar.getYear());
@@ -119,12 +120,12 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
calendar.set(Calendar.SECOND,xmlCalendar.getSecond());
return calendar;
}
- private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WizardProcessor.class);
+
public WizardProcessor() {
}
private String adjustDataType(String oracleDataType) {
- return oracleDataType.equals("VARCHAR2") ? AppConstants.CT_CHAR : oracleDataType;
+ return "VARCHAR2".equals(oracleDataType) ? AppConstants.CT_CHAR : oracleDataType;
// Probably should be expanded to convert any CHAR or VARCHAR type to
// CT_CHAR, number type to CT_NUMBER and date to CT_DATE
} // adjustDataType
@@ -148,12 +149,12 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String curStep = rdef.getWizardSequence().getCurrentStep();
String curSubStep = rdef.getWizardSequence().getCurrentSubStep();
- if (AppUtils.getRequestNvlValue(request, "showDashboardOptions").length()<=0)
+ if (AppUtils.getRequestNvlValue(request, "showDashboardOptions").length()<=0)
request.setAttribute("showDashboardOptions", "F");
logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^curStep " + curStep + " " + curSubStep + " " + action));
boolean reportUpdated = false;
if (!action.equals(AppConstants.WA_BACK)) {
- if (curStep.equals(AppConstants.WS_DEFINITION)) {
+ if (curStep.equals(AppConstants.WS_DEFINITION)) {
reportUpdated = processDefinition(request);
} else if (curStep.equals(AppConstants.WS_SQL)) {
if (action.equals(AppConstants.WA_VALIDATE))
@@ -171,7 +172,6 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
reportUpdated = processColumnAddEdit(request, curSubStep
.equals(AppConstants.WSS_EDIT) || curSubStep
.equals(AppConstants.WA_MODIFY));
- //reportUpdated = processColumnAddEdit(request, true);
}
else if (curSubStep.equals(AppConstants.WSS_ADD_MULTI))
reportUpdated = processColumnAddMulti(request);
@@ -197,7 +197,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
else if (action.equals(AppConstants.WSS_ADD_BLANK))
reportUpdated = processFormFieldBlank(request);
else if (action.equals(AppConstants.WSS_INFO_BAR))
- reportUpdated = processFormFieldInfoBar(request);
+ reportUpdated = processFormFieldInfoBar(request);
} else if (curStep.equals(AppConstants.WS_FILTERS)) {
if (curSubStep.equals(AppConstants.WSS_ADD)
|| curSubStep.equals(AppConstants.WSS_EDIT))
@@ -236,15 +236,15 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
reportUpdated = processClearLog(request);
} else if (curStep.equals(AppConstants.WS_SCHEDULE)) {
reportUpdated = processSchedule(request, action);
- } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) {
+ } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) {
reportUpdated = processForecasting(request, action);
- }
+ }
/****For Report Maps - Start*****/
else if (curStep.equals(AppConstants.WS_MAP)) {
reportUpdated = processMap(request, action);
- }
+ }
/****For Report Maps - End*****/
-
+
// else
}
if (reportUpdated)
@@ -270,7 +270,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
.add(new IdNameValue(sem.getSemaphoreId(), sem.getSemaphoreName()));
} // for
- if (importedList.size() > 0) {
+ if (!importedList.isEmpty()) {
request.setAttribute(AppConstants.RI_DATA_SET, importedList);
persistReportDefinition(request, rdef);
} // if
@@ -294,7 +294,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.deleteSemaphore(semaphore);
semaphore.setSemaphoreName(semaphoreName);
semaphore.setSemaphoreType(semaphoreType);
-
+
rdef.setSemaphore(semaphore);
}
@@ -308,36 +308,31 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String[] fontColor = request.getParameterValues("fontColor");
String[] fontFace = request.getParameterValues("fontFace");
String[] fontSize = request.getParameterValues("fontSize");
- //String[] anyFmt = request.getParameterValues("anyFmt");
-
- // String[] alignment = request.getParameterValues("alignment");
for (int i = 0; i < lessThanValue.length; i++)
if (i == 0 || nvl(lessThanValue[i]).length() > 0) {
FormatType fmt = null;
if (i == 0 || nvl(formatId[i]).length() > 0)
- fmt = rdef.getSemaphoreFormatById(semaphore, nvl(formatId[i]));
+ fmt = ReportDefinition.getSemaphoreFormatById(semaphore, nvl(formatId[i]));
if (fmt == null)
- fmt = rdef.addEmptyFormatType(new ObjectFactory(), semaphore);
+ fmt = ReportDefinition.addEmptyFormatType(new ObjectFactory(), semaphore);
fmt.setLessThanValue(nvl(lessThanValue[i]));
fmt.setExpression(nvl(expression[i]));
- fmt.setBold(bold[i].equals("Y"));
- fmt.setItalic(italic[i].equals("Y"));
- fmt.setUnderline(underline[i].equals("Y"));
+ fmt.setBold("Y".equals(bold[i]));
+ fmt.setItalic("Y".equals(italic[i]));
+ fmt.setUnderline("Y".equals(underline[i]));
fmt.setBgColor(bgColor[i]);
fmt.setFontColor(fontColor[i]);
fmt.setFontFace(fontFace[i]);
fmt.setFontSize(fontSize[i]);
- //fmt.setAnyFmt((anyFmt[i]!=null)?anyFmt[i].startsWith("Y"):false);
- // fmt.setAlignment(alignment[i]);
} else if (nvl(formatId[i]).length() > 0)
- rdef.deleteFormatType(semaphore, formatId[i]);
+ ReportDefinition.deleteFormatType(semaphore, formatId[i]);
persistReportDefinition(request, rdef);
} // processSemaphorePopup
- private boolean processDefinition(HttpServletRequest request) throws Exception {
+ private boolean processDefinition(HttpServletRequest request) throws RaptorException {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
AppConstants.SI_REPORT_DEFINITION);
@@ -350,35 +345,29 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
boolean isSizedByContent= (AppUtils.getRequestNvlValue(request, "sizedByContent").length()<=0?"N":AppUtils.getRequestNvlValue(request, "sizedByContent")).startsWith("Y");
boolean reportsInNewWindow = false;
boolean hideFormFieldAfterRun = false;
-
+
/*recurrance in schedule tab - Start*/
- String isOneTimeScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isOneTimeScheduleAllowed"),"N");
+ String isOneTimeScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isOneTimeScheduleAllowed"),"N");
String isHourlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isHourlyScheduleAllowed"),"N");
String isDailyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyScheduleAllowed"),"N");
String isDailyMFScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyMFScheduleAllowed"),"N");
String isWeeklyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isWeeklyScheduleAllowed"),"N");
String isMonthlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isMonthlyScheduleAllowed"),"N");
- //System.out.println("//////////// + isOneTimeScheduleAllowed : " + isOneTimeScheduleAllowed);
- /*recurrance in schedule tab - End*/
+ /*recurrance in schedule tab - End*/
if (reportDescr.length() > 1000)
reportDescr = reportDescr.substring(0, 1000);
boolean reportUpdated;
-
+
String reportType = AppUtils.getRequestNvlValue(request, "reportType");
-
-
-
- //rdef.setReportName(reportName);
- //rdef.setReportDescr(reportDescr);
- //rdef.setReportType(reportType);
+
rdef.setFolderId(folderId);
-// debugLogger.debug("setting folder ID = " + folderId);
+
if(reportType.equals(AppConstants.RT_DASHBOARD)) {
rdef.setReportName(reportName);
rdef.setReportDescr(reportDescr);
- rdef.setReportType(reportType);
+ rdef.setReportType(reportType);
String dashboardLayoutHTML = AppUtils.getRequestNvlValue(request, "dashboardLayoutHTML");
rdef.setDashboardLayoutHTML(dashboardLayoutHTML);
String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto");
@@ -386,65 +375,32 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setDataContainerHeight(dataContainerHeight);
rdef.setDataContainerWidth(dataContainerWidth);
rdef.setAllowSchedule(isAllowSchedule?"Y":"N");
-
-
- /*
- String numDashCols = AppUtils.getRequestNvlValue(request, "numDashCols");
- String reports1 = AppUtils.getRequestNvlValue(request, "reports1");
- String reports2 = AppUtils.getRequestNvlValue(request, "reports2");
- String reports3 = AppUtils.getRequestNvlValue(request, "reports3");
- String reports4 = AppUtils.getRequestNvlValue(request, "reports4");
- String repBgColor1 = AppUtils.getRequestNvlValue(request, "repBgColor1");
- String repBgColor2 = AppUtils.getRequestNvlValue(request, "repBgColor2");
- String repBgColor3 = AppUtils.getRequestNvlValue(request, "repBgColor3");
- String repBgColor4 = AppUtils.getRequestNvlValue(request, "repBgColor4");
-
- //List reports = rdef.getDashBoardReports();
- rdef.setNumDashCols(numDashCols);
- DashboardReports reportsList = new DashboardReportsImpl();
-
- String reports[] = new String[]{reports1, reports2, reports3, reports4};
- String repBgColors[] = new String[]{repBgColor1, repBgColor2, repBgColor3, repBgColor4};
- for (int i = 0; i < reports.length; i++) {
- Reports report = new ReportsImpl();
- report.setReportId(reports[i]);
- report.setBgcolor(repBgColors[i]);
- reportsList.getReportsList().add(report);
- }
-
-
-
- rdef.setDashBoardReports(reportsList);
- */
+
+
reportUpdated = true;
-
-// reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))
-// && reportDescr.equals(nvl(rdef.getReportDescr()))
-// && reportType.equals(nvl(rdef.getReportType()))
-// && numDashCols.equals(nvl(rdef.getNumDashCols()))));
-//// && rdef.getR
-
+
+
if (rdef.getWizardSequence() instanceof WizardSequence)
rdef.generateWizardSequence(request);
-
+
} else {
-
+
if (AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_CROSSTAB) || rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) {
-
+
String widthNo = AppUtils.getRequestNvlValue(request, "widthNo");
if(nvl(widthNo).endsWith("px"))
rdef.setWidthNoColumn(widthNo);
else
rdef.setWidthNoColumn(widthNo+"px");
}
-
+
String dataGridAlign = AppUtils.getRequestNvlValue(request, "dataGridAlign");
if(nvl(dataGridAlign).length()>0) {
rdef.setDataGridAlign(dataGridAlign);
} else {
rdef.setDataGridAlign("left");
}
-
+
String pdfImgLogo = AppUtils.getRequestNvlValue(request, "pdfImg");
if(nvl(pdfImgLogo).length()>0)
rdef.setPdfImg(pdfImgLogo);
@@ -464,12 +420,12 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
} catch (NumberFormatException ex) {}
if(AppUtils.getRequestNvlValue(request, "excelDownloadSize").length()>0)
rdef.setMaxRowsInExcelDownload(Integer.parseInt(AppUtils.getRequestValue(request, "excelDownloadSize")));
- if(AppUtils.getRequestNvlValue(request, "reportInNewWindow").length()>0)
+ if(AppUtils.getRequestNvlValue(request, "reportInNewWindow").length()>0)
reportsInNewWindow = AppUtils.getRequestNvlValue(request,"reportInNewWindow").equals("Y");
- if(AppUtils.getRequestNvlValue(request, "hideFormFieldsAfterRun").length()>0)
+ if(AppUtils.getRequestNvlValue(request, "hideFormFieldsAfterRun").length()>0)
hideFormFieldAfterRun = AppUtils.getRequestNvlValue(request,"hideFormFieldsAfterRun").equals("Y");
-
+
if(AppUtils.getRequestNvlValue(request, "displayFolderTree").length()>0)
rdef.setDisplayFolderTree(AppUtils.getRequestNvlValue(request,"displayFolderTree").equals("Y"));
else
@@ -481,20 +437,20 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
DataSet ds = null;
try {
ds = DbUtils.executeQuery(schemaSql);
-
+
String prefix = "", desc = "";
-
+
for (int i = 0; i < ds.getRowCount(); i++) {
dbType = ds.getItem(i, 2);
}
}
catch (Exception e) {}
-
+
int pageSize = Globals.getDefaultPageSize();
try {
pageSize = Integer.parseInt(AppUtils.getRequestValue(request, "pageSize"));
} catch (NumberFormatException e) {
- }
+ }
String rApproved = nvl(AppUtils.getRequestValue(request, "menuApproved"), "N");
String menuID = "";
String[] menuIDs = request.getParameterValues("menuID");
@@ -502,7 +458,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
for (int i = 0; i < menuIDs.length; i++)
menuID += (menuID.length() == 0 ? "" : "|") + menuIDs[i];
/* else
- menuID = "";*/
+ menuID = "";*/
// boolean additionalFieldsShown = AppUtils.getRequestNvlValue(request,
// "additionalFieldsShown").equals("Y");
@@ -510,7 +466,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String reportDefType = AppUtils.getRequestNvlValue(request, "reportDefType");
String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto");
String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto");
-
+
String displayOptions = nvl(AppUtils.getRequestValue(request, "hideForm"), "N")
+ nvl(AppUtils.getRequestValue(request, "hideChart"), "N")
+ nvl(AppUtils.getRequestValue(request, "hideData"), "N")
@@ -522,20 +478,20 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"chart").equals("chart"))?"Y":"N");
dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"").equals("data"))?"Y":"N");
dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hideBtns"),"").equals("Y"))?"Y":"N");*/
-
+
String numFormCols = nvl(AppUtils.getRequestValue(request, "numFormCols"), "1");
String reportTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportTitle"));
String reportSubTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportSubTitle"));
String reportHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportHeader"));
String reportFooter = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportFooter"));
-
+
int frozenColumns = 0;
- try {
+ try {
frozenColumns = Integer.parseInt(AppUtils.getRequestValue(request, "frozenColumns"));
} catch (NumberFormatException ex) {
-
+
}
-
+
/* reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))))
&& (!(reportDescr.equals(nvl(rdef.getReportDescr()))))
&& (!(formHelp.equals(nvl(rdef.getFormHelpText()))))
@@ -559,17 +515,17 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
&& numFormCols.equals(nvl(rdef.getNumFormCols()))
&& reportTitle.equals(nvl(rdef.getReportTitle()))
&& reportSubTitle.equals(nvl(rdef.getReportSubTitle()))
- && reportHeader.equals(nvl(rdef.getReportHeader()))
+ && reportHeader.equals(nvl(rdef.getReportHeader()))
&& reportsInNewWindow == rdef.isReportInNewWindow()
&& reportFooter.equals(nvl(rdef.getReportFooter())))
;*/
-
-
+
+
/*reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))
&& reportDescr.equals(nvl(rdef.getReportDescr()))
&& formHelp.equals(nvl(rdef.getFormHelpText()))
&& reportType.equals(nvl(rdef.getReportType()))
- && (pageSize == rdef.getPageSize())
+ && (pageSize == rdef.getPageSize())
&& excelDownloadSize == rdef.getMaxRowsInExcelDownload()
&& reportsInNewWindow == rdef.isReportInNewWindow()
&& displayOptions.equals(rdef.getDisplayOptions())
@@ -617,7 +573,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setDashboardOptions(dashboardOptions.toString());
}*/
rdef.setHideFormFieldAfterRun(hideFormFieldAfterRun);
- rdef.setReportInNewWindow(reportsInNewWindow);
+ rdef.setReportInNewWindow(reportsInNewWindow);
rdef.setRuntimeColSortDisabled(rRCSDisabled);
rdef.setNumFormCols(numFormCols);
rdef.setReportTitle(reportTitle);
@@ -633,11 +589,11 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setFrozenColumns(frozenColumns);
} // if
-
+
if (rdef.getWizardSequence() instanceof WizardSequence)
rdef.generateWizardSequence(request);
-
+
/*
* if(formHelp.length()>255) formHelp = formHelp.substring(0, 255);
*/
@@ -648,10 +604,10 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
// String menuID = AppUtils.getRequestNvlValue(request, "menuID");
// boolean dashboardOptionsShown = AppUtils.getRequestNvlValue(request,
-// "dashboardOptionsShown").equals("Y");
+// "dashboardOptionsShown").equals("Y");
reportUpdated = true;
-
+
if (rdef.getReportID().equals("-1"))
// Always need to persist new report - in case it is a copy
reportUpdated = true;
@@ -668,13 +624,13 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String joinTableExpr = null;
String joinTableId = null;
-
- DataSourceType joinTable =
+
+ DataSourceType joinTable =
rdef.getTableById(AppUtils.getRequestValue(request, "joinTableName"));
if (joinTable != null) {
String joinTableName = joinTable.getTableName();
joinTableId = joinTable.getTableId();
-
+
String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase();
joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", tableId);
@@ -705,24 +661,24 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String tableName = AppUtils.getRequestNvlValue(request, "tableName").toUpperCase();
String joinTableId = AppUtils.getRequestNvlValue(request, "joinTableName");
-
+
String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase();
-
+
String joinTableExpr = null;
if(joinExpr.length()!=0){
joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", rdef.getTableByDBName(tableName).getTableId());
joinTableExpr = joinTableExpr.replaceAll("\\["+rdef.getTableById(joinTableId).getTableName().toUpperCase()+"\\]", joinTableId);
dst.setRefDefinition(joinTableExpr);
}
- boolean reportUpdated = (!displayName.equals(nvl(dst.getDisplayName())) ||
+ boolean reportUpdated = (!displayName.equals(nvl(dst.getDisplayName())) ||
!outerJoin.equals(rdef.getOuterJoinType(dst)) ||
!(joinExpr.length()==0));
-
+
dst.setDisplayName(displayName);
rdef.setOuterJoin(dst, outerJoin);
if (reportUpdated)
rdef.resetCache(true);
-
+
return true; // reportUpdated;
} // processTableEdit
@@ -813,24 +769,24 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
}
String dependsOnFormField = AppUtils.getRequestNvlValue(request, "dependsOnFormField");
boolean isGroupBreak = AppUtils.getRequestFlag(request, "groupBreak");
- String groupByPosStr = AppUtils.nvls(AppUtils.getRequestValue(request, "groupByPos"), "0");
+ String groupByPosStr = AppUtils.nvls(AppUtils.getRequestValue(request, "groupByPos"), "0");
int groupByPos = Integer.parseInt(groupByPosStr);
currColumn.setGroupByPos(groupByPos);
-
+
if(groupByPos > 0) {
- String subTotalCustomText = AppUtils.nvls(AppUtils.getRequestValue(request, "subTotalCustomText"), "Sub Total");
+ String subTotalCustomText = AppUtils.nvls(AppUtils.getRequestValue(request, "subTotalCustomText"), "Sub Total");
currColumn.setSubTotalCustomText(subTotalCustomText);
-
+
boolean hideRepeatedKey = AppUtils.getRequestFlag(request, "hideRepeatedKeys");
currColumn.setHideRepeatedKey(hideRepeatedKey);
}
-
+
String displayTotal = AppUtils.getRequestNvlValue(request, "displayTotal");
String widthInPxls = AppUtils.getRequestNvlValue(request, "widthInPxls");
-
+
if (rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) {
-
-
+
+
crossTabValue = AppUtils.getRequestValue(request, "crossTabValue");
isVisible = nvl(crossTabValue).equals(AppConstants.CV_ROW)
@@ -849,7 +805,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String displayName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "displayName"));
String colType = AppUtils.getRequestNvlValue(request, "colType");
String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat");
-
+
//HYPERLINK
if(colType.equals(AppConstants.CT_HYPERLINK)) {
String hyperlinkURL = AppUtils.getRequestValue(request, "hyperlinkURL");
@@ -861,9 +817,9 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
currColumn.setActionImg(actionImg);
}
}
-
-
-
+
+
+
String displayAlign = AppUtils.getRequestValue(request, "displayAlign");
String displayHeaderAlign = AppUtils.getRequestValue(request, "displayHeaderAlign");
String drillDownURL = AppUtils.getRequestValue(request, "drillDownURL");
@@ -888,7 +844,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
//startColGroupInt = Integer.parseInt(startColGroup);
colGroupColSpanInt = Integer.parseInt(colGroupColSpan);
} catch (NumberFormatException ex) {
-
+
}
}
currColumn.setLevel(level);
@@ -896,13 +852,13 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
currColumn.setStart(startColGroupInt);
currColumn.setColspan(colGroupColSpanInt);
}
-
+
String targetColumnId = (semaphoreType.indexOf("|")!= -1 ? semaphoreType.substring(semaphoreType.indexOf("|")+1):"");
DataColumnType targetColumn = rdef.getColumnById(targetColumnId);
-
+
SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId);
rdef.deleteSemaphore(semaphore);
- if(nvl(semaphoreType).length() > 0 && semaphoreType.indexOf("|")!=-1)
+ if(nvl(semaphoreType).length() > 0 && semaphoreType.indexOf("|")!=-1)
semaphore.setSemaphoreType(semaphoreType.substring(0,semaphoreType.indexOf("|")));
if(semaphore!=null) {
semaphore.setComment(currColumn.getColId());
@@ -910,7 +866,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
semaphore.setTarget(targetColumnId.length()>0? targetColumnId: "");
rdef.setSemaphore(semaphore);
}
-
+
if (isEdit) {
if(nvl(widthInPxls).length()>0) {
@@ -926,7 +882,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
currColumn.setDependsOnFormField(dependsOnFormField);
currColumn.setDisplayName(displayName);
//currColumn.setOriginalDisplayName(displayName);
-
+
if (displayWidth > 0)
currColumn.setDisplayWidth(displayWidth);
currColumn.setDisplayAlignment(displayAlign);
@@ -953,11 +909,11 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
currColumn.setIsSortable(isSortable);
currColumn.setNowrap(nowrap);
//else
- // currColumn.setVisible(true);
- if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ // currColumn.setVisible(true);
+ if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
if(colType!=null)
currColumn.setColType(colType);
- displayFormat = AppUtils.getRequestValue(request, "colDataFormat");
+ displayFormat = AppUtils.getRequestValue(request, "colDataFormat");
if (displayFormat != null){
currColumn.setColFormat(displayFormat);
}
@@ -1138,18 +1094,18 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String rangeStartDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeStartDateSQL"));
String rangeEndDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeEndDateSQL"));
boolean isGroupFormField = AppUtils.getRequestFlag(request,"isGroupFormField");
-
+
Calendar start = null;
Calendar end = null;
if (AppUtils.nvl(rangeStartDate).length()>0){
SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
start = Calendar.getInstance();
- start.setTime(dtf.parse(rangeStartDate));
+ start.setTime(dtf.parse(rangeStartDate));
}
if (AppUtils.nvl(rangeEndDate).length()>0){
SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
end = Calendar.getInstance();
- end.setTime(dtf.parse(rangeEndDate));
+ end.setTime(dtf.parse(rangeEndDate));
}/*
* if(fieldHelp.length()>255) fieldHelp = fieldHelp.substring(0, 255);
*/
@@ -1168,7 +1124,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
&& validation.equals(nvl(currField.getValidationType()))
&& mandatory.equals(nvl(currField.getMandatory(), "N"))
&& defaultValue.equals(nvl(currField.getDefaultValue()))
- && fieldSQL.equals(nvl(currField.getFieldSQL()))
+ && fieldSQL.equals(nvl(currField.getFieldSQL()))
&& fieldDefaultSQL.equals(nvl(currField.getFieldDefaultSQL()))
&& dependsOn.equals(nvl(currField.getDependsOn(), "N"))
&& (start == null || (start != null && currField.getRangeStartDate() == null) || (start.compareTo(getCalendar(currField.getRangeStartDate())) )==0)
@@ -1209,9 +1165,9 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
/*currField.setRangeEndDate(DatatypeFactory.newInstance()
.newXMLGregorianCalendar(end));*/
} catch (DatatypeConfigurationException ex) {
-
+
}
-
+
currField.setRangeStartDateSQL(rangeStartDateSQL);
currField.setRangeEndDateSQL(rangeEndDateSQL);
currField.setGroupFormField(isGroupFormField);
@@ -1220,7 +1176,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
currField.setMultiSelectListSize(multiSelectSize);
}
-
+
} // if
} else {
reportUpdated = true;
@@ -1277,7 +1233,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.addFormFieldBlank(new ObjectFactory());
return true;
} // processFormFieldMoveDown
-
+
//processFormFieldInfoBar
private boolean processFormFieldInfoBar(HttpServletRequest request) throws Exception {
boolean reportUpdated = false;
@@ -1287,31 +1243,31 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.addCustomizedTextForParameters(XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "blueBarField")));
return true;
} // processFormFieldMoveDown
-
-
+
+
private boolean processForecasting(HttpServletRequest request, String action) throws Exception {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
AppConstants.SI_REPORT_DEFINITION);
-
+
if(rdef.getDataminingOptions()==null)
- rdef.addDataminingOptions(new ObjectFactory());
-
+ rdef.addDataminingOptions(new ObjectFactory());
+
String classifiers = AppUtils.getRequestNvlValue(request, "classifiers");
rdef.setClassifier(classifiers);
String dateAttrColId = AppUtils.getRequestNvlValue(request, "timeAttribute");
String timeFormat = AppUtils.getRequestNvlValue(request, "timeFormat");
if(timeFormat.equals("Default")) timeFormat = "yyyy-MM-dd HH:mm:ss";
String forecastingPeriod = AppUtils.getRequestNvlValue(request, "forecastingPeriod");
-
+
String[] forecastCols = request.getParameterValues("forecastCol");
List reportCols = rdef.getAllColumns();
DataColumnType dct = null;
Iterator iter = null;
-
-
+
+
if(dateAttrColId != null) {
- for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
dct = (DataColumnType) iter.next();
if(dct.getColId().equals(dateAttrColId)) {
dct.setDataMiningCol(AppConstants.DM_DATE_ATTR);
@@ -1320,10 +1276,10 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
}
}
}
-
+
if(forecastCols != null) {
for (int i = 0; i < forecastCols.length; i++) {
- for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
dct = (DataColumnType) iter.next();
if(dct.getColId().equals(forecastCols[i])) {
dct.setDataMiningCol(AppConstants.DM_FORECASTING_ATTR);
@@ -1333,11 +1289,11 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setForecastingPeriod(forecastingPeriod);
}
boolean reportUpdated = true;
-
+
return reportUpdated;
} // processForecasting
-
-
+
+
private boolean processFilterAddEdit(HttpServletRequest request, boolean isEdit)
throws Exception {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
@@ -1380,7 +1336,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
+ nvl(currColumn.getColFormat(),
AppConstants.DEFAULT_DATE_FORMAT) + "')")
: ("'" + argValue + "'"))) + " FROM dual");*/
-
+
DataSet ds = DbUtils.executeQuery("SELECT "
+ (currColType.equals(AppConstants.CT_NUMBER) ? ("TO_NUMBER('"
+ argValue + "')")
@@ -1561,7 +1517,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
processSaveJavascriptElement(request);
return true;
}
-
+
private boolean processSaveJavascriptElement (HttpServletRequest request) throws Exception {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
AppConstants.SI_REPORT_DEFINITION);
@@ -1569,9 +1525,9 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String id = AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT_ITEM_ID);
String fieldId = AppUtils.getRequestNvlValue(request, "javascriptFormField-"+id);
if( nvl(fieldId).length()>0 && !(fieldId.startsWith("-1"))) {
-
+
String callableJavascriptText = AppUtils.getRequestNvlValue(request, "callText-"+id);
-
+
logger.debug(EELFLoggerDelegate.debugLogger, ("FieldId " + fieldId + " Call Text " + callableJavascriptText+ " id " + id));
JavascriptItemType javaScriptType = null;
if(id.length()>0 && id.startsWith("-1")) {
@@ -1585,23 +1541,23 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
else
javaScriptType.setId("ol1|1");
}
- javaScriptType.setCallText(callableJavascriptText);
+ javaScriptType.setCallText(callableJavascriptText);
} else {
javaScriptType = rdef.addJavascriptType(new ObjectFactory(), id);
javaScriptType.setCallText(callableJavascriptText);
}
}
return true;
- }
+ }
private boolean processAddJavascriptElement (HttpServletRequest request) throws Exception {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
AppConstants.SI_REPORT_DEFINITION);
-
+
JavascriptItemType javaScriptType = rdef.addJavascriptType(new ObjectFactory(), "");
javaScriptType.setId("");
javaScriptType.setFieldId("");
- javaScriptType.setCallText("");
-
+ javaScriptType.setCallText("");
+
return true;
}
@@ -1632,36 +1588,36 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String chartMultiseries = AppUtils.getRequestNvlValue(request, "multiSeries");
String lastSeriesALineChart = AppUtils.getRequestNvlValue(request, "lastSeriesALineChart");
String lastSeriesABarChart = AppUtils.getRequestNvlValue(request, "lastSeriesABarChart");
- String overLayItemLabel = "N";
+ String overLayItemLabel = "N";
String chartDisplay = null;
-
+
String multiplePieOrder = null;
String multiplePieLabelDisplay = null;
String chartOrientation = null;
String secondaryChartRenderer = null;
-
- String linearRegression = null;
+
+ String linearRegression = null;
boolean multiplePieOrderInRunPage = false;
boolean multiplePieLabelDisplayInRunPage = false;
boolean chartOrientationInRunPage = false;
boolean secondaryChartRendererInRunPage = false;
-
+
boolean chartDisplayInRunPage = false;
-
+
String intervalFromdate = null;
String intervalTodate = null;
String intervalLabel = null;
- boolean displayIntervalInputInRunPage = false;
+ boolean displayIntervalInputInRunPage = false;
boolean animate = false;
-
+
animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate");
if(Globals.showAnimatedChartOption())
rdef.setChartAnimate(animate);
-
-
+
+
String removeColId = "";
if (action.equals(AppConstants.WA_DELETE_USER)) {
removeColId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
@@ -1674,27 +1630,27 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
}
}
}
-
+
if(rdef.getChartAdditionalOptions()==null)
rdef.addChartAdditionalOptions(new ObjectFactory());
-
+
if(rdef.getChartDrillOptions()==null)
- rdef.addChartDrillOptions(new ObjectFactory());
+ rdef.addChartDrillOptions(new ObjectFactory());
//clearing already added
if(rdef.getChartDrillOptions().getTargetFormfield()!=null)
rdef.getChartDrillOptions().getTargetFormfield().removeAll(rdef.getChartDrillOptions().getTargetFormfield());
-
-
+
+
if(chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
multiplePieOrder = AppUtils.getRequestNvlValue(request, "multiplePieOrder");
multiplePieLabelDisplay = AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay");
chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
- //if(AppUtils.getRequestNvlValue(request, "multiplePieOrderInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "multiplePieOrderInRunPage").length()>0)
multiplePieOrderInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieOrderInRunPage").equals("Y");
- //if(AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplayInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplayInRunPage").length()>0)
multiplePieLabelDisplayInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieLabelDisplayInRunPage").equals("Y");
- //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
if(rdef.getChartAdditionalOptions()!=null) {
rdef.setChartMultiplePieOrder(multiplePieOrder+(multiplePieOrderInRunPage?"|Y":""));
@@ -1702,14 +1658,14 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
}
- }
-
+ }
+
if(chartType.equals(AppConstants.GT_REGRESSION)) {
linearRegression = AppUtils.getRequestNvlValue(request, "regressionType");
rdef.setLinearRegressionColor(AppUtils.getRequestNvlValue(request, "valueLinearRegressionColor"));
rdef.setExponentialRegressionColor(AppUtils.getRequestNvlValue(request, "valueExponentialRegressionColor"));
rdef.setCustomizedRegressionPoint(AppUtils.getRequestNvlValue(request, "regressionPointCustomization"));
-
+
if(nvl(linearRegression).length()>0)
rdef.setLinearRegression(linearRegression);
else
@@ -1720,27 +1676,27 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation");
secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer");
chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
- //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y");
- //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y");
- //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":""));
rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":""));
rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
rdef.setLastSeriesALineChart(nvl(lastSeriesALineChart, "N"));
}
-
+
if(chartType.equals(AppConstants.GT_LINE)) {
chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation");
secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer");
chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
- //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y");
- //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y");
- //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":""));
rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":""));
@@ -1750,7 +1706,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
if(chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) {
intervalFromdate = AppUtils.getRequestNvlValue(request, "intervalFromDate");
intervalTodate = AppUtils.getRequestNvlValue(request, "intervalToDate");
- intervalLabel = AppUtils.getRequestNvlValue(request, "intervalLabel");
+ intervalLabel = AppUtils.getRequestNvlValue(request, "intervalLabel");
displayIntervalInputInRunPage = AppUtils.getRequestNvlValue(request,"intervalInputInRunPage").equals("Y");
rdef.setIntervalFromdate(intervalFromdate+(displayIntervalInputInRunPage?"|Y":""));
rdef.setIntervalTodate(intervalTodate+(displayIntervalInputInRunPage?"|Y":""));
@@ -1758,7 +1714,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
}
if(chartType.equals(AppConstants.GT_STACKED_VERT_BAR) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES)
|| chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) {
- overLayItemLabel = AppUtils.getRequestNvlValue(request, "overlayItemValue");
+ overLayItemLabel = AppUtils.getRequestNvlValue(request, "overlayItemValue");
rdef.setOverlayItemValueOnStackBar(nvl(overLayItemLabel, "N"));
animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate");
rdef.setChartAnimate(animate);
@@ -1770,12 +1726,12 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setLegendPosition(AppUtils.getRequestNvlValue(request,"legendPosition"));
rdef.setMaxLabelsInDomainAxis(AppUtils.getRequestNvlValue(request,"maxLabelsInDomainAxis"));
String chartLegendDisplay = AppUtils.getRequestNvlValue(request,"hideLegend");
- boolean showLegendDisplayOptionsInRunPage = false;
+ boolean showLegendDisplayOptionsInRunPage = false;
showLegendDisplayOptionsInRunPage = AppUtils.getRequestNvlValue(request,"showLegendDisplayOptionsInRunPage").equals("Y");
rdef.setChartLegendDisplay(chartLegendDisplay+(showLegendDisplayOptionsInRunPage?"|Y":""));
rdef.setChartToolTips(AppUtils.getRequestNvlValue(request,"hideTooltips"));
rdef.setDomainAxisValuesAsString(AppUtils.getRequestNvlValue(request,"keepAsString"));
-
+
//System.out.println("KeepAsString " + AppUtils.getRequestNvlValue(request,"keepAsString"));
//System.out.println("From ReportDef " + rdef.keepDomainAxisValueInChartAsString());
// boolean reportUpdated = (!
@@ -1784,7 +1740,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setChartTypeFixed(nvl(chartTypeFixed, "N"));
if (nvl(leftAxisLabel).length()>0)
rdef.setChartLeftAxisLabel(leftAxisLabel);
- else
+ else
rdef.setChartLeftAxisLabel(null);
if (nvl(rightAxisLabel).length()>0)
rdef.setChartRightAxisLabel(rightAxisLabel);
@@ -1822,27 +1778,27 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
} // for
int idx = 1;
- List columns = rdef.getAllColumns();
+ List columns = rdef.getAllColumns();
if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup");
- String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
+ String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
-
+
String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
if(!drillDownReportId.equals("-1")) {
ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
false);
if (ddRr != null)
request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
-
- for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
FormField ff = ddRr.getReportFormFields().getNext();
- if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
cdf.setFormfield(value);
@@ -1850,46 +1806,46 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
}
}
}
-
+
} else {
if(chartType.equals(AppConstants.GT_BAR_3D)) {
String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup");
- String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
+ String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
rdef.setDrillReportIdForChart(drillDownReportId);
if(drillDownReportId.equals("-1")){
rdef.setDrillReportIdForChart("");
}
-
+
if(!drillDownReportId.equals("-1")) {
ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
false);
if (ddRr != null)
request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
-
- for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
FormField ff = ddRr.getReportFormFields().getNext();
- if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
cdf.setFormfield(value);
rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
}
}
-
+
String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield");
String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield");
String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield");
-
+
if(!xAxisFormField.equals("-1")){
rdef.setDrillXAxisFormField(xAxisFormField);
-
+
if(!yAxisFormField.equals("-1"))
rdef.setDrillYAxisFormField(yAxisFormField);
if(!seriesAxisFormField.equals("-1"))
@@ -1900,21 +1856,21 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setDrillSeriesFormField("");
}
}
-
+
} else if(chartType.equals(AppConstants.GT_SCATTER)) {
String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
-
+
}else if(chartType.equals(AppConstants.GT_REGRESSION)) {
String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
}else if(chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR)
|| chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) {
@@ -1922,66 +1878,66 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
}else if(chartType.equals(AppConstants.GT_LINE)) {
String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
} else if (chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) {
String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
} else if (chartType.equals(AppConstants.GT_COMPARE_PREVYEAR_CHART)) {
String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
//debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
- alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
}
} else {
if (rdef.hasSeriesColumn()) {
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
DataColumnType alldct = (DataColumnType) iterator.next();
- alldct.setChartSeries(false);
+ alldct.setChartSeries(false);
}
}
-
+
String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
rdef.setDrillReportIdForChart(drillDownReportId);
if(drillDownReportId.equals("-1")){
rdef.setDrillReportIdForChart("");
}
-
+
if(!drillDownReportId.equals("-1")) {
ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
false);
if (ddRr != null)
request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
- for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
FormField ff = ddRr.getReportFormFields().getNext();
- if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
cdf.setFormfield(value);
rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
}
}
-
+
String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield");
String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield");
String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield");
-
+
if(!xAxisFormField.equals("-1")){
rdef.setDrillXAxisFormField(xAxisFormField);
-
+
if(!yAxisFormField.equals("-1"))
rdef.setDrillYAxisFormField(yAxisFormField);
if(!seriesAxisFormField.equals("-1"))
@@ -1992,12 +1948,12 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
rdef.setDrillSeriesFormField("");
}
}
-
+
}
}
-
+
for (int i = 1; i < Math.max(valueColsCount, 1) + 1; i++) {
- //debugLogger.debug("********** " + chartSeries);
+ //debugLogger.debug("********** " + chartSeries);
if(i==1) {
/* Range Axis is resetted before adding */
for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
@@ -2011,7 +1967,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
dct.setYAxis(null);
}
}
-
+
}
String newChartColAxis = AppUtils.getRequestNvlValue(request, "newChart" + i+"Axis");
String valueColId = AppUtils.getRequestNvlValue(request, "valueCol" + i);
@@ -2024,7 +1980,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
yAxisGroup = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "YAxisLabel" + valueColId));
//debugLogger.debug("^^^^^^^^^^^^^^^^^Chart Group " + chartGroup);
//if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
- // debugLogger.debug("**********Outer If " + chartSeries);
+ // debugLogger.debug("**********Outer If " + chartSeries);
//}
if (valueColId.length() > 0 && (!valueColId.equals(removeColId))) {
@@ -2116,14 +2072,14 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
AppUtils.getRequestNvlValue(request, "formFields"));
reportSchedule.setAttachmentMode(
AppUtils.getRequestNvlValue(request, "sendAttachment"));
-
+
String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd");
String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole");
int flag = 0;
if ((!(userId.length()>0 || roleId.length()>0) && (reportSchedule.getEmailToUsers().isEmpty() && reportSchedule.getEmailToRoles().isEmpty())) ) {
flag = 1;
}
-
+
if (flag == 1 || (action.equals(AppConstants.WA_ADD_USER) || action.equals(AppConstants.WA_ADD_ROLE)) ) {
String loggedInUserId = AppUtils.getUserID(request);
if (Globals.getUseLoginIdInSchedYN().equals("Y")){
@@ -2152,7 +2108,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
reportSchedule.addEmailToUser(userId, userId);
}
}
-
+
} else if (action.equals(AppConstants.WA_DELETE_USER))
reportSchedule.removeEmailToUser(
AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
@@ -2164,10 +2120,10 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
} else if (action.equals(AppConstants.WA_DELETE_ROLE))
reportSchedule.removeEmailToRole(
AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
- request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
return true;
} // processAdhocSchedule
-
+
private boolean processSchedule(HttpServletRequest request, String action)
throws Exception {
// Added for form field chaining in schedule tab so that setParamValues() is called
@@ -2251,7 +2207,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String ownerID = AppUtils.getRequestNvlValue(request, "reportOwner");
String rPublic = nvl(AppUtils.getRequestValue(request, "public"), "N");
-
+
boolean reportUpdated = (!(ownerID.equals(nvl(rdef.getOwnerID())) && rPublic
.equals(rdef.isPublic() ? "Y" : "N")));
@@ -2306,8 +2262,8 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
return true;
} // processValidateSQL
-
-
+
+
/*****For Report Maps - Start******/
private boolean processMap(HttpServletRequest request, String action) throws Exception {
ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
@@ -2330,7 +2286,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
String height = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "height"));
String width = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "width"));
System.out.println(" #$%#$%#$% -- useDefaultSize="+ useDefaultSize+" height = " + height+" width="+width);
-
+
String addAddress = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addAddress"));
String latCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "latColumn"));
String longCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "longColumn"));
@@ -2355,7 +2311,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
repMap.setWidth(width.trim());
repMap.setLegendColumn(legendColumn);
//repMap.setLegendDisplayName(legendDisplayName);
-
+
Marker m = new ObjectFactory().createMarker();
m.setAddressColumn(addressColumn);
m.setDataColumn(dataColumn);
@@ -2380,10 +2336,10 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
}
}
}
-
+
return true;
} // processMap
/*****For Report Maps - End******/
-
+
} // WizardProcessor
diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java
index 1f68bda0..322e1b41 100644
--- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java
+++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java
@@ -283,8 +283,6 @@ public final class MusicSession implements Session, Serializable {
}
} catch (MusicLockingException e) {
logger.error(EELFLoggerDelegate.errorLogger, "isExpired locking failed with id:" + id, e);
- } catch (MusicServiceException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "isExpired failed with id:" + id, e);
}
return isExpired;
}
@@ -331,8 +329,6 @@ public final class MusicSession implements Session, Serializable {
MusicService.removeAttribute(attributeName, this.id);
}catch(MusicLockingException e){
logger.error(EELFLoggerDelegate.errorLogger, " removeAttribute locking failed id:" + this.id + " attribute name "+ attributeName , e);
- }catch(MusicServiceException e){
- logger.error(EELFLoggerDelegate.errorLogger, " removeAttribute failed id:" + this.id + " attribute name "+ attributeName , e);
}
}
diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
index 0e8551b9..167ed955 100644
--- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
+++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
@@ -80,8 +80,6 @@ public class MusicSessionRepositoryHandler {
MusicService.removeSession(id);
} catch (MusicLockingException e) {
logger.error(EELFLoggerDelegate.errorLogger, "removeSession locking failed with id " + id, e);
- } catch (MusicServiceException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "removeSession failed with id " + id, e);
}
}
}
diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java
index 3861b2dd..c8d15884 100644
--- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java
+++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java
@@ -80,9 +80,17 @@ public class MusicService {
private static String musicMetaTable = MusicProperties.getProperty(MusicProperties.MUSIC_SESSION_META_TABLES);
private static String musicAttrTable = MusicProperties.getProperty(MusicProperties.MUSIC_SESSION_ATTR_TABLES);
+ private static final String WITH_SESSION_ID = " with session id: ";
+ private static final String RESULT = "result:";
+ private static final String WHERE = " WHERE ";
+ private static final String FROM = " FROM ";
+ private static final String DELETE = "DELETE ";
+ private static final String REMOVE_SESSION = "removeSession: ";
+ private static final String SUCCESS = "success";
+
/**
* Store session attribute name and values into Cassandra via Music
- *
+ *
* @param attributeName
* @param value
* @param sessionId
@@ -116,18 +124,18 @@ public class MusicService {
else
result = MusicCore.eventualPut(queryObject);
logger.debug(EELFLoggerDelegate.debugLogger, "setAttribute: attributeName: " + attributeName
- + " with session id: " + sessionId + "result:" + result.getMessage());
+ + WITH_SESSION_ID + sessionId + RESULT + result.getMessage());
return result;
}
/**
* Store session meta data values into Cassandra via Music
- *
+ *
* @param session
* @return ReturnType that includes required body information for Music api
* @throws Exception
*/
- public static ReturnType setMetaAttribute(Session session) throws Exception {
+ public static ReturnType setMetaAttribute(Session session) throws MusicLockingException {
logger.debug(EELFLoggerDelegate.debugLogger, "setMetaAttribute: start with session id: " + session.getId());
ReturnType result = null;
PreparedQueryObject queryObject = new PreparedQueryObject();
@@ -148,14 +156,14 @@ public class MusicService {
else
result = MusicCore.eventualPut(queryObject);
logger.debug(EELFLoggerDelegate.debugLogger,
- "setMetaAttribute: with session id: " + session + "result:" + result.getMessage());
+ "setMetaAttribute: with session id: " + session + RESULT + result.getMessage());
return result;
}
/**
* Retrieve session meta data from Cassandra via Music
- *
+ *
* @param sessionId
* @return MusicSession
* @throws Exception
@@ -165,7 +173,7 @@ public class MusicService {
ResultSet result = null;
PreparedQueryObject queryObject = new PreparedQueryObject();
StringBuilder querySB = new StringBuilder();
- querySB.append("SELECT * FROM ").append(musicKeySpace).append(".").append(musicMetaTable).append(" WHERE ")
+ querySB.append("SELECT * FROM ").append(musicKeySpace).append(".").append(musicMetaTable).append(WHERE)
.append(MusicProperties.PRIMARY_ID).append("=?;");
queryObject.appendQueryString(querySB.toString());
queryObject.addValue(sessionId);
@@ -179,7 +187,7 @@ public class MusicService {
/**
* Get proper column names (from meta or attribute table) base on isMeta
- *
+ *
* @param isMeta
* @param attributeName
* @return String
@@ -199,7 +207,7 @@ public class MusicService {
/**
* Retrieve session attribute data from Cassandra via Music
- *
+ *
* @param attributeName
* @param sessionId
* @return attribute value with T type
@@ -212,8 +220,8 @@ public class MusicService {
boolean isMeta = MusicUtil.isSessionMetaAttr(attributeName);
PreparedQueryObject queryObject = new PreparedQueryObject();
StringBuilder querySB = new StringBuilder();
- querySB.append("SELECT ").append(getColumn(attributeName, isMeta)).append(" FROM ").append(musicKeySpace)
- .append(".").append(getTableName(isMeta)).append(" WHERE ").append(MusicProperties.PRIMARY_ID)
+ querySB.append("SELECT ").append(getColumn(attributeName, isMeta)).append(FROM).append(musicKeySpace)
+ .append(".").append(getTableName(isMeta)).append(WHERE).append(MusicProperties.PRIMARY_ID)
.append("= ?");
queryObject.addValue(sessionId);
@@ -235,22 +243,22 @@ public class MusicService {
/**
* Remove session attribute data from Cassandra via Music
- *
+ *
* @param attributeName
* @param sessionId
* @return ReturnType
* @throws MusicServiceException
- * @throws MusicLockingException
+ * @throws MusicLockingException
*/
- public static ReturnType removeAttribute(String attributeName, String sessionId) throws MusicServiceException, MusicLockingException {
+ public static ReturnType removeAttribute(String attributeName, String sessionId) throws MusicLockingException {
logger.debug(EELFLoggerDelegate.debugLogger, "removeAttribute: start with session id: " + sessionId);
boolean isMeta = MusicUtil.isSessionMetaAttr(attributeName);
ReturnType result = null;
String tableName = null;
PreparedQueryObject queryObject = new PreparedQueryObject();
StringBuilder querySB = new StringBuilder();
- querySB.append("DELETE ").append(getDelColumn(isMeta, attributeName)).append(" FROM ").append(musicKeySpace)
- .append(".").append(getTableName(isMeta)).append(" WHERE ").append(MusicProperties.PRIMARY_ID)
+ querySB.append(DELETE).append(getDelColumn(isMeta, attributeName)).append(FROM).append(musicKeySpace)
+ .append(".").append(getTableName(isMeta)).append(WHERE).append(MusicProperties.PRIMARY_ID)
.append("= ? ");
queryObject.addValue(sessionId);
@@ -266,40 +274,40 @@ public class MusicService {
else
result = MusicCore.eventualPut(queryObject);
logger.debug(EELFLoggerDelegate.debugLogger,
- "removeSession: " + attributeName + " with session id: " + sessionId + "result:" + result.getMessage());
+ REMOVE_SESSION + attributeName + WITH_SESSION_ID + sessionId + RESULT + result.getMessage());
return result;
}
/**
* Remove entire session from Cassandra via Music
- *
+ *
* @param sessionId
* @return ReturnType
* @throws MusicServiceException
- * @throws MusicLockingException
+ * @throws MusicLockingException
*/
- public static ReturnType removeSession(String sessionId) throws MusicServiceException, MusicLockingException {
+ public static ReturnType removeSession(String sessionId) throws MusicLockingException {
ReturnType result = null;
boolean isAtomic = isAtomicPut;
logger.debug(EELFLoggerDelegate.debugLogger, "removeSession: start with session id: " + sessionId);
PreparedQueryObject queryObject = new PreparedQueryObject();
StringBuilder querySB = new StringBuilder();
- querySB.append("DELETE ").append(" FROM ").append(musicKeySpace).append(".").append(musicMetaTable)
- .append(" WHERE ").append(MusicProperties.PRIMARY_ID).append("= ? ");
+ querySB.append(DELETE).append(FROM).append(musicKeySpace).append(".").append(musicMetaTable)
+ .append(WHERE).append(MusicProperties.PRIMARY_ID).append("= ? ");
queryObject.appendQueryString(querySB.toString());
queryObject.addValue(sessionId);
if (isAtomic)
result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, musicMetaTable, sessionId, queryObject, null);
else
result = MusicCore.eventualPut(queryObject);
- logger.debug(EELFLoggerDelegate.debugLogger, "removeSession: " + musicMetaTable + " with session id: "
- + sessionId + "result:" + result.getMessage());
+ logger.debug(EELFLoggerDelegate.debugLogger, REMOVE_SESSION + musicMetaTable + WITH_SESSION_ID
+ + sessionId + RESULT + result.getMessage());
queryObject = new PreparedQueryObject();
querySB = new StringBuilder();
- querySB.append("DELETE ").append(" FROM ").append(musicKeySpace).append(".").append(musicAttrTable)
- .append(" WHERE ").append(MusicProperties.PRIMARY_ID).append("= ? ");
+ querySB.append(DELETE).append(FROM).append(musicKeySpace).append(".").append(musicAttrTable)
+ .append(WHERE).append(MusicProperties.PRIMARY_ID).append("= ? ");
queryObject.appendQueryString(querySB.toString());
queryObject.addValue(sessionId);
if (isAtomic)
@@ -307,15 +315,15 @@ public class MusicService {
else
result = MusicCore.eventualPut(queryObject);
- logger.debug(EELFLoggerDelegate.debugLogger, "removeSession: " + musicAttrTable + " with session id: "
- + sessionId + "result:" + result.getMessage());
+ logger.debug(EELFLoggerDelegate.debugLogger, REMOVE_SESSION + musicAttrTable + WITH_SESSION_ID
+ + sessionId + RESULT + result.getMessage());
return result;
}
/**
* Get proper table name (Meta or Attribute) base on isMeta.
- *
+ *
* @param isMeta
* @return String
*/
@@ -330,7 +338,7 @@ public class MusicService {
/**
* Get proper column name (Meta or Attribute) base on isMeta.
- *
+ *
* @param attributeName
* @param isMeta
* @return String
@@ -346,7 +354,7 @@ public class MusicService {
/**
* Get proper column name (Meta or Attribute) base on isMeta for removing.
- *
+ *
* @param attributeName
* @param isMeta
* @return String
@@ -360,7 +368,7 @@ public class MusicService {
/**
* To set session attributes in Music
- *
+ *
* @param attributeName
* @param value
* @param session
@@ -374,22 +382,22 @@ public class MusicService {
String sessionId, String className, boolean isMeta) throws JsonProcessingException {
System.out.println("setAttribute: " + attributeName);
RestResponse<String> portalRestResponse = null;
- HttpEntity<Map<String, Object>> entity = new HttpEntity<Map<String, Object>>(
+ HttpEntity<Map<String, Object>> entity = new HttpEntity<>(
getMusicRestBody(attributeName, value, sessionId, session, className, isMeta), getMusicHeader());
String url = getInsertUrl(isMeta);
ResponseEntity<String> response = null;
try {
response = template.exchange(url, HttpMethod.POST, entity, String.class);
- portalRestResponse = new RestResponse<String>(RestStatusEnum.OK, "success", response.getBody());
+ portalRestResponse = new RestResponse<>(RestStatusEnum.OK, SUCCESS, response.getBody());
} catch (Exception e) {
- portalRestResponse = new RestResponse<String>(RestStatusEnum.ERROR, e.getMessage(), null);
+ portalRestResponse = new RestResponse<>(RestStatusEnum.ERROR, e.getMessage(), null);
}
return portalRestResponse;
}
/**
* To get session attribute in Music
- *
+ *
* @param attributeName
* @param value
* @param sessionId
@@ -401,23 +409,22 @@ public class MusicService {
boolean isMeta) {
System.out.println("getAttribute: " + attributeName);
RestResponse<String> portalRestResponse = null;
- HttpEntity<String> entity = new HttpEntity<String>(null, getMusicHeader());
+ HttpEntity<String> entity = new HttpEntity<>(null, getMusicHeader());
ResponseEntity<String> response = null;
String url = getSelectSessionIdUrl(attributeName, sessionId, isMeta);
try {
response = template.exchange(url, HttpMethod.GET, entity, String.class);
- portalRestResponse = new RestResponse<String>(RestStatusEnum.OK, "success", response.getBody());
+ portalRestResponse = new RestResponse<>(RestStatusEnum.OK, SUCCESS, response.getBody());
} catch (Exception e) {
- portalRestResponse = new RestResponse<String>(RestStatusEnum.ERROR, e.getMessage(), null);
+ portalRestResponse = new RestResponse<>(RestStatusEnum.ERROR, e.getMessage(), null);
}
return portalRestResponse;
}
/**
* To remove session attribute or session meta in Music
- *
+ *
* @param attributeName
- * @param value
* @param sessionId
* @param isMeta
* @return RestResponse<String>
@@ -428,20 +435,18 @@ public class MusicService {
ResponseEntity<String> response = null;
String url = getSelectSessionIdUrl(attributeName, sessionId, true);
try {
- response = template.exchange(url, HttpMethod.DELETE, entity, String.class);
- portalRestResponse = new RestResponse<String>(RestStatusEnum.OK, "success", response.getBody());
url = getSelectSessionIdUrl(attributeName, sessionId, false);
response = template.exchange(url, HttpMethod.DELETE, entity, String.class);
- portalRestResponse = new RestResponse<String>(RestStatusEnum.OK, "success", response.getBody());
+ portalRestResponse = new RestResponse<>(RestStatusEnum.OK, SUCCESS, response.getBody());
} catch (Exception e) {
- portalRestResponse = new RestResponse<String>(RestStatusEnum.ERROR, e.getMessage(), null);
+ portalRestResponse = new RestResponse<>(RestStatusEnum.ERROR, e.getMessage(), null);
}
return portalRestResponse;
}
/**
* Generate body for Music api calls
- *
+ *
* @return String that includes required body information for Music api
* calls
* @throws JsonProcessingException
@@ -475,7 +480,7 @@ public class MusicService {
/**
* Generate body for Music delete api calls
- *
+ *
* @return String that includes required body information for Music api
* calls
* @throws JsonProcessingException
@@ -512,7 +517,7 @@ public class MusicService {
/**
* Generate header for Music api calls
- *
+ *
* @return header that contains required header information for Music api
* calls
*/
@@ -529,7 +534,7 @@ public class MusicService {
/**
* Construct URL for Music api calls
- *
+ *
* @return path
*/
private static String constructPath(boolean isMeta) {
@@ -545,10 +550,10 @@ public class MusicService {
path.append("/");
return path.toString();
}
-
+
/**
* Get a list of sessions that need to be cleaned up
- *
+ *
* @return List<String>
*/
private static List<String> getSessionToBeDeleted(){
@@ -559,15 +564,15 @@ public class MusicService {
List<String> sessionIDList = new ArrayList<>();
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
StringBuilder querySB = new StringBuilder();
- String cleanUpThreshold = MusicProperties.getProperty(MusicProperties.MUSIC_CLEAN_UP_THRESHOLD); //Clean up sessions that's cleanUpThreshold hours ago
- Date dateForCleanup = new Date(System.currentTimeMillis() - 3600 * 1000 * Integer.valueOf(cleanUpThreshold)); // Get the threshold date that needs to be clean up
+ String cleanUpThreshold = MusicProperties.getProperty(MusicProperties.MUSIC_CLEAN_UP_THRESHOLD); //Clean up sessions that's cleanUpThreshold hours ago
+ Date dateForCleanup = new Date(System.currentTimeMillis() - 3600 * 1000 * Integer.valueOf(cleanUpThreshold)); // Get the threshold date that needs to be clean up
String dateForCleanupCondition = dateFormat.format(dateForCleanup);
- querySB.append("SELECT ").append(MusicProperties.PRIMARY_ID).append(" FROM ").append(musicKeySpace)
- .append(".").append(getTableName(true)).append(" WHERE ").append(MusicProperties.LAST_ACCESS_TIME)
+ querySB.append("SELECT ").append(MusicProperties.PRIMARY_ID).append(FROM).append(musicKeySpace)
+ .append(".").append(getTableName(true)).append(WHERE).append(MusicProperties.LAST_ACCESS_TIME)
.append("< ? ").append(" ALLOW FILTERING");
queryObject.appendQueryString(querySB.toString());
queryObject.addValue(dateForCleanupCondition);
-
+
try{
if (isAtomicGet)
result = MusicCore.atomicGetWithDeleteLock(musicKeySpace, musicMetaTable, null, queryObject);
@@ -583,10 +588,10 @@ public class MusicService {
}
return sessionIDList;
}
-
+
/**
* Remove session data in music base on the defined frequency
- *
+ *
* @return List<String>
*/
public static void cleanUpMusic() {
@@ -605,13 +610,13 @@ public class MusicService {
sessionIDListCondition.deleteCharAt(sessionIDListCondition.length()-1);
sessionIDListCondition.deleteCharAt(sessionIDListCondition.length()-1);
sessionIDListCondition.append(")");
- StringBuilder querySB = new StringBuilder();
+ StringBuilder querySB = new StringBuilder();
PreparedQueryObject queryObject = new PreparedQueryObject();
/**Deleting attributes table**/
querySB = new StringBuilder();
queryObject = new PreparedQueryObject();
querySB.append("DELETE FROM ").append(musicKeySpace)
- .append(".").append(getTableName(false)).append(" WHERE ").append(MusicProperties.PRIMARY_ID)
+ .append(".").append(getTableName(false)).append(WHERE).append(MusicProperties.PRIMARY_ID)
.append(" in ").append(sessionIDListCondition);
queryObject.appendQueryString(querySB.toString());
try{
@@ -623,13 +628,13 @@ public class MusicService {
logger.error(EELFLoggerDelegate.errorLogger, "Error while cleaning up music attributes tables" , e);
}
logger.debug(EELFLoggerDelegate.debugLogger, "Music sessions have been cleaned up !");
-
+
/**Deleting meta table**/
logger.debug(EELFLoggerDelegate.debugLogger, "Cleaning up meta table ...");
querySB = new StringBuilder();
queryObject = new PreparedQueryObject();
querySB.append("DELETE FROM ").append(musicKeySpace)
- .append(".").append(getTableName(true)).append(" WHERE ").append(MusicProperties.PRIMARY_ID)
+ .append(".").append(getTableName(true)).append(WHERE).append(MusicProperties.PRIMARY_ID)
.append(" in ").append(sessionIDListCondition);
queryObject.appendQueryString(querySB.toString());
try{
@@ -640,13 +645,13 @@ public class MusicService {
}catch(Exception e){
logger.error(EELFLoggerDelegate.errorLogger, "Error while cleaning up music meta tables" , e);
}
-
+
logger.debug(EELFLoggerDelegate.debugLogger, "Cleaned up attributes table ... ");
}else{
logger.debug(EELFLoggerDelegate.debugLogger, "No Session needs to be cleaned up");
}
-
- }
+
+ }
}
}
diff --git a/ecomp-sdk/epsdk-music/src/test/java/org/onap/portalapp/music/conf/MusicSessionTest.java b/ecomp-sdk/epsdk-music/src/test/java/org/onap/portalapp/music/conf/MusicSessionTest.java
index 65290d48..fab1ba7b 100644
--- a/ecomp-sdk/epsdk-music/src/test/java/org/onap/portalapp/music/conf/MusicSessionTest.java
+++ b/ecomp-sdk/epsdk-music/src/test/java/org/onap/portalapp/music/conf/MusicSessionTest.java
@@ -233,14 +233,7 @@ public class MusicSessionTest {
}
@Test
- public void removeAttributeMusicServiceExceptionTest() throws MusicServiceException, MusicLockingException {
- Mockito.when(MusicService.removeAttribute(Matchers.anyString(), Matchers.anyString()))
- .thenThrow(new MusicServiceException());
- musicSession.removeAttribute("test_attr_name");
- }
-
- @Test
- public void removeAttributeMusicLockingExceptionTest() throws MusicServiceException, MusicLockingException {
+ public void removeAttributeMusicLockingExceptionTest() throws MusicLockingException {
Mockito.when(MusicService.removeAttribute(Matchers.anyString(), Matchers.anyString()))
.thenThrow(new MusicLockingException());
musicSession.removeAttribute("test_attr_name");