summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-05-21 18:10:01 +0530
committerIndrijeet kumar <indriku1@in.ibm.com>2020-05-21 18:10:08 +0530
commit530e1e32ad7464ec002baf3804d37aa8dbc6478b (patch)
tree0324191859caef81cda70fb7af4dfaafd48b068c
parent2053ff0eaa2e4d1efcdb56a953af7c631757369e (diff)
lowered some code smells in a few components
lowered some code smells in a few components Issue-ID: PORTAL-813 Change-Id: I64eeead6f562daaeee01392eb57696d5724f1ff6 Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java45
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java2
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogJob.java3
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java8
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java4
5 files changed, 5 insertions, 57 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java
index fd87f4cb..a0c35e0c 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java
@@ -157,11 +157,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
r++;
} // for
-/* for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
- DataRow dr = reportDataRows.getNext();
- dr.addDataValue(colIdx, new DataValue());
- } // for
- */
for(int j = 0; j < dataList.size(); j++) {
DataRow dr = (DataRow) dataList.get(j);
dr.addDataValue(colIdx, new DataValue());
@@ -183,11 +178,9 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
try {
boolean nameFound = false;
- // String prevColName = null;
Vector prevColNames = new Vector();
int columnSort = -1;
for (int r = 0; r < colNameValues.size(); r++) {
- //String colName = (String) colNameValues.get(r);
String colName = ((DataValue) colNameValues.get(r)).getDisplayValue();
Integer colSortName = null;
if(colNameSortValues!=null)
@@ -266,9 +259,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
for (c = 0; c < getDataColumnCount(); c++) {
dr.addDataValue(new DataValue());
}
-
- //reportDataRows.addDataRow(rowIdx, dr);
- //dr.setRowNum(dataList.size()==0?1:dataList.size());
dataList.add(rowIdx, dr);
} // insertRow
@@ -288,7 +278,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
boolean nameFound = false;
Vector prevRowNames = new Vector();
for (int c = 0; c < rowNameValues.size(); c++) {
- //String rowName = (String) rowNameValues.get(c);
String rowName = ((DataValue) rowNameValues.get(c)).getDisplayValue();
RowHeaderCol rhc = reportRowHeaderCols.getRowHeaderCol(c);
@@ -341,7 +330,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
int colIdx = findColumnIdx(colNameValues, colNameSortValues, crossTabOrderManager, true, dataList);
if ((rowIdx >= 0) && (colIdx >= 0)) {
- //DataRow dr = reportDataRows.getDataRow(rowIdx);
DataRow dr = (DataRow)dataList.get(rowIdx);
dr.setRowValues(rowNameValues);
dr.setDataValue(colIdx, value);
@@ -435,11 +423,9 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
public void addRowNumbers(int pageNo, List dataList) {
pageNo = 0;
- //int startRowNum = ((pageNo < 0) ? 0 : pageNo) * pageSize + 1;
int startRowNum = 0;
RowHeaderCol rhc = new RowHeaderCol();
reportRowHeaderCols.addRowHeaderCol(0, rhc);
- //rhc.setColumnWidth("5%");
for (int r = 0; r < dataList.size(); r++) {
rhc.add(new RowHeader(startRowNum + r+""));
((DataRow)dataList.get(r)).setRowNum(r);
@@ -477,17 +463,13 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
reportColumnHeaderRows.addColumnHeaderRow(chr);
chr.setRowHeight("30");
} // if
- /*ColumnHeader ch = new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
- + displayWidth + "%"), alignment, 1, isRuntimeColSortDisabled ? null : colId);
- */
+
ColumnHeader ch = new ColumnHeader(displayName, displayWidthInPxls, alignment, 1, isRuntimeColSortDisabled ? null : colId);
ch.setGroupLevel(level);
ch.setStartGroup(start);
ch.setColSpanGroup(colspan);
ch.setColId(colId);
ch.setSortable(sortable);
- //chr.addColumnHeader(new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
- // + displayWidth + "%"), 1, isRuntimeColSortDisabled ? null : colId));
if (displayName != "Hidden") {
@@ -529,7 +511,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
} // for
int row = 0;
for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
- //reportDataRows.getNext().getDataValue(colIdx).setVisible(newVisible);
DataRow dr = reportDataRows.getNext();
if(colIdx < dr.getDataValueList().size()) {
DataValue dv = dr.getDataValue(colIdx);
@@ -718,25 +699,16 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
DataValue dataValue = new DataValue();
String totalValue = tVal.getTotalValue();
- // if(colDisplayTotal.length()>0&&(!
- // colDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
- // totalValue =
- // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(colDisplayTotal))+":
- // "+totalValue;
dataValue.setDisplayValue(totalValue);
//added below statement for displaying in excel as number
dataValue.setDisplayTotal("SUM(");
dataValue.setAlignment(totalsAlignment);
dataValue.setBold(true);
totalsDataRow.setDataValue(colIdx, dataValue);
-
- //totalsDataRow.addDataValue(dataValue);
} // if
} // for
- //reportDataRows.addDataRow(totalsDataRow);
- //dr.setRowValues(rowNameValues);
Vector rowNameValues = new Vector();
for (int i=0; i < reportRowHeaderCols.size(); i++) {
if(i==0) {
@@ -745,9 +717,7 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
dataValue.setAlignment("center");
dataValue.setDisplayValue("Total");
rowNameValues.add(dataValue);
- //rowNameValues.add("Total");
} else {
- //rowNameValues.add("");
DataValue dataValue = new DataValue();
dataValue.setDisplayValue("");
rowNameValues.add(dataValue);
@@ -757,7 +727,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
totalsDataRow.setRowValues(rowNameValues);
totalsDataRow.setRowNum(dataList.size());
dataList.add(totalsDataRow);
- //reportRowHeaderCols.getNext().addRowHeader(new RowHeader("", "30", 1, 0));
} // setColumnDataTotalsCrossTab
public void setRowDataTotalsCrossTab(Vector rowDataTotals, String totalsAlignment,
@@ -792,11 +761,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
DataValue dataValue = new DataValue();
String totalValue = tVal.getTotalValue();
- // if(rowDisplayTotal.length()>0&&(!
- // rowDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
- // totalValue =
- // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(rowDisplayTotal))+":
- // "+totalValue;
dataValue.setDisplayValue(totalValue);
//added below statement for displaying in excel as number
dataValue.setDisplayTotal("SUM(");
@@ -813,20 +777,13 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
String displayTotal, List dataList) {
DataValue dataValue = new DataValue();
- // if(displayTotal.length()>0&&(!
- // displayTotal.equals(AppConstants.TOTAL_SUM_ID)))
- // totalValue =
- // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(displayTotal))+":
- // "+totalValue;
dataValue.setDisplayValue(totalValue);
//added below statement for displaying in excel as number
dataValue.setDisplayTotal("SUM(");
dataValue.setAlignment(totalAlignment);
dataValue.setBold(true);
- //int colIdx = getDataColumnCount() - 1;
int rowIdx = getDataRowCount() - 1;
- //reportDataRows.getDataRow(rowIdx).getDataValueList().add(colIdx, dataValue);
DataRow dr = (DataRow)dataList.get(rowIdx);
dr.addDataValue(dr.getDataValueList().size(), dataValue);
} // setGrandTotalCrossTab
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
index d04acc8d..83962c63 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
@@ -218,7 +218,7 @@ public class SingleSignOnController extends UnRestrictedBaseController {
final String redirectUrl = portalUrl + "?uebAppKey=" + uebAppKey + "&redirectUrl=" + encodedReturnToAppUrl;
logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: portal-bound redirect URL is {}",
redirectUrl);
- // this line may not be necessary but jsessionid coockie is not getting created in all cases;
+ // this line may not be necessary but jsessionid coockie is not getting created in all cases
// so force the cookie creation
request.getSession(true);
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogJob.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogJob.java
index f71d41c5..40306a4d 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogJob.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogJob.java
@@ -53,9 +53,6 @@ public class LogJob extends QuartzJobBean {
@Override
protected void executeInternal(JobExecutionContext ctx)
throws JobExecutionException {
- // JobDataMap dataMap = ctx.getJobDetail().getJobDataMap();
- //int cnt = dataMap.getInt("");
- // JobKey jobKey = ctx.getJobDetail().getKey();
logger.info(EELFLoggerDelegate.debugLogger, (Runtime.getRuntime().maxMemory() + " " + Runtime.getRuntime().maxMemory()));
}
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
index ae131a05..2b75aea1 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
@@ -306,7 +306,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR
// response yet ..
// commenting throw clauses until portal is ready
// throw new PortalAPIException("User + " + loginId + " doesn't
- // exist");
+ // exist")
} else
return UserUtils.convertToEcompUser(user);
} catch (Exception e) {
@@ -315,7 +315,6 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR
return null;
// Unfortunately, Portal is not ready to accept proper error response
// yet .. commenting throw clauses until portal is ready
- // throw new PortalAPIException(response, e);
}
}
@@ -388,11 +387,6 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR
logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}, roles Json {}", loginId,
rolesJson);
User user = userProfileService.getUserByLoginId(loginId);
- /*
- * List<EcompRole> ecompRoles = mapper.readValue(rolesJson,
- * TypeFactory.defaultInstance().constructCollectionType(List.class,
- * EcompRole.class));
- */
SortedSet<Role> roles = new TreeSet<>();
for (EcompRole role : rolesJson) {
roles.add(roleService.getRole(loginId,role.getId()));
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java
index b126d822..8aea7e10 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java
@@ -69,8 +69,8 @@ public class ElementMapService {
private static HashMap<String, Domain> domainMap = new HashMap<>();
private static String filePath = SystemProperties.getProperty("element_map_file_path");
- private static String networkToscaYml = null;// "NetworkMap_topology_composition.yml";
- private static String networkLayoutYml = null;// "network_map_layout.yml";
+ private static String networkToscaYml = null;// NetworkMap_topology_composition.yml
+ private static String networkLayoutYml = null;// network_map_layout.yml
/**
*