diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-05-07 08:49:13 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-05-07 08:49:57 +0530 |
commit | 1c6c6e4a8a1004c2086ca66dc13e8205f7492fee (patch) | |
tree | adaa73692f930155a6f6bc25c39a7bb0d2a73025 /ecomp-sdk/epsdk-analytics/src | |
parent | 8c18951c83e82faff1ce0051a5af320a91402c8e (diff) |
removed some code smells
removed some code smells
Issue-ID: PORTAL-813
Change-Id: I936676da6411bcb84ed61a646664f6df23aa2601
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src')
6 files changed, 35 insertions, 35 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java index 558f5f71..b6f944a7 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java @@ -2684,12 +2684,12 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep reportJSONRuntime.setHideFormFieldsAfterRun(isHideFormFieldAfterRun()); reportJSONRuntime.setDisplayExcel(!isDisplayOptionHideExcelIcons()); reportJSONRuntime.setDisplayPDF(!isDisplayOptionHidePDFIcons()); - ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); - ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>(); + ArrayList<IdNameValue> formFieldValues = new ArrayList<>(); + ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<>(); if(getReportFormFields()!=null) { - formFieldJSONList = new ArrayList<FormFieldJSON>(getReportFormFields().size()); + formFieldJSONList = new ArrayList<>(getReportFormFields().size()); for (Iterator iter = getReportFormFields().iterator(); iter.hasNext();) { - formFieldValues = new ArrayList<IdNameValue>(); + formFieldValues = new ArrayList<>(); FormField ff = (FormField) iter.next(); ff.setDbInfo(getDbInfo()); FormFieldJSON ffJSON = new FormFieldJSON(); @@ -2789,8 +2789,8 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep if(rd!=null) { count = 0; reportJSONRuntime.setTotalRows(getReportDataSize()); - ArrayList<ColumnHeader> colList = new ArrayList<ColumnHeader>(); - ArrayList<Map<String,Object>> reportDataRows = new ArrayList<Map<String,Object>>(); + ArrayList<ColumnHeader> colList = new ArrayList<>(); + ArrayList<Map<String,Object>> reportDataRows = new ArrayList<>(); for(rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext(); ) { count++; ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext(); @@ -2801,7 +2801,7 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep if(getReportDataSize() > 0) { count = 0; for(rd.reportDataRows.resetNext(); rd.reportDataRows.hasNext(); count++) { - dvJSON = new HashMap<String,Object>(); + dvJSON = new HashMap<>(); DataRow dr = rd.reportDataRows.getNext(); for(dr.resetNext(); dr.hasNext(); ) { DataValue dv = dr.getNext(); @@ -2840,12 +2840,12 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep reportJSONRuntime.setReportSubTitle(getReportSubTitle()); reportJSONRuntime.setAllowEdit(isAllowEdit(request)); reportJSONRuntime.setNumFormCols(getNumFormColsAsInt()); - ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); - ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>(); + ArrayList<IdNameValue> formFieldValues = new ArrayList<>(); + ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<>(); if(reportFormFields!=null) { - formFieldJSONList = new ArrayList<FormFieldJSON>(reportFormFields.size()); + formFieldJSONList = new ArrayList<>(reportFormFields.size()); for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { - formFieldValues = new ArrayList<IdNameValue>(); + formFieldValues = new ArrayList<>(); FormField ff = (FormField) iter.next(); FormFieldJSON ffJSON = new FormFieldJSON(); ffJSON.setFieldId(ff.getFieldName()); @@ -2858,7 +2858,7 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep formFieldJSONList.add(ffJSON); } for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { - formFieldValues = new ArrayList<IdNameValue>(); + formFieldValues = new ArrayList<>(); FormField ff = (FormField) iter.next(); ff.setDbInfo(getDbInfo()); for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { @@ -2895,7 +2895,7 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep lookup.trimToSize(); String requestValue = request.getParameter(ff.getFieldName()); - ArrayList<String> requestValueList = new ArrayList<String>(); + ArrayList<String> requestValueList = new ArrayList<>(); requestValueList.add(requestValue); /*if(ff.isTriggerThisFormfield()) { @@ -2954,7 +2954,7 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep private String parseAndFillOtherFormfieldValues(HttpServletRequest request, String SQL, String userId, ArrayList<FormFieldJSON> formFieldJSONList) { - ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); + ArrayList<IdNameValue> formFieldValues = new ArrayList<>(); String selectedValue = ""; String displayName = ""; for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { @@ -3028,7 +3028,7 @@ public String parseAndFillWithCurrentValues(HttpServletRequest request, String s String fieldId = fft.getFieldId(); String fieldDisplay = getFormFieldDisplayName(fft); String formfield_value = ""; - List<String> selectedItems = new ArrayList<String>(); + List<String> selectedItems = new ArrayList<>(); //Added so that Combo Box in old RAPTOR definition is translated to List box if(fft.getFieldType().equals(FormField.FFT_COMBO_BOX)) { fft.setFieldType(FormField.FFT_LIST_BOX); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultJSON.java index 3148d277..586ec580 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultJSON.java @@ -41,9 +41,9 @@ import java.util.ArrayList; public class SearchResultJSON{ - public ArrayList<SearchResultColumn> searchResultColumns = new ArrayList<SearchResultColumn>(); + public ArrayList<SearchResultColumn> searchResultColumns = new ArrayList<>(); - public ArrayList<SearchResultRow> searchResultRows = new ArrayList<SearchResultRow>(); + public ArrayList<SearchResultRow> searchResultRows = new ArrayList<>(); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java index 144c6ea8..1e0f574b 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java @@ -71,7 +71,7 @@ SchedulerUtil schedulerUtil; public void sendEmail( String p_mail_server, String p_sender, String p_subject, String p_mail_text, String p_url, int p_file_type, int p_schedule_id, int p_time_interval, boolean p_send_attachment, int connectionTimeout) throws SQLException, ReportSQLException{ String allEmailAddr = ""; - final List<String> emailArr = new ArrayList<String>(); + final List<String> emailArr = new ArrayList<>(); //int count1 = 0; String schedular_email; @@ -160,8 +160,8 @@ SchedulerUtil schedulerUtil; //v_hist_rec.file_blob = response.toString(); //v_hist_rec.file_size = v_hist_rec.file_blob.length(); - List<Object> params = new ArrayList<Object>(); - List<Integer> types = new ArrayList<Integer>(); + List<Object> params = new ArrayList<>(); + List<Integer> types = new ArrayList<>(); prepareHisRecUpdate(v_hist_rec, params, types); schedulerUtil diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java index c934f8d4..354d72bc 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java @@ -107,7 +107,7 @@ public class RaptorAdapter extends FusionAdapter { /** Obtains user name by ID */ public static String getUserName(String userId) { - Map<String, Long> params = new HashMap<String, Long>(); + Map<String, Long> params = new HashMap<>(); params.put(USER_ID, new Long(userId)); List list = getDataAccessService().executeNamedQuery("getUserNameById", params, null); @@ -130,7 +130,7 @@ public class RaptorAdapter extends FusionAdapter { } public static String getUserEmail(String userId) { - Map<String, Long> params = new HashMap<String, Long>(); + Map<String, Long> params = new HashMap<>(); params.put(USER_ID, new Long(userId)); List list = getDataAccessService().executeNamedQuery("getUserEmail", params, null); String email = ""; @@ -205,7 +205,7 @@ public class RaptorAdapter extends FusionAdapter { /** Obtains role name by ID */ public static String getRoleName(String roleId) { - Map<String, Long> params = new HashMap<String, Long>(); + Map<String, Long> params = new HashMap<>(); params.put("role_id", new Long(roleId)); List list = getDataAccessService().executeNamedQuery("getRoleNameById", params, null); @@ -225,7 +225,7 @@ public class RaptorAdapter extends FusionAdapter { public static Map<Long, String> getAllRolesUsingCustomizedQuery(String customizedQuery, String param, boolean isAdmin) { List roles = null; - Map<Long, String> map = new LinkedHashMap<Long, String>(); + Map<Long, String> map = new LinkedHashMap<>(); if(customizedQuery.length()>0 && !isAdmin) { @@ -308,7 +308,7 @@ public class RaptorAdapter extends FusionAdapter { public static Set<Long> getActiveUsersRoleIds(Long userId) { Set<Role> allActiveUserRoles = getActiveUserRoles(userId); Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator(); - Set<Long> allActiveUserRoleIds = new TreeSet<Long>(); + Set<Long> allActiveUserRoleIds = new TreeSet<>(); while(allActiveUserRolesIterator.hasNext()){ Role role = allActiveUserRolesIterator.next(); allActiveUserRoleIds.add(role.getId()); @@ -320,7 +320,7 @@ public class RaptorAdapter extends FusionAdapter { public static Set<Long> getActiveUserRoleIds(Long userId) { Set<Role> allActiveUserRoles = getActiveUserRoles(userId); Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator(); - Set<Long> allActiveUserRoleIds = new TreeSet<Long>(); + Set<Long> allActiveUserRoleIds = new TreeSet<>(); while(allActiveUserRolesIterator.hasNext()){ Role role = allActiveUserRolesIterator.next(); allActiveUserRoleIds.add(role.getId()); @@ -332,7 +332,7 @@ public class RaptorAdapter extends FusionAdapter { public static Set<RoleFunction> getActiveRoleFunctions(Long userId) { Set<Role> allActiveUserRoles = getActiveUserRoles(userId); Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator(); - Set<RoleFunction> allActiveRoleFunctions = new TreeSet<RoleFunction>(); + Set<RoleFunction> allActiveRoleFunctions = new TreeSet<>(); while(allActiveUserRolesIterator.hasNext()){ Role role = allActiveUserRolesIterator.next(); allActiveRoleFunctions.addAll(role.getRoleFunctions()); @@ -343,7 +343,7 @@ public class RaptorAdapter extends FusionAdapter { public static Set<Role> getActiveUserRoles(Long userId) { User user = (User)getDataAccessService().getDomainObject(User.class,userId,null); - Set<Role> allActiveUserRoles = new TreeSet<Role>(); + Set<Role> allActiveUserRoles = new TreeSet<>(); allActiveUserRoles.addAll(user.getRoles()); Iterator<Role> userRolesIterator = user.getRoles().iterator(); while(userRolesIterator.hasNext()){ diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java index a03c9539..444b8afc 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/controller/FileServletController.java @@ -131,7 +131,7 @@ public class FileServletController { return null; } catch (Exception e) { logger.error(EELFLoggerDelegate.debugLogger, ("Exception occurred..." + e.getMessage())); - Map<String, Object> errView = new HashMap<String, Object>(); + Map<String, Object> errView = new HashMap<>(); errView.put("error", "The requested resource was not found."); //return new ModelAndView(getExceptionView(), "model", errView); return null; 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 517d2672..bf7ef0bb 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 @@ -1230,7 +1230,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { public @ResponseBody Map<String,String> removeSelectedReportRole( @RequestBody String roleIdToRemove, HttpServletRequest request, HttpServletResponse response) { - Map<String, String> JsonResponse = new HashMap<String, String>(); + Map<String, String> JsonResponse = new HashMap<>(); ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); try { JsonResponse.put("status","success"); @@ -1303,7 +1303,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { @PathVariable("roleID") String roleId, @RequestBody String readOnly, HttpServletRequest request, HttpServletResponse response) { - Map<String, String> JsonResponse = new HashMap<String, String>(); + Map<String, String> JsonResponse = new HashMap<>(); ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); try { String action =""; @@ -1396,7 +1396,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { int iCount = 0; for(Iterator iter=reportUsers.iterator(); iter.hasNext(); iCount++) { - Map<String, String> reportUserMap = new HashMap<String,String>(); + Map<String, String> reportUserMap = new HashMap<>(); SecurityEntry rUser = (SecurityEntry) iter.next(); reportUserMapList.add(rUser); } @@ -1487,7 +1487,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { wizardJSON.setDbInfo((rdef != null) ? rdef.getDBInfo() : ""); wizardJSON.setFormHelpText((rdef != null) ? rdef.getFormHelpText() : ""); wizardJSON.setPageSize((rdef != null) ? rdef.getPageSize() : 50); - List<IdNameBooleanJSON> displayArea = new ArrayList<IdNameBooleanJSON>(); + List<IdNameBooleanJSON> displayArea = new ArrayList<>(); IdNameBooleanJSON idNameJSON = new IdNameBooleanJSON(); String qMenu = ""; for (int i = 0; i < AppUtils.getQuickLinksMenuIDs().size(); i++) { @@ -1506,7 +1506,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { wizardJSON.setFrozenColumns((rdef != null) ? rdef.getFrozenColumns() : 0); wizardJSON.setDataGridAlign((rdef != null) ? rdef.getDataGridAlign() : "left"); wizardJSON.setEmptyMessage((rdef != null) ? rdef.getEmptyMessage() : "No records found"); - List<NameBooleanJSON> displayOptions = new ArrayList<NameBooleanJSON>(); + List<NameBooleanJSON> displayOptions = new ArrayList<>(); NameBooleanJSON nameBooleanJSON = new NameBooleanJSON(); nameBooleanJSON.setName("HideFormFields"); nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideForm() : false); @@ -1542,7 +1542,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { String schemaSql = Globals.getRemoteDbSchemaSql(); DataSet ds = null; - ArrayList<IdNameBooleanJSON> dbInfoList = new ArrayList<IdNameBooleanJSON>(); + ArrayList<IdNameBooleanJSON> dbInfoList = new ArrayList<>(); try { ds = DbUtils.executeQuery(schemaSql); |