summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java113
1 files changed, 28 insertions, 85 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
index a1196808..6718e427 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
@@ -97,11 +97,10 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
private static Scheduler scheduler = null;
// System type constants
- public final static String ST_FUSION = "fusion";
- public final static String ST_GENERIC = "generic";
+ public static final String ST_GENERIC = "generic";
- public final static String ST_PRISMS = "prisms";
+ public static final String ST_PRISMS = "prisms";
private static String systemType = ST_PRISMS; // default
@@ -126,7 +125,11 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
private static String baseTitle = "ANALYSIS";
- private static String sheet_name = "Raptor Reports";
+ private static String sheetName = "Raptor Reports";
+
+ private static final String ANALYTIC_SYSTEM = "org.onap.portalsdk.analytics.system.";
+
+ private static final String NOT_INITIALIZED = "[SYSTEM ERROR] Globals not initialized";
private static boolean allowSQLBasedReports = true; // whether to allow
// SQL-based report
@@ -271,14 +274,6 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
private static String javaTimeFormat = "MM/dd/yyyy h:m:s a";
- private static String oracleTimeFormat = "%m/%d/%Y %h:%i:%s %p"; // must
- // correspond
- // to
- // the
- // java
- // format
- // modifier
-
private static String raptorVersion = "10.5.1";
private static int flatFileLowerLimit = 0;
@@ -293,9 +288,9 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
private static String sessionParams = "";
- private static boolean displayAllUsers = true;
+ private static boolean displayAllUsers = true;
- private static boolean user_col_def = true;
+ private static boolean userColDef = true;
private static boolean printFooterInDownload = true;
@@ -347,25 +342,24 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
} catch (Exception e) {
logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Globals: Unable to load properties ["
+ ConfigLoader.RAPTOR_PROPERTIES + "]. Exception: " + e.getMessage()));
- // throw new RuntimeException(e.getMessage());
}
systemInitialized = true;
try {
appUtils = (IAppUtils) Class.forName(
- "org.onap.portalsdk.analytics.system." + systemType.toLowerCase() + ".AppUtils")
+ ANALYTIC_SYSTEM + systemType.toLowerCase() + ".AppUtils")
.newInstance();
appUtils.initializeAppUtils(servletContext);
dbUtils = (IDbUtils) Class.forName(
- "org.onap.portalsdk.analytics.system." + systemType.toLowerCase() + ".DbUtils")
+ ANALYTIC_SYSTEM + systemType.toLowerCase() + ".DbUtils")
.newInstance();
dbUtils.initializeDbUtils(servletContext);
if(!Globals.getSystemType().equals(Globals.ST_GENERIC)) {
rdbUtils = (RDbUtils) Class.forName(
- "org.onap.portalsdk.analytics.system." + systemType.toLowerCase() + ".RemoteDbUtils")
+ ANALYTIC_SYSTEM + systemType.toLowerCase() + ".RemoteDbUtils")
.newInstance();
rdbUtils.initializeDbUtils(servletContext);
}
@@ -387,35 +381,6 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
throw new RuntimeException(eMsg);
} // catch
- /*try {
- //DataSet ds = DbUtils
- // .executeQuery("SELECT 1 FROM dual WHERE EXISTS (SELECT 1 FROM cr_table_role)");
-
- String p_sql = Globals.getInitializeRoles();
- DataSet ds = DbUtils.executeQuery(p_sql);
-
- restrictTablesByRole = (ds.getRowCount() > 0);
- } catch (Exception e) {
- String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor version. Exception: "
- + e.getMessage();
- debugLogger.error("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg, e);
- } // catch
- */
- /*try {
- //DataSet ds = DbUtils.executeQuery("SELECT cr_raptor.get_version FROM dual");
-
- //String n_sql = Globals.getInitializeVersion();
- //DataSet ds = DbUtils.executeQuery(n_sql);
- //raptorVersion = Globals.get
- // if(ds.getRowCount()>0)
- // raptorVersion = " v"+ds.getString(0, 0);
- } catch (Exception e) {
- String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor version. Exception: "
- + e.getMessage();
- debugLogger.error("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg, e);
- } // catch*/
-
-
//initiate pdf global config
try {
raptorPdfProperties = ConfigLoader.getProperties(servletContext, ConfigLoader.RAPTOR_PDF_PROPERTIES);
@@ -522,9 +487,6 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
.toUpperCase().startsWith("Y");
showDescrAtRuntime = nvls(raptorProperties.getProperty("show_descr_at_runtime"),
"no").toUpperCase().startsWith("Y");
- // skipChartLabelsToFit =
- // nvls(raptorProperties.getProperty("skip_chart_labels_to_fit"),
- // "no" ).toUpperCase().startsWith("Y");
showNonstandardCharts = nvls(
raptorProperties.getProperty("show_nonstandard_charts"), "no")
.toUpperCase().startsWith("Y");
@@ -539,21 +501,13 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
displayChartByDefault = nvls(
raptorProperties.getProperty("display_chart_by_default"), "yes")
.toUpperCase().startsWith("Y");
- //System.out.println("Params Globals " + raptorProperties.getProperty("print_params_in_download"));
printParamsInDownload = nvls(
raptorProperties.getProperty("print_params_in_download"), "no")
.toUpperCase().startsWith("Y");
- //System.out.println("printParamsInDownload " + printParamsInDownload);
canCopyOnReadOnly = nvls(raptorProperties.getProperty("can_copy_on_read_only"),
"yes").toUpperCase().startsWith("Y");
- // chartLinesAlwaysSolid =
- // nvls(raptorProperties.getProperty("chart_lines_always_solid"),
- // "yes").toUpperCase().startsWith("Y");
- // chartLinesAlwaysSmooth =
- // nvls(raptorProperties.getProperty("chart_lines_always_smooth"),
- // "yes").toUpperCase().startsWith("Y");
displayAllUsers = nvls(
raptorProperties.getProperty("display_all_users"), "yes")
.toUpperCase().startsWith("Y");
@@ -561,10 +515,10 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
raptorProperties.getProperty("request_get_params"), "");
sessionParams = nvls(
raptorProperties.getProperty("session_params"), "");
- user_col_def = nvls(
+ userColDef = nvls(
raptorProperties.getProperty("user_col_def"), "no")
.toUpperCase().startsWith("Y");
- sheet_name = nvls(raptorProperties.getProperty("sheet_name"), "Raptor Reports");
+ sheetName = nvls(raptorProperties.getProperty("sheet_name"), "Raptor Reports");
try {
flatFileLowerLimit = Integer.parseInt(raptorProperties
.getProperty("flat_file_lower_limit"));
@@ -576,7 +530,6 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
} catch (NumberFormatException nfe) {
}
shellScriptDir = nvls(raptorProperties.getProperty("shell_script_dir"), "");
- //queryFolder = nvls(raptorProperties.getProperty("download_query_folder"), AppUtils.getTempFolderPath()+"../raptor/dwnld/query/");
queryFolder = nvls(raptorProperties.getProperty("download_query_folder"),"../raptor/dwnld/query/");
@@ -604,35 +557,35 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
public static ActionMapping getRaptorActionMapping() {
if (!systemInitialized)
- throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+ throw new IllegalStateException(NOT_INITIALIZED);
return raptorActionMapping;
} // getRaptorActionMapping
public static String getSystemType() {
if (!systemInitialized)
- throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+ throw new IllegalStateException(NOT_INITIALIZED);
return systemType;
} // getSystemType
public static IAppUtils getAppUtils() {
if (!systemInitialized)
- throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+ throw new IllegalStateException(NOT_INITIALIZED);
return appUtils;
} // getAppUtils
public static IDbUtils getDbUtils() {
if (!systemInitialized)
- throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+ throw new IllegalStateException(NOT_INITIALIZED);
return dbUtils;
} // getDbUtils
public static RDbUtils getRDbUtils() {
if (!systemInitialized)
- throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+ throw new IllegalStateException(NOT_INITIALIZED);
return rdbUtils;
} // getDbUtils
@@ -647,7 +600,8 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
}
public static int getCSVDownloadLimit() {
- return Integer.parseInt(nvls(raptorProperties.getProperty("csv_download_limit"), new Integer(getDownloadLimit()).toString()).trim());
+ return Integer.parseInt(nvls(raptorProperties.getProperty("csv_download_limit"),
+ Integer.toString(getDownloadLimit())));
}
public static String getDownloadLimitAsText() {
@@ -723,8 +677,6 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
return showDescrAtRuntime;
}
- // public static boolean getSkipChartLabelsToFit() { return
- // skipChartLabelsToFit; }
public static boolean getShowNonstandardCharts() {
return showNonstandardCharts;
}
@@ -753,10 +705,6 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
return canCopyOnReadOnly;
}
- // public static boolean getChartLinesAlwaysSolid() { return
- // chartLinesAlwaysSolid; }
- // public static boolean getChartLinesAlwaysSmooth() { return
- // chartLinesAlwaysSmooth; }
public static int getMaxDecimalsOnTotals() {
return maxDecimalsOnTotals;
}
@@ -781,11 +729,6 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
return javaTimeFormat;
}
-/* public static String getOracleTimeFormat() {
- return oracleTimeFormat;
- }
-*/
-
public static String getRaptorVersion() {
return raptorVersion;
}
@@ -794,13 +737,13 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
return displayAllUsers;
}
- public static boolean getUserColDef() {
- return user_col_def;
- }
-
- public static String getSheetName() {
- return sheet_name;
- }
+ public static boolean getUserColDef() {
+ return userColDef;
+ }
+
+ public static String getSheetName() {
+return sheetName;
+}
public static int getFlatFileLowerLimit() {
return flatFileLowerLimit;