diff options
author | 2018-07-25 16:13:16 -0400 | |
---|---|---|
committer | 2018-07-25 16:13:56 -0400 | |
commit | 40a17c1d7e5f0edca350a49210e16223a875d290 (patch) | |
tree | ad3a6b61fe17444dde4bf88f4dfd1cba2636f065 /ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java | |
parent | 39191aaa6cf9f9d164c995e580c7df418b59b5c9 (diff) |
Reporting Enhancements
Issue-ID: PORTAL-314
Remote DB logic is added to enhance RAPTOR to pull content from different DB as well as Different DB TYPE
Change-Id: I5cb343cd9daa912d78e7a8e409d28c8845d9afb4
Signed-off-by: RAMALINGAM, SUNDAR (sr7234) <sr7234@us.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java index e06a1765..c761bdcc 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java @@ -96,6 +96,7 @@ import org.onap.portalsdk.analytics.model.runtime.ReportFormFields; import org.onap.portalsdk.analytics.model.runtime.ReportRuntime; import org.onap.portalsdk.analytics.system.AppUtils; import org.onap.portalsdk.analytics.system.ConnectionUtils; +import org.onap.portalsdk.analytics.system.DbUtils; import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.AppConstants; import org.onap.portalsdk.analytics.util.DataSet; @@ -711,6 +712,24 @@ public class RaptorControllerAsync extends RestrictedBaseController { // } if (rdef != null) { + String dbInfo = definitionJSON.getDbInfo(); + rdef.setDBInfo(dbInfo); + //save dbType + String schemaSql = Globals.getRemoteDbSchemaSqlWithWhereClause(); + schemaSql = schemaSql.replace("[schema_id]", dbInfo); + String dbType = null; + 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) {} + rdef.setDBType(dbType); String reportName = definitionJSON.getReportName(); String errorString = ""; if (AppUtils.nvl(reportName).length() <= 0) @@ -1358,6 +1377,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { if (pathVariables.containsKey("id")) { id = pathVariables.get("id"); } + String detailId = ""; if (pathVariables.containsKey("detailId")) { detailId = pathVariables.get("detailId"); @@ -1467,6 +1487,26 @@ public class RaptorControllerAsync extends RestrictedBaseController { wizardJSON.setReportTitle((rdef != null) ? rdef.getReportTitle() : ""); wizardJSON.setReportSubTitle((rdef != null) ? rdef.getReportSubTitle() : ""); + + String schemaSql = Globals.getRemoteDbSchemaSql(); + DataSet ds = null; + ArrayList<IdNameBooleanJSON> dbInfoList = new ArrayList<IdNameBooleanJSON>(); + try { + ds = DbUtils.executeQuery(schemaSql); + + String prefix = "", desc = ""; + + for (int i = 0; i < ds.getRowCount(); i++) { + IdNameBooleanJSON dBNameJSON = new IdNameBooleanJSON(); + dBNameJSON.setId(ds.getItem(i, 0)); + dBNameJSON.setName(ds.getItem(i, 0)); + dBNameJSON.setSelected(false); + dbInfoList.add(dBNameJSON); + } + } + catch (Exception e) {} + wizardJSON.setDbInfoList(dbInfoList); + /*Robert add*/ wizardJSON.setOneTimeRec((rdef != null) ? rdef.getIsOneTimeScheduleAllowed() : "false"); wizardJSON.setHourlyRec((rdef != null) ? rdef.getIsHourlyScheduleAllowed() : "false"); @@ -1572,7 +1612,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { try { response.setContentType("application/json"); - ds = ConnectionUtils.getDataSet(sql, "local", true); + ds = ConnectionUtils.getDataSet(sql, rdef.getDBInfo(), true); QueryResultJSON queryResultJSON = new QueryResultJSON(); queryResultJSON.setQuery(queryJSON.getQuery()); |