diff options
4 files changed, 69 insertions, 13 deletions
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 fc5fdb36..c934f8d4 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 @@ -76,6 +76,7 @@ public class RaptorAdapter extends FusionAdapter { public static final int RAPTOR_USER_ID = 20000; // RAPTOR system user id (for auditing purposes) public static final String RAPTOR_CONTROLLER_CLASSNAME = "org.onap.portalsdk.analytics.controller.Controller"; public static final String KEY_USER_ROLES_CACHE = "userRoles"; + private static final String USER_ID = "user_id"; public void initializeRaptor() { org.onap.portalsdk.analytics.config.ConfigLoader.setConfigFilesPath(SystemProperties.getProperty(SystemProperties.RAPTOR_CONFIG_FILE_PATH)); @@ -86,7 +87,6 @@ public class RaptorAdapter extends FusionAdapter { /** Returns ID of the user currently logged in */ public static String getUserID(HttpServletRequest request) { return String.valueOf(UserUtils.getUserId(request)); - //return null; } public static String getUserID(String user_id) { @@ -95,7 +95,9 @@ public class RaptorAdapter extends FusionAdapter { public static String getUserBackdoorLoginId(HttpServletRequest request) { - if(AppUtils.getRequestNvlValue(request, "login_id").length()>0) return AppUtils.getRequestNvlValue(request, "login_id"); + if (AppUtils.getRequestNvlValue(request, "login_id").length() > 0) { + return AppUtils.getRequestNvlValue(request, "login_id"); + } return String.valueOf(UserUtils.getUserSession(request).getLoginId()); } @@ -106,19 +108,17 @@ public class RaptorAdapter extends FusionAdapter { /** Obtains user name by ID */ public static String getUserName(String userId) { Map<String, Long> params = new HashMap<String, Long>(); - params.put("user_id", new Long(userId)); + params.put(USER_ID, new Long(userId)); List list = getDataAccessService().executeNamedQuery("getUserNameById", params, null); String firstName = ""; String lastName = ""; - if (list != null) { - if (!list.isEmpty()) { + if (list != null && !list.isEmpty()) { Object[] user = (Object[]) list.get(0); firstName = (String) user[0]; // firstName scalar lastName = (String) user[1]; // lastName scalar - } } return lastName + ", " + firstName; @@ -131,7 +131,7 @@ public class RaptorAdapter extends FusionAdapter { public static String getUserEmail(String userId) { Map<String, Long> params = new HashMap<String, Long>(); - params.put("user_id", new Long(userId)); + params.put(USER_ID, new Long(userId)); List list = getDataAccessService().executeNamedQuery("getUserEmail", params, null); String email = ""; if (list != null && !list.isEmpty()) @@ -148,8 +148,8 @@ public class RaptorAdapter extends FusionAdapter { String loginId = ""; try{ - List<Criterion> restrictionsList = new ArrayList<Criterion>(); - Criterion criterion1 = Restrictions.eq("user_id", userId); + List<Criterion> restrictionsList = new ArrayList<>(); + Criterion criterion1 = Restrictions.eq(USER_ID, userId); restrictionsList.add(criterion1); List list = getDataAccessService().getList(User.class, null, restrictionsList, null); if (list != null) { @@ -173,7 +173,7 @@ public class RaptorAdapter extends FusionAdapter { /** Obtains list of all users (in IdNameValue objects) */ public static Map<Long, String> getAllUsers(String customizedQuery, String param, boolean isAdmin) { List users = null; - Map<Long, String> map = new LinkedHashMap<Long, String>(); + Map<Long, String> map = new LinkedHashMap<>(); if(customizedQuery.length()>0 && !isAdmin) { diff --git a/ecomp-sdk/epsdk-app-os/db-scripts/EcompSdkDMLMySql_3_0_OS.sql b/ecomp-sdk/epsdk-app-os/db-scripts/EcompSdkDMLMySql_3_0_OS.sql index 685d1784..a397f2d0 100644 --- a/ecomp-sdk/epsdk-app-os/db-scripts/EcompSdkDMLMySql_3_0_OS.sql +++ b/ecomp-sdk/epsdk-app-os/db-scripts/EcompSdkDMLMySql_3_0_OS.sql @@ -36,4 +36,60 @@ Insert into fn_app (APP_ID,APP_NAME,APP_IMAGE_URL,APP_DESCRIPTION,APP_NOTES,APP_ -- fn_user_role Insert into fn_user_role (USER_ID,ROLE_ID,PRIORITY,APP_ID) values (1,1,null,1); +INSERT INTO CR_REPORT(REP_ID, TITLE, DESCR, PUBLIC_YN, REPORT_XML, CREATE_ID, CREATE_DATE, MAINT_ID, MAINT_DATE, MENU_ID, MENU_APPROVED_YN, OWNER_ID, FOLDER_ID, DASHBOARD_TYPE_YN, DASHBOARD_YN) VALUES +(1, 'test report', 'test report', 'Y', '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<customReport pageSize="50" reportType="Linear"> + <reportName>test report</reportName> + <reportDescr>test report</reportDescr> + <dbInfo>local</dbInfo> + <chartType></chartType> + <showChartTitle>false</showChartTitle> + <public>false</public> + <hideFormFieldAfterRun>false</hideFormFieldAfterRun> + <createId>1</createId> + <createDate>2019-09-11-04:00</createDate> + <reportSQL>SELECT + first_name fi1 +from fn_user</reportSQL> + <frozenColumns>0</frozenColumns> + <emptyMessage>Your Search didn''t yield any results.</emptyMessage> + <dataGridAlign>left</dataGridAlign> + <numFormCols>100</numFormCols> + <displayOptions>NNNNNNN</displayOptions> + <allowSchedule>N</allowSchedule> + <sizedByContent>N</sizedByContent> + <comment>N|</comment> + <dataSourceList> + <dataSource tableId="du0"> + <tableName>DUAL</tableName> + <tablePK></tablePK> + <displayName>DUAL</displayName> + <dataColumnList> + <dataColumn colId="fi1"> + <tableId>du0</tableId> + <dbColName>first_name</dbColName> + <colName>first_name</colName> + <displayName>first_name</displayName> + <displayWidth>10</displayWidth> + <displayAlignment>Left</displayAlignment> + <orderSeq>1</orderSeq> + <visible>true</visible> + <calculated>true</calculated> + <colType>VARCHAR2</colType> + <groupBreak>false</groupBreak> + <dbColType>VARCHAR2</dbColType> + </dataColumn> + </dataColumnList> + </dataSource> + </dataSourceList> + <maxRowsInExcelDownload>500</maxRowsInExcelDownload> + <isOneTimeScheduleAllowed>N</isOneTimeScheduleAllowed> + <isHourlyScheduleAllowed>N</isHourlyScheduleAllowed> + <isDailyScheduleAllowed>N</isDailyScheduleAllowed> + <isDailyMFScheduleAllowed>N</isDailyMFScheduleAllowed> + <isWeeklyScheduleAllowed>N</isWeeklyScheduleAllowed> + <isMonthlyScheduleAllowed>N</isMonthlyScheduleAllowed> +</customReport>', 1, sysdate(), 1, sysdate(), 'HOME', 'N', 1, NULL, 'N', 'N'); + + commit;
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java index 2336a514..a5a2b2ba 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/CadiAuthFilter.java @@ -79,8 +79,8 @@ public class CadiAuthFilter extends CadiFilter { throw new ServletException("Filter init parameter " + INCLUDE_URL_ENDPOINTS + " is null or empty"); if (exclude_url_endpoints == null || exclude_url_endpoints.isEmpty()) throw new ServletException("Filter init parameter " + EXCLUDE_URL_ENDPOINTS + " is null or empty"); - includeUrlEndPointList = new ArrayList<String>(Arrays.asList(include_url_endpoints.split(","))); - excludeUrlEndPointList = new ArrayList<String>(Arrays.asList(exclude_url_endpoints.split(","))); + includeUrlEndPointList = new ArrayList<>(Arrays.asList(include_url_endpoints.split(","))); + excludeUrlEndPointList = new ArrayList<>(Arrays.asList(exclude_url_endpoints.split(","))); } @Override diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java index ac310805..2e47768a 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/AuthUtil.java @@ -204,7 +204,7 @@ public class AuthUtil { logger.debug("Request is Authorized"); } } catch (ClassCastException e) { - logger.warn("Given request is not CADI request: " + e.toString()); + logger.warn("Given request is not CADI request: ", e); if (appCredentials.isEmpty()) { logger.debug("app credentails are empty"); |