diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src/main')
42 files changed, 487 insertions, 532 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java index a1383fb0..ea1d3e8b 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AdminController.java @@ -7,7 +7,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -20,7 +20,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -41,8 +41,6 @@ package org.onap.portalapp.controller.core; import java.util.HashMap; import java.util.Map; -import javax.servlet.http.HttpServletRequest; - import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -55,14 +53,14 @@ public class AdminController { public class AngularSinglePageController extends RestrictedBaseController { @RequestMapping(value = { "/admin" }, method = RequestMethod.GET) - public ModelAndView view(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + public ModelAndView view() { + Map<String, Object> model = new HashMap<>(); return new ModelAndView("admin", "model", model); } @RequestMapping(value = { "/admin2" }, method = RequestMethod.GET) - public ModelAndView adminView(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + public ModelAndView adminView() { + Map<String, Object> model = new HashMap<>(); return new ModelAndView("admin2", "model", model); } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java index 71729c0d..61b57a35 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -40,8 +40,6 @@ package org.onap.portalapp.controller.core; import java.util.HashMap; import java.util.Map; -import javax.servlet.http.HttpServletRequest; - import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -53,16 +51,14 @@ import org.springframework.web.servlet.ModelAndView; public class AngularAdminController extends RestrictedBaseController{ @RequestMapping(value = {"/userProfile" }, method = RequestMethod.GET) - public ModelAndView view(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); - + public ModelAndView view() { + Map<String, Object> model = new HashMap<>(); return new ModelAndView("user_profile_list","model", model); } @RequestMapping(value = {"/admin" }, method = RequestMethod.GET) - public ModelAndView adminView(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); - + public ModelAndView adminView() { + Map<String, Object> model = new HashMap<>(); return new ModelAndView(getViewName(),"model", model); } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/BootstrapSampleController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/BootstrapSampleController.java index 12602235..61b37d0c 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/BootstrapSampleController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/BootstrapSampleController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,8 +37,6 @@ */ package org.onap.portalapp.controller.core; -import javax.servlet.http.HttpServletRequest; - import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -54,7 +52,7 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/") public class BootstrapSampleController extends RestrictedBaseController { @RequestMapping(value = { "/bootstrap_sample" }, method = RequestMethod.GET) - public ModelAndView welcome(HttpServletRequest request) { + public ModelAndView welcome() { final String defaultViewName = null; return new ModelAndView(defaultViewName); } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java index 79866f6c..c3f8cfc3 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/CacheAdminController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,6 +37,7 @@ */ package org.onap.portalapp.controller.core; +import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.LinkedList; @@ -47,6 +48,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.jcs.JCS; +import org.apache.jcs.access.exception.CacheException; import org.apache.jcs.admin.CacheRegionInfo; import org.apache.jcs.admin.JCSAdminBean; import org.apache.jcs.engine.behavior.ICacheElement; @@ -73,16 +75,14 @@ public class CacheAdminController extends RestrictedBaseController { private JCSAdminBean jcsAdminBean = new JCSAdminBean(); @RequestMapping(value = { "/jcs_admin" }, method = RequestMethod.GET) - public ModelAndView cacheAdmin(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); - + public ModelAndView cacheAdmin() { + Map<String, Object> model = new HashMap<>(); model.put("model", getRegions()); - return new ModelAndView(getViewName(), model); } @RequestMapping(value = { "/get_regions" }, method = RequestMethod.GET) - public void getRegions(HttpServletRequest request, HttpServletResponse response) { + public void getRegions(HttpServletResponse response) { try { JsonMessage msg = new JsonMessage(getRegions().toString()); JSONObject j = new JSONObject(msg); @@ -93,41 +93,37 @@ public class CacheAdminController extends RestrictedBaseController { } @RequestMapping(value = { "/jcs_admin/clearRegion" }, method = RequestMethod.GET) - public void clearRegion(HttpServletRequest request, HttpServletResponse response) throws Exception { - String cacheName = (String) request.getParameter("cacheName"); + public void clearRegion(HttpServletRequest request, HttpServletResponse response) throws IOException { + String cacheName = request.getParameter("cacheName"); clearCacheRegion(cacheName); - response.setContentType("application/json"); PrintWriter out = response.getWriter(); out.write(getRegions().toString()); } @RequestMapping(value = { "/jcs_admin/clearAll" }, method = RequestMethod.GET) - public void clearAll(HttpServletRequest request, HttpServletResponse response) throws Exception { + public void clearAll(HttpServletResponse response) throws IOException { clearAllRegions(); - response.setContentType("application/json"); PrintWriter out = response.getWriter(); out.write(getRegions().toString()); } @RequestMapping(value = { "/jcs_admin/clearItem" }, method = RequestMethod.GET) - public void clearItem(HttpServletRequest request, HttpServletResponse response) throws Exception { - String keyName = (String) request.getParameter("keyName"); - String cacheName = (String) request.getParameter("cacheName"); + public void clearItem(HttpServletRequest request, HttpServletResponse response) throws IOException { + String keyName = request.getParameter("keyName"); + String cacheName = request.getParameter("cacheName"); clearCacheRegionItem(cacheName, keyName); - response.setContentType("application/json"); PrintWriter out = response.getWriter(); out.write(getRegions().toString()); } @RequestMapping(value = { "/jcs_admin/showItemDetails" }, method = RequestMethod.GET) - public void showItemDetails(HttpServletRequest request, HttpServletResponse response) throws Exception { - String cacheName = (String) request.getParameter("cacheName"); - String keyName = (String) request.getParameter("keyName"); + public void showItemDetails(HttpServletRequest request, HttpServletResponse response) throws IOException { + String cacheName = request.getParameter("cacheName"); + String keyName = request.getParameter("keyName"); String details = null; - try { details = getItemDetails(cacheName, keyName); } catch (Exception e) { @@ -136,14 +132,13 @@ public class CacheAdminController extends RestrictedBaseController { } JSONObject j = new JSONObject(details); response.setContentType("application/json"); - // response.setContentType("text/plain"); PrintWriter out = response.getWriter(); out.write(j.toString()); } @RequestMapping(value = { "/jcs_admin/showRegionDetails" }, method = RequestMethod.GET) - public void showRegionDetails(HttpServletRequest request, HttpServletResponse response) throws Exception { - String cacheName = (String) request.getParameter("cacheName"); + public void showRegionDetails(HttpServletRequest request, HttpServletResponse response) { + String cacheName = request.getParameter("cacheName"); ObjectMapper mapper = new ObjectMapper(); try { String details = getRegionStats(cacheName); @@ -190,21 +185,18 @@ public class CacheAdminController extends RestrictedBaseController { return ja; } - private String getRegionStats(String cacheName) throws Exception { - String stats = ""; - + private String getRegionStats(String cacheName) throws CacheException { JCS cache = JCS.getInstance(cacheName); - stats = cache.getStats(); - + String stats = cache.getStats(); return stats; } private String getItemDetails(String cacheName, String keyName) throws Exception { - String details = ""; JCS cache = JCS.getInstance(cacheName); ICacheElement element = cache.getCacheElement(keyName); + String details = ""; if (element != null) { ObjectMapper mapper = new ObjectMapper(); mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java index 016c3b87..da26fe69 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FavoritesController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -75,26 +75,25 @@ public class FavoritesController extends RestrictedBaseController { private AppService appService; /** - * Makes the REST API call to Portal Back-end and retrieves Favorite menu - * items for the currently logged in user. + * Makes the REST API call to Portal Back-end and retrieves Favorite menu items + * for the currently logged in user. * * @param request * @param response */ @RequestMapping(value = { "/get_favorites" }, method = RequestMethod.GET) public void getFavorites(HttpServletRequest request, HttpServletResponse response) { - String appName = ""; - String requestId = ""; - String appUserName = ""; - String decryptedPwd = ""; - + String appName = ""; + String requestId = ""; + String appUserName = ""; + String decryptedPwd = null; + try { HttpSession session = request.getSession(); User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); if (user == null || user.getId() == null) { - logger.info(EELFLoggerDelegate.errorLogger, - ("Http request did not contain user info, cannot retrieve favorites.")); - + logger.error(EELFLoggerDelegate.errorLogger, + "Http request did not contain user info, cannot retrieve favorites."); response.setContentType("application/json"); JSONArray jsonResponse = new JSONArray(); JSONObject error = new JSONObject(); @@ -102,35 +101,37 @@ public class FavoritesController extends RestrictedBaseController { jsonResponse.put(error); response.getWriter().write(jsonResponse.toString()); } else { - logger.info(EELFLoggerDelegate.errorLogger, + logger.debug(EELFLoggerDelegate.debugLogger, "Retrieving Favorites for the user '" + MDC.get(SystemProperties.MDC_LOGIN_ID) + "'."); - + App app = appService.getDefaultApp(); - if (app!=null) { - appName = app.getName(); + if (app != null) { + appName = app.getName(); appUserName = app.getUsername(); - try{ - decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); - } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.getMessage()); + try { + decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "FavoritesController.getFavorites failed while decrypting password", e); } } else { - logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database."); - appName = SystemProperties.SDK_NAME; + logger.error(EELFLoggerDelegate.errorLogger, + "Unable to locate the app information from the database."); + appName = SystemProperties.SDK_NAME; } requestId = MDC.get(MDC_KEY_REQUEST_ID); - - String jsonResponse = FavoritesClient.getFavorites(MDC.get(SystemProperties.MDC_LOGIN_ID), appName, requestId, appUserName, decryptedPwd); - - logger.debug(EELFLoggerDelegate.debugLogger, "FavoritesMenu response: " + jsonResponse); - + + String jsonResponse = FavoritesClient.getFavorites(MDC.get(SystemProperties.MDC_LOGIN_ID), appName, + requestId, appUserName, decryptedPwd); + + logger.debug(EELFLoggerDelegate.debugLogger, "FavoritesMenu response: {}", jsonResponse); response.setContentType("application/json"); response.getWriter().write(jsonResponse); } } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in FavoritesController.getFavorites while performing get_favorites. Details: " - + e.getMessage(), AlarmSeverityEnum.MINOR); + "FavoritesController.getFavorites failed", e); } } } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java index e364fd45..dfc735b1 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FnMenuController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -68,7 +68,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; /** * A controller for Admin to add/edit/delete menu items from FN_MENU. */ - @Controller @RequestMapping("/") public class FnMenuController extends RestrictedBaseController { @@ -91,7 +90,6 @@ public class FnMenuController extends RestrictedBaseController { } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getParentListFailed", e); response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.write(e.getMessage()); } @@ -105,7 +103,6 @@ public class FnMenuController extends RestrictedBaseController { } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getFunctionCDList", e); response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.write(e.getMessage()); } @@ -114,10 +111,10 @@ public class FnMenuController extends RestrictedBaseController { @RequestMapping(value = { "/admin_fn_menu" }, method = RequestMethod.GET) public void getFnMenuList(HttpServletRequest request, HttpServletResponse response) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); List<MenuData> temp = null; - List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>(); + List<List<MenuData>> childItemList = new ArrayList<>(); List<MenuData> parentList = new ArrayList<>(); try { @@ -142,20 +139,10 @@ public class FnMenuController extends RestrictedBaseController { parentData.setSeparator(menu.isSeparator()); parentData.setImageSrc(menu.getImageSrc()); parentList.add(parentData); - List<MenuData> tempList = new ArrayList<MenuData>(); - // int countChildAction = 0; - /* - * for(Object o:menu.getChildMenus()){ Menu m = (Menu)o; Menu - * data = new Menu(); data.setId(m.getId()); - * data.setLabel(m.getLabel()); data.setAction(m.getAction()); - * data.setImageSrc(m.getImageSrc()); tempList.add(data); } - */ + List<MenuData> tempList = new ArrayList<>(); childItemList.add(tempList); } model.put("fnMenuItems", parentList); - // JsonMessage msg = new - // JsonMessage(mapper.writeValueAsString(parentList),mapper.writeValueAsString(childItemList),"none"); - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); JSONObject j = new JSONObject(msg); response.getWriter().write(j.toString()); @@ -234,10 +221,12 @@ public class FnMenuController extends RestrictedBaseController { } + @Override public String getViewName() { return viewName; } + @Override public void setViewName(String viewName) { this.viewName = viewName; } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java index aef83c49..3ad49860 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/FuncMenuController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -74,26 +74,29 @@ import org.springframework.web.bind.annotation.RequestMethod; @RequestMapping("/") @org.springframework.context.annotation.Configuration @EnableAspectJAutoProxy -public class FuncMenuController extends RestrictedBaseController{ - +public class FuncMenuController extends RestrictedBaseController { + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FuncMenuController.class); @Autowired private AppService appService; @AuditLog - @RequestMapping(value = {"/get_functional_menu" }, method = RequestMethod.GET) + @RequestMapping(value = { "/get_functional_menu" }, method = RequestMethod.GET) public void functionalMenu(HttpServletRequest request, HttpServletResponse response) { - - User user = UserUtils.getUserSession(request); - //JSONArray validMenu = new JSONArray("[{\"menuId\":140,\"column\":1,\"text\":\"RT SDK Menu\",\"parentMenuId\":139,\"url\":\"http://www.cnn.com\"},{\"menuId\":139,\"column\":1,\"text\":\"RT Menu\",\"parentMenuId\":11,\"url\":\"\"},{\"menuId\":11,\"column\":1,\"text\":\"Product Design\",\"parentMenuId\":1,\"url\":\"\"},{\"menuId\":1,\"column\":1,\"text\":\"Design\",\"url\":\"\"}]"); - + + User user = UserUtils.getUserSession(request); + try { - if ( user != null ) { - String useRestForFunctionalMenu = PortalApiProperties.getProperty(PortalApiConstants.USE_REST_FOR_FUNCTIONAL_MENU); - String funcMenuJsonString = ""; - if (useRestForFunctionalMenu==null || useRestForFunctionalMenu=="" || useRestForFunctionalMenu.equalsIgnoreCase("false")) { - logger.info(EELFLoggerDelegate.errorLogger, "Making use of UEB communication and Requesting functional menu for user " + user.getOrgUserId()); + if (user != null) { + String useRestForFunctionalMenu = PortalApiProperties + .getProperty(PortalApiConstants.USE_REST_FOR_FUNCTIONAL_MENU); + String funcMenuJsonString; + if (useRestForFunctionalMenu == null || "".equals(useRestForFunctionalMenu) + || "false".equalsIgnoreCase(useRestForFunctionalMenu)) { + logger.debug(EELFLoggerDelegate.debugLogger, + "Making use of UEB communication and Requesting functional menu for user " + + user.getOrgUserId()); funcMenuJsonString = getFunctionalMenu(user.getOrgUserId()); } else { funcMenuJsonString = getFunctionalMenuViaREST(user.getOrgUserId()); @@ -101,93 +104,95 @@ public class FuncMenuController extends RestrictedBaseController{ response.setContentType("application/json"); response.getWriter().write(funcMenuJsonString); } else { - logger.info(EELFLoggerDelegate.errorLogger, "Http request did not contain user info, cannot retrieve functional menu"); - response.setContentType("application/json"); - JSONArray jsonResponse = new JSONArray(); - JSONObject error = new JSONObject(); - error.put("error","Http request did not contain user info, cannot retrieve functional menu"); + logger.error(EELFLoggerDelegate.errorLogger, + "Http request did not contain user info, cannot retrieve functional menu"); + response.setContentType("application/json"); + JSONArray jsonResponse = new JSONArray(); + JSONObject error = new JSONObject(); + error.put("error", "Http request did not contain user info, cannot retrieve functional menu"); jsonResponse.put(error); response.getWriter().write(jsonResponse.toString()); - } - } catch (Exception e) { + } + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "functionalMenu failed", e); response.setCharacterEncoding("UTF-8"); - response.setContentType("application/json"); - JSONArray jsonResponse = new JSONArray(); - JSONObject error = new JSONObject(); + response.setContentType("application/json"); + JSONArray jsonResponse = new JSONArray(); + JSONObject error = new JSONObject(); try { - if ( null == e.getMessage() ) { - error.put("error","No menu data"); + if (null == e.getMessage()) { + error.put("error", "No menu data"); } else { - error.put("error",e.getMessage()); + error.put("error", e.getMessage()); } jsonResponse.put(error); response.getWriter().write(jsonResponse.toString()); - logger.error(EELFLoggerDelegate.errorLogger, "Error getting functional_menu: " + e.getMessage(),AlarmSeverityEnum.MAJOR); } catch (IOException e1) { - e1.printStackTrace(); + logger.error(EELFLoggerDelegate.errorLogger, "Error getting functional_menu", e1); } } - + } - - //-------------------------------------------------------------------------- + + // -------------------------------------------------------------------------- // Makes a synchronous call to ECOMP Portal to get the JSON file that - // contains the contents of the functional menu. The JSON file will be + // contains the contents of the functional menu. The JSON file will be // in the payload of the returned UEB message. - //-------------------------------------------------------------------------- - private String getFunctionalMenu(String userId) throws UebException - { + // -------------------------------------------------------------------------- + private String getFunctionalMenu(String userId) throws UebException { String returnString = null; - UebMsg funcMenuUebMsg = null; UebMsg msg = new UebMsg(); msg.putMsgType(UebMsgTypes.UEB_MSG_TYPE_GET_FUNC_MENU); msg.putUserId(userId); - funcMenuUebMsg = UebManager.getInstance().requestReply(msg); + UebMsg funcMenuUebMsg = UebManager.getInstance().requestReply(msg); if (funcMenuUebMsg != null) { if (funcMenuUebMsg.getPayload().startsWith("Error:")) { - logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenu received an error in UEB msg = " + funcMenuUebMsg.getPayload()); + logger.error(EELFLoggerDelegate.errorLogger, + "getFunctionalMenu received an error in UEB msg = " + funcMenuUebMsg.getPayload()); } else { returnString = funcMenuUebMsg.getPayload(); } } - + logger.debug(EELFLoggerDelegate.debugLogger, "FunctionalMenu response: " + returnString); - - return returnString; + return returnString; } - + private String getFunctionalMenuViaREST(String userId) { - String appName = ""; - String requestId = ""; - String appUserName = ""; - String decryptedPwd = ""; - - logger.info(EELFLoggerDelegate.debugLogger, "Making use of REST API communication and Requesting functional menu for user " + userId); - + String appName; + String requestId; + String appUserName = ""; + String decryptedPwd = null; + + logger.debug(EELFLoggerDelegate.debugLogger, + "Making use of REST API communication and Requesting functional menu for user " + userId); + App app = appService.getDefaultApp(); - if (app!=null) { - appName = app.getName(); + if (app != null) { + appName = app.getName(); appUserName = app.getUsername(); - try{ - decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key)); - } catch(Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.toString()); + try { + decryptedPwd = CipherUtil.decrypt(app.getAppPassword(), + SystemProperties.getProperty(SystemProperties.Decryption_Key)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, + "getFunctionalMenuViaREST failed while decrypting the password", e); } } else { - logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database."); - appName = SystemProperties.SDK_NAME; + logger.error(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database."); + appName = SystemProperties.SDK_NAME; } requestId = MDC.get(MDC_KEY_REQUEST_ID); - + String fnMenu = null; try { fnMenu = FunctionalMenuClient.getFunctionalMenu(userId, appName, requestId, appUserName, decryptedPwd); - }catch(Exception ex) { + } catch (Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenuViaREST failed", ex); fnMenu = "Failed to get functional menu: " + ex.toString(); } - + logger.debug(EELFLoggerDelegate.debugLogger, "FunctionalMenu response: {}", fnMenu); - return fnMenu; } }
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java index 4fc7e188..548ad986 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/LogoutController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -38,11 +38,9 @@ package org.onap.portalapp.controller.core; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.onap.portalsdk.core.controller.UnRestrictedBaseController; import org.onap.portalsdk.core.domain.User; -import org.onap.portalsdk.core.logging.format.AlarmSeverityEnum; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; @@ -56,67 +54,61 @@ import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") -public class LogoutController extends UnRestrictedBaseController{ +public class LogoutController extends UnRestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LogoutController.class); private User user; - + /** + * + * invalidates the current application session, then redirects to portal logout + * * @param request - * @param response * @return modelView - * - * globalLogout will invalid the current application session, then redirects to portal logout */ - @RequestMapping(value = {"/logout.htm" }, method = RequestMethod.GET) - public ModelAndView globalLogout(HttpServletRequest request, HttpServletResponse response) { + @RequestMapping(value = { "/logout.htm" }, method = RequestMethod.GET) + public ModelAndView globalLogout(HttpServletRequest request) { ModelAndView modelView = null; - try{ + try { chatRoomLogout(request); request.getSession().invalidate(); - String portalUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); + String portalUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); String portalDomain = portalUrl.substring(0, portalUrl.lastIndexOf('/')); - String redirectUrl = portalDomain+"/logout.htm"; - modelView = new ModelAndView("redirect:"+redirectUrl); - }catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, "Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR); + String redirectUrl = portalDomain + "/logout.htm"; + modelView = new ModelAndView("redirect:" + redirectUrl); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Logout failed", e); } return modelView; } /** + * + * invalidates the current session (application logout) and redirects user to + * Portal. + * * @param request - * @param response * @return modelView - * - * appLogout is a function that will invalid the current session (application logout) and redirects user to Portal. */ - @RequestMapping(value = {"/app_logout.htm" }, method = RequestMethod.GET) - public ModelAndView appLogout(HttpServletRequest request, HttpServletResponse response) { + @RequestMapping(value = { "/app_logout.htm" }, method = RequestMethod.GET) + public ModelAndView appLogout(HttpServletRequest request) { ModelAndView modelView = null; - try{ + try { chatRoomLogout(request); - modelView = new ModelAndView("redirect:"+PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)); - UserUtils.clearUserSession(request); + modelView = new ModelAndView( + "redirect:" + PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)); + UserUtils.clearUserSession(request); request.getSession().invalidate(); - }catch(Exception e){ - logger.error(EELFLoggerDelegate.errorLogger, "Application Logout Error: " + e.getMessage(),AlarmSeverityEnum.MAJOR); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "Application Logout failed", e); } return modelView; } - - public void chatRoomLogout(HttpServletRequest request){ - request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); + public void chatRoomLogout(HttpServletRequest request) { + request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); setUser(UserUtils.getUserSession(request)); - // if(getUser()!=null){ - // Long login_IdLong = getUser().getId(); - // String name = getUser().getFirstName(); - // String login_IdStr = Long.toString(login_IdLong); - // } - //UserListName.getInstance().delUserName(name); - //UserListID.getInstance().delUserName(login_IdStr); } public User getUser() { @@ -127,5 +119,4 @@ public class LogoutController extends UnRestrictedBaseController{ this.user = user; } - } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java index 885ab994..b7236490 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -68,15 +68,15 @@ public class ManifestController extends RestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ManifestController.class); + /** Path to resource on classpath */ + private static final String MANIFEST_RESOURCE_PATH = "/META-INF/MANIFEST.MF"; + /** * Required to obtain the webapp manifest. */ @Autowired private ServletContext context; - /** Path to resource on classpath */ - private final String MANIFEST_RESOURCE_PATH = "/META-INF/MANIFEST.MF"; - /** * Gets the content of the webapp manifest file META-INF/MANIFEST.MF. * @@ -96,7 +96,6 @@ public class ManifestController extends RestrictedBaseController { /** * Gets the webapp manifest contents as a JSON object. * - * @param request * @return A map of key-value pairs. On success: * * <pre> @@ -114,13 +113,13 @@ public class ManifestController extends RestrictedBaseController { */ @RequestMapping(value = { "/manifest" }, method = RequestMethod.GET, produces = "application/json") @ResponseBody - public Map<Object, Object> getManifest(HttpServletRequest request) { + public Map<Object, Object> getManifest() { try { Attributes attributes = getWebappManifest(); return attributes; } catch (Exception ex) { logger.error(EELFLoggerDelegate.errorLogger, "getManifest failed", ex); - Map<Object, Object> response = new HashMap<Object, Object>(); + Map<Object, Object> response = new HashMap<>(); response.put("error", "failed to get manifest: " + ex.toString()); return response; } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java index 2300cf46..af580cb7 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/MenuListController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -92,15 +92,14 @@ public class MenuListController extends RestrictedBaseController { logger.debug(EELFLoggerDelegate.debugLogger, "getMenu begins"); try { ObjectMapper mapper = new ObjectMapper(); - Set<MenuData> menuResult = null; HttpSession session = request.getSession(); List<List<MenuData>> childItemList = (List<List<MenuData>>) session .getAttribute(SystemProperties.LEFT_MENU_CHILDREND); List<MenuData> parentList = (List<MenuData>) session.getAttribute(SystemProperties.LEFT_MENU_PARENT); - if (parentList == null || childItemList == null || parentList.size() == 0 || childItemList.size() == 0) { - childItemList = new ArrayList<List<MenuData>>(); - parentList = new ArrayList<MenuData>(); - menuResult = (Set<MenuData>) session + if (parentList == null || childItemList == null || parentList.isEmpty() || childItemList.isEmpty()) { + childItemList = new ArrayList<>(); + parentList = new ArrayList<>(); + Set<MenuData> menuResult = (Set<MenuData>) session .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult); logger.debug(EELFLoggerDelegate.debugLogger, "storing leftmenu items into session"); @@ -157,15 +156,15 @@ public class MenuListController extends RestrictedBaseController { public Map<String, Object> getLeftMenuJSP(HttpServletRequest request) { logger.debug(EELFLoggerDelegate.debugLogger, "getLeftMenuJSP begins"); ObjectMapper mapper = new ObjectMapper(); - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); try { HttpSession session = request.getSession(); List<List<MenuData>> childItemList = (List<List<MenuData>>) session .getAttribute(SystemProperties.LEFT_MENU_CHILDREND); List<MenuData> parentList = (List<MenuData>) session.getAttribute(SystemProperties.LEFT_MENU_PARENT); if (parentList == null || childItemList == null) { - childItemList = new ArrayList<List<MenuData>>(); - parentList = new ArrayList<MenuData>(); + childItemList = new ArrayList<>(); + parentList = new ArrayList<>(); Set<MenuData> menuResult = (Set<MenuData>) session .getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME)); fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult); @@ -203,7 +202,7 @@ public class MenuListController extends RestrictedBaseController { List<SharedContext> sharedContextRes = sharedContextRestClient.getUserContext(contextId); logger.debug(EELFLoggerDelegate.debugLogger, "getUserInfo: Shared Context Response is {}", sharedContextRes); - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); for (SharedContext sharedContext : sharedContextRes) { model.put(sharedContext.getCkey(), sharedContext.getCvalue()); } @@ -223,7 +222,6 @@ public class MenuListController extends RestrictedBaseController { */ @RequestMapping(value = { "/get_topMenuInfo" }, method = RequestMethod.GET) public void getTopMenu(HttpServletRequest request, HttpServletResponse response) { - @SuppressWarnings("unused") boolean isAppCentralized = false; HttpSession session = request.getSession(); try { @@ -231,7 +229,7 @@ public class MenuListController extends RestrictedBaseController { String firstName = (String) session.getAttribute(SystemProperties.FIRST_NAME); String lastName = (String) session.getAttribute(SystemProperties.LAST_NAME); User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)); - Map<String, String> map = new HashMap<String, String>(); + Map<String, String> map = new HashMap<>(); String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); String portalDomain = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')); String portalUrl = portalDomain + "/process_csp"; @@ -244,10 +242,10 @@ public class MenuListController extends RestrictedBaseController { map.put("lastName", lastName); map.put("userid", user.getOrgUserId()); map.put("email", user.getEmail()); - map.put("getAccessUrl", getAccessUrl); + map.put("getAccessUrl", getAccessUrl); String roleAccessCentralized = PortalApiProperties.getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED); if (roleAccessCentralized != null && "remote".equals(roleAccessCentralized)) - isAppCentralized = true; + isAppCentralized = true; map.put("isAppCentralized", Boolean.toString(isAppCentralized)); JSONObject j = new JSONObject(map); response.setContentType("application/json"); @@ -263,9 +261,9 @@ public class MenuListController extends RestrictedBaseController { String pageToURL = null; try { String pageTo = request.getParameter("page"); - if (pageTo.equals("contact")) + if ("contact".equals(pageTo)) pageToURL = SystemProperties.getProperty(SystemProperties.CONTACT_US_LINK); - else if (pageTo.equals("access")) { + else if ("access".equals(pageTo)) { String redirectUrl = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REDIRECT_URL); String portalDomain = redirectUrl.substring(0, redirectUrl.lastIndexOf('/')); pageToURL = portalDomain + "/get_access"; diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/PostSearchController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/PostSearchController.java index d1ced9b5..59df7e9a 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/PostSearchController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/PostSearchController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,6 +37,7 @@ */ package org.onap.portalapp.controller.core; +import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; @@ -44,6 +45,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import javax.naming.NamingException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -89,10 +91,8 @@ public class PostSearchController extends RestrictedBaseController { private ProfileService profileService; @RequestMapping(value = { "/post_search" }, method = RequestMethod.GET) - public ModelAndView welcome(HttpServletRequest request, - @ModelAttribute("postSearchBean") PostSearchBean postSearchBean) { - Map<String, Object> model = new HashMap<String, Object>(); - + public ModelAndView welcome(@ModelAttribute("postSearchBean") PostSearchBean postSearchBean) { + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); try { postSearchBean = new PostSearchBean(); @@ -101,17 +101,16 @@ public class PostSearchController extends RestrictedBaseController { model.put("existingUsers", mapper.writeValueAsString(getExistingUsers())); model.put("sortByList", mapper.writeValueAsString(getSortByList())); } catch (Exception ex) { - logger.error(EELFLoggerDelegate.errorLogger, "welcome: failed to write JSON" + ex.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "welcome: failed to write JSON", ex); } return new ModelAndView(getViewName(), model); } @RequestMapping(value = { "/post_search_sample" }, method = RequestMethod.GET) - public void getPostSearchProfile(HttpServletRequest request, HttpServletResponse response, + public void getPostSearchProfile(HttpServletResponse response, @ModelAttribute("postSearchBean") PostSearchBean postSearchBean) { - Map<String, Object> model = new HashMap<String, Object>(); - + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); try { postSearchBean = new PostSearchBean(); @@ -123,13 +122,12 @@ public class PostSearchController extends RestrictedBaseController { JSONObject j = new JSONObject(msg); response.getWriter().write(j.toString()); } catch (Exception ex) { - logger.error(EELFLoggerDelegate.errorLogger, "getPostSearchProfile: failed to write JSON" + ex.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "getPostSearchProfile: failed to write JSON", ex); } - } @SuppressWarnings({ "unchecked", "rawtypes" }) - private HashMap getExistingUsers() throws Exception { + private HashMap getExistingUsers() throws IOException { HashMap existingUsers = new HashMap(); // get the list of user ids in the system @@ -149,7 +147,7 @@ public class PostSearchController extends RestrictedBaseController { } @RequestMapping(value = { "/post_search/search" }, method = RequestMethod.POST) - public ModelAndView search(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView search(HttpServletRequest request, HttpServletResponse response) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -169,7 +167,7 @@ public class PostSearchController extends RestrictedBaseController { out.write(j.toString()); } catch (Exception ex) { - logger.error(EELFLoggerDelegate.errorLogger, "search: failed to send search result" + ex.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "search: failed to send search result", ex); } return null; @@ -191,7 +189,7 @@ public class PostSearchController extends RestrictedBaseController { } // getSortByList private SearchResult loadSearchResultData(HttpServletRequest request, PostSearchBean searchCriteria) - throws Exception { + throws NamingException { return ldapService.searchPost(searchCriteria.getUser(), searchCriteria.getSortBy1(), searchCriteria.getSortBy2(), searchCriteria.getSortBy3(), searchCriteria.getPageNo(), searchCriteria.getNewDataSize(), UserUtils.getUserSession(request).getId().intValue()); @@ -205,13 +203,14 @@ public class PostSearchController extends RestrictedBaseController { JsonNode root = mapper.readTree(request.getReader()); PostSearchBean postSearch = mapper.readValue(root.get("postSearchBean").toString(), PostSearchBean.class); String errorMsg = "{}"; - try{ + try { postSearchService.process(request, postSearch); postSearch.setSearchResult(loadSearchResultData(request, postSearch)); - }catch(Exception e){ - errorMsg=e.getMessage(); - logger.error(EELFLoggerDelegate.errorLogger,"Exception occurred while performing PostSearchController.process. Details:", e); - } + } catch (Exception e) { + errorMsg = e.getMessage(); + logger.error(EELFLoggerDelegate.errorLogger, + "Exception occurred while performing PostSearchController.process. Details:", e); + } logger.info(EELFLoggerDelegate.auditLogger, "Import new user from webphone "); response.setCharacterEncoding("UTF-8"); response.setContentType("application / json"); @@ -220,10 +219,9 @@ public class PostSearchController extends RestrictedBaseController { PrintWriter out = response.getWriter(); String postSearchString = mapper.writeValueAsString(postSearch); JSONObject j = new JSONObject("{postSearchBean: " + postSearchString + ",existingUsers: " - + mapper.writeValueAsString(getExistingUsers()) + ",errorMsg:"+errorMsg+"}"); + + mapper.writeValueAsString(getExistingUsers()) + ",errorMsg:" + errorMsg + "}"); out.write(j.toString()); - return null; } } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java index e1f70c2a..c83e926e 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -39,7 +39,6 @@ package org.onap.portalapp.controller.core; import java.io.IOException; import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -77,31 +76,30 @@ public class ProfileController extends RestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ProfileController.class); @Autowired - UserProfileService service; + private UserProfileService service; @Autowired - UserService userService; + private UserService userService; @Autowired - RoleService roleService; + private RoleService roleService; private String viewName; @RequestMapping(value = { "/profile" }, method = RequestMethod.GET) - public ModelAndView profile(HttpServletRequest request, HttpServletResponse response) throws Exception{ + public ModelAndView profile(HttpServletRequest request) throws IOException { Map<String, Object> model = new HashMap<String, Object>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); - User profile = null; - Long profileId = null; - + User profile; + Long profileId; if (request.getRequestURI().indexOf("self_profile.htm") > -1) { profile = UserUtils.getUserSession(request); profileId = profile.getId(); } else { profileId = Long.parseLong(request.getParameter("profile_id")); - profile = (User) userService.getUser(String.valueOf(profileId)); + profile = userService.getUser(String.valueOf(profileId)); } try { @@ -118,15 +116,13 @@ public class ProfileController extends RestrictedBaseController { } @RequestMapping(value = { "/self_profile" }, method = RequestMethod.GET) - public ModelAndView self_profile(HttpServletRequest request) throws Exception{ - Map<String, Object> model = new HashMap<String, Object>(); + public ModelAndView selfProfile(HttpServletRequest request) throws Exception{ + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); - User profile = null; Long profileId = null; User user = UserUtils.getUserSession(request); - - profile = UserUtils.getUserSession(request); + User profile = UserUtils.getUserSession(request); try { model.put("stateList", mapper.writeValueAsString(getStates())); model.put("countries", mapper.writeValueAsString(getCountries())); @@ -135,21 +131,19 @@ public class ProfileController extends RestrictedBaseController { model.put("profile", mapper.writeValueAsString(profile)); model.put("profileId", mapper.writeValueAsString(profileId)); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "self_profile: failed to write JSON" + e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "self_profile: failed to write JSON", e); } return new ModelAndView("profile", "model", model); } @RequestMapping(value = { "/get_self_profile" }, method = RequestMethod.GET) - public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) throws Exception{ + public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<String, Object>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); - User profile = null; Long profileId = null; - - profile = (User) UserUtils.getUserSession(request); + User profile = UserUtils.getUserSession(request); try { model.put("stateList", mapper.writeValueAsString(getStates())); model.put("countries", mapper.writeValueAsString(getCountries())); @@ -161,26 +155,25 @@ public class ProfileController extends RestrictedBaseController { JSONObject j = new JSONObject(msg); response.getWriter().write(j.toString()); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "getSelfProfile: failed to write JSON" + e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "getSelfProfile: failed to write JSON", e); } } @RequestMapping(value = { "/get_profile" }, method = RequestMethod.GET) - public void GetUser(HttpServletRequest request, HttpServletResponse response) { - Map<String, Object> model = new HashMap<String, Object>(); + public void getUser(HttpServletRequest request, HttpServletResponse response) { + Map<String, Object> model = new HashMap<>(); User user = UserUtils.getUserSession(request); ObjectMapper mapper = new ObjectMapper(); try { - User profile = null; - Long profileId = null; + User profile; + Long profileId; if (request.getRequestURI().indexOf("self_profile.htm") > -1) { profile = UserUtils.getUserSession(request); profileId = profile.getId(); } else { profileId = Long.parseLong(request.getParameter("profile_id")); - profile = (User) userService.getUser(String.valueOf(profileId)); - + profile = userService.getUser(String.valueOf(profileId)); } model.put("stateList", mapper.writeValueAsString(getStates())); model.put("countries", mapper.writeValueAsString(getCountries())); @@ -193,7 +186,7 @@ public class ProfileController extends RestrictedBaseController { response.getWriter().write(j.toString()); } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "GetUser: failed to write JSON" + e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "getUser: failed to write JSON", e); } } @@ -213,7 +206,6 @@ public class ProfileController extends RestrictedBaseController { Long profileId = Long.parseLong(request.getParameter("profile_id")); User domainUser = (User) userService.getUser(String.valueOf(profileId)); - // user.setRoles(domainUser.getRoles()); user.setPseudoRoles(domainUser.getPseudoRoles()); user.setUserApps(domainUser.getUserApps()); if (!selectedCountry.equals("")) { @@ -226,13 +218,14 @@ public class ProfileController extends RestrictedBaseController { user.setTimeZoneId(Long.parseLong(selectedTimeZone)); } service.saveUser(user); - logger.info(EELFLoggerDelegate.auditLogger, "Save user's profile for user " + profileId); + logger.info(EELFLoggerDelegate.auditLogger, "Save profile for user {}", profileId); response.setCharacterEncoding("UTF-8"); response.setContentType("application / json"); PrintWriter out = response.getWriter(); out.write("" + profileId); return null; } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveProfile failed", e); response.setCharacterEncoding("UTF-8"); try { PrintWriter out = response.getWriter(); @@ -245,7 +238,7 @@ public class ProfileController extends RestrictedBaseController { } @RequestMapping(value = { "/profile/removeRole" }, method = RequestMethod.POST) - public ModelAndView removeRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView removeRole(HttpServletRequest request, HttpServletResponse response) throws IOException { logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save"); try { @@ -257,7 +250,7 @@ public class ProfileController extends RestrictedBaseController { String profileId = request.getParameter("profile_id"); - User domainUser = (User) userService.getUser(profileId); + User domainUser = userService.getUser(profileId); domainUser.removeRole(role.getId()); @@ -275,7 +268,7 @@ public class ProfileController extends RestrictedBaseController { PrintWriter out = response.getWriter(); - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); model.put("profile", mapper.writeValueAsString(domainUser)); JSONObject j = new JSONObject(mapper.writeValueAsString(domainUser)); @@ -283,18 +276,16 @@ public class ProfileController extends RestrictedBaseController { return null; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "removeRole" + e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "removeRole failed", e); response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.write(e.getMessage()); return null; } - } @RequestMapping(value = { "/profile/addNewRole" }, method = RequestMethod.POST) - public ModelAndView addNewRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView addNewRole(HttpServletRequest request, HttpServletResponse response) throws IOException { logger.info(EELFLoggerDelegate.debugLogger, "ProfileController.save" ); try { @@ -304,7 +295,7 @@ public class ProfileController extends RestrictedBaseController { JsonNode root = mapper.readTree(request.getReader()); Role role = mapper.readValue(root.get("role").toString(), Role.class); String profileId = request.getParameter("profile_id"); - User domainUser = (User) userService.getUser(profileId); + User domainUser = userService.getUser(profileId); domainUser.addRole(role); service.saveUser(domainUser); /*If removing roles on the current logged in user, we need to update the user value in session*/ @@ -319,7 +310,7 @@ public class ProfileController extends RestrictedBaseController { request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); model.put("profile", mapper.writeValueAsString(domainUser)); JSONObject j = new JSONObject(mapper.writeValueAsString(domainUser)); @@ -327,7 +318,7 @@ public class ProfileController extends RestrictedBaseController { return null; } catch (Exception e) { - logger.error(EELFLoggerDelegate.errorLogger, "addNewRole" + e.getMessage()); + logger.error(EELFLoggerDelegate.errorLogger, "addNewRole failed", e); response.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); @@ -337,10 +328,12 @@ public class ProfileController extends RestrictedBaseController { } + @Override public String getViewName() { return viewName; } + @Override public void setViewName(String viewName) { this.viewName = viewName; } @@ -361,7 +354,7 @@ public class ProfileController extends RestrictedBaseController { } @SuppressWarnings("rawtypes") - public List getAvailableRoles(String requestedLoginId) throws Exception { + public List getAvailableRoles(String requestedLoginId) throws IOException { return roleService.getAvailableRoles(requestedLoginId); } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java index 3f933af8..2459e598 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileSearchController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -77,14 +77,14 @@ public class ProfileSearchController extends RestrictedBaseController { private UserProfileService service; @Autowired - UserService userService; + private UserService userService; @Autowired private FnMenuService fnMenuService; @RequestMapping(value = { "/profile_search" }, method = RequestMethod.GET) public ModelAndView profileSearch(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); List<User> profileList = null; logger.info(EELFLoggerDelegate.applicationLogger, "Initiating ProfileSearch in ProfileSearchController"); @@ -116,7 +116,7 @@ public class ProfileSearchController extends RestrictedBaseController { @RequestMapping(value = { "/get_user_pagination" }, method = RequestMethod.GET) public void getUserPagination(HttpServletRequest request, HttpServletResponse response) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); logger.info(EELFLoggerDelegate.applicationLogger, "Initiating get_user_pagination in ProfileSearchController"); int pageNum = Integer.parseInt(request.getParameter("pageNum")); @@ -141,9 +141,9 @@ public class ProfileSearchController extends RestrictedBaseController { @SuppressWarnings("unchecked") private Map<String, Object> setDashboardData(HttpServletRequest request) throws Exception { ObjectMapper mapper = new ObjectMapper(); - Map<String, Object> model = new HashMap<String, Object>(); - List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>(); - List<MenuData> parentList = new ArrayList<MenuData>(); + Map<String, Object> model = new HashMap<>(); + List<List<MenuData>> childItemList = new ArrayList<>(); + List<MenuData> parentList = new ArrayList<>(); logger.info(EELFLoggerDelegate.applicationLogger, "Initiating setDashboardData in ProfileSearchController"); HttpSession session = request.getSession(); try { @@ -164,7 +164,7 @@ public class ProfileSearchController extends RestrictedBaseController { logger.info(EELFLoggerDelegate.applicationLogger, "Initiating toggleProfileActive in ProfileSearchController"); String userId = request.getParameter("profile_id"); - User user = (User) userService.getUser(userId); + User user = userService.getUser(userId); user.setActive(!user.getActive()); service.saveUser(user); logger.info(EELFLoggerDelegate.auditLogger, diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java index 56cea604..b1377007 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -82,17 +82,19 @@ public class RoleController extends RestrictedBaseController { private String viewName; @RequestMapping(value = { "/role" }, method = RequestMethod.GET) - public ModelAndView role(HttpServletRequest request) throws Exception { - Map<String, Object> model = new HashMap<String, Object>(); + public ModelAndView role(HttpServletRequest request) throws IOException { + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); - - Role role = roleService.getRole(user.getOrgUserId(),new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + Role role = roleService.getRole(user.getOrgUserId(), + new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); logger.info("role_id" + role.getId()); try { - model.put("availableRoleFunctions", mapper.writeValueAsString(roleService.getRoleFunctions(user.getOrgUserId()))); - model.put("availableRoles", mapper.writeValueAsString(roleService.getAvailableChildRoles(user.getOrgUserId(),role.getId()))); + model.put("availableRoleFunctions", + mapper.writeValueAsString(roleService.getRoleFunctions(user.getOrgUserId()))); + model.put("availableRoles", + mapper.writeValueAsString(roleService.getAvailableChildRoles(user.getOrgUserId(), role.getId()))); model.put("role", mapper.writeValueAsString(role)); } catch (Exception e) { logger.error("role: failed", e); @@ -102,16 +104,19 @@ public class RoleController extends RestrictedBaseController { } @RequestMapping(value = { "/get_role" }, method = RequestMethod.GET) - public void getRole(HttpServletRequest request, HttpServletResponse response) throws Exception { - Map<String, Object> model = new HashMap<String, Object>(); + public void getRole(HttpServletRequest request, HttpServletResponse response) throws IOException { + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); - Role role = roleService.getRole(user.getOrgUserId(),new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + Role role = roleService.getRole(user.getOrgUserId(), + new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); logger.info(EELFLoggerDelegate.applicationLogger, "role_id" + role.getId()); try { - model.put("availableRoleFunctions", mapper.writeValueAsString(roleService.getRoleFunctions(user.getOrgUserId()))); - model.put("availableRoles", mapper.writeValueAsString(roleService.getAvailableChildRoles(user.getOrgUserId(),role.getId()))); + model.put("availableRoleFunctions", + mapper.writeValueAsString(roleService.getRoleFunctions(user.getOrgUserId()))); + model.put("availableRoles", + mapper.writeValueAsString(roleService.getAvailableChildRoles(user.getOrgUserId(), role.getId()))); model.put("role", mapper.writeValueAsString(role)); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -149,11 +154,10 @@ public class RoleController extends RestrictedBaseController { List<RoleFunction> roleFunctions = mapper.readValue(root.get("roleFunctions").toString(), TypeFactory.defaultInstance().constructCollectionType(List.class, RoleFunction.class)); - Role domainRole = null; + Role domainRole; if (role.getId() != null) { doAuditLog("saveRole: updating existing role {}", role.getId()); - domainRole = roleService.getRole(user.getOrgUserId(),role.getId()); - + domainRole = roleService.getRole(user.getOrgUserId(), role.getId()); domainRole.setName(role.getName()); domainRole.setPriority(role.getPriority()); } else { @@ -167,23 +171,19 @@ public class RoleController extends RestrictedBaseController { domainRole = new Role(); domainRole.setName(role.getName()); domainRole.setPriority(role.getPriority()); - if(role.getChildRoles() != null && role.getChildRoles().size() > 0 ){ -// if (role.getChildRoles().size() > 0 ) { + if (role.getChildRoles() != null && role.getChildRoles().size() > 0) { for (Object childRole : childRoles) { domainRole.addChildRole((Role) childRole); } -// } } - if(role.getRoleFunctions() != null && role.getRoleFunctions().size() > 0){ -// if (role.getRoleFunctions().size() > 0) { + if (role.getRoleFunctions() != null && role.getRoleFunctions().size() > 0) { for (Object roleFunction : roleFunctions) { domainRole.addRoleFunction((RoleFunction) roleFunction); } -// } } } - roleService.saveRole(user.getOrgUserId(),domainRole); + roleService.saveRole(user.getOrgUserId(), domainRole); String responseString = mapper.writeValueAsString(domainRole); j = new JSONObject("{role: " + responseString + "}"); @@ -201,7 +201,7 @@ public class RoleController extends RestrictedBaseController { } @RequestMapping(value = { "/role/removeRoleFunction" }, method = RequestMethod.POST) - public ModelAndView removeRoleFunction(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView removeRoleFunction(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction"); try { @@ -211,13 +211,14 @@ public class RoleController extends RestrictedBaseController { JsonNode root = mapper.readTree(request.getReader()); RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class); - Role domainRole = roleService.getRole(user.getOrgUserId(),new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + Role domainRole = roleService.getRole(user.getOrgUserId(), + new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); doAuditLog("Remove role function {} from role {}", roleFunction.getCode(), ServletRequestUtils.getIntParameter(request, "role_id", 0)); domainRole.removeRoleFunction(roleFunction.getCode()); - roleService.saveRole(user.getOrgUserId(),domainRole); + roleService.saveRole(user.getOrgUserId(), domainRole); response.setCharacterEncoding("UTF-8"); response.setContentType("application/json"); @@ -237,7 +238,7 @@ public class RoleController extends RestrictedBaseController { } @RequestMapping(value = { "/role/addRoleFunction" }, method = RequestMethod.POST) - public ModelAndView addRoleFunction(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView addRoleFunction(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction"); try { @@ -247,11 +248,12 @@ public class RoleController extends RestrictedBaseController { JsonNode root = mapper.readTree(request.getReader()); RoleFunction roleFunction = mapper.readValue(root.get("roleFunction").toString(), RoleFunction.class); - Role domainRole = roleService.getRole(user.getOrgUserId(),new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + Role domainRole = roleService.getRole(user.getOrgUserId(), + new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); domainRole.addRoleFunction(roleFunction); - roleService.saveRole(user.getOrgUserId(),domainRole); + roleService.saveRole(user.getOrgUserId(), domainRole); doAuditLog("Add role function {} to role {}", roleFunction.getCode(), ServletRequestUtils.getIntParameter(request, "role_id", 0)); @@ -273,7 +275,7 @@ public class RoleController extends RestrictedBaseController { } @RequestMapping(value = { "/role/removeChildRole" }, method = RequestMethod.POST) - public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeChileRole"); try { @@ -282,13 +284,14 @@ public class RoleController extends RestrictedBaseController { JsonNode root = mapper.readTree(request.getReader()); Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class); - Role domainRole = roleService.getRole(user.getOrgUserId(),new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); + Role domainRole = roleService.getRole(user.getOrgUserId(), + new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0))); domainRole.removeChildRole(childRole.getId()); doAuditLog("remove child role {} from role {}", childRole.getId(), ServletRequestUtils.getIntParameter(request, "role_id", 0)); - roleService.saveRole(user.getOrgUserId(),domainRole); + roleService.saveRole(user.getOrgUserId(), domainRole); response.setCharacterEncoding("UTF-8"); response.setContentType("application/json"); @@ -308,7 +311,7 @@ public class RoleController extends RestrictedBaseController { } @RequestMapping(value = { "/role/addChildRole" }, method = RequestMethod.POST) - public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.addChileRole"); try { @@ -317,13 +320,13 @@ public class RoleController extends RestrictedBaseController { mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); Role childRole = mapper.readValue(root.get("childRole").toString(), Role.class); - long role_id = new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)); + Long role_id = new Long(ServletRequestUtils.getIntParameter(request, "role_id", 0)); - Role domainRole = roleService.getRole(user.getOrgUserId(),role_id ); + Role domainRole = roleService.getRole(user.getOrgUserId(), role_id); domainRole.addChildRole(childRole); - roleService.saveRole(user.getOrgUserId(),domainRole); + roleService.saveRole(user.getOrgUserId(), domainRole); doAuditLog("Add child role {} to role {}", childRole.getId(), ServletRequestUtils.getIntParameter(request, "role_id", 0)); @@ -345,8 +348,8 @@ public class RoleController extends RestrictedBaseController { } /** - * Sets context with begin and end timestamps at current date & time, writes - * the specified message and parameters to the audit log, then removes the + * Sets context with begin and end timestamps at current date & time, writes the + * specified message and parameters to the audit log, then removes the * timestamps from context. * * @param message @@ -362,11 +365,14 @@ public class RoleController extends RestrictedBaseController { MDC.remove(SystemProperties.AUDITLOG_END_TIMESTAMP); } + @Override public String getViewName() { return viewName; } + @Override public void setViewName(String viewName) { this.viewName = viewName; } -}
\ No newline at end of file + +} diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java index e1e3e132..ccdab9f0 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,6 +37,7 @@ */ package org.onap.portalapp.controller.core; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -64,138 +65,136 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Controller @RequestMapping("/") public class RoleFunctionListController extends RestrictedBaseController { - + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleFunctionListController.class); @Autowired private RoleService service; - + private String viewName; - @RequestMapping(value = {"/role_function_list" }, method = RequestMethod.GET) + @RequestMapping(value = { "/role_function_list" }, method = RequestMethod.GET) public ModelAndView welcome(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); - - try { - model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions(user.getOrgUserId()))); + model.put("availableRoleFunctions", + mapper.writeValueAsString(service.getRoleFunctions(user.getOrgUserId()))); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "welcome failed", e); } - - return new ModelAndView(getViewName(),model); + return new ModelAndView(getViewName(), model); } - - @RequestMapping(value = {"/get_role_functions" }, method = RequestMethod.GET) - public void getRoleFunctionList(HttpServletRequest request,HttpServletResponse response) { - Map<String, Object> model = new HashMap<String, Object>(); - ObjectMapper mapper = new ObjectMapper(); + + @RequestMapping(value = { "/get_role_functions" }, method = RequestMethod.GET) + public void getRoleFunctionList(HttpServletRequest request, HttpServletResponse response) { + Map<String, Object> model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); try { - model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions(user.getOrgUserId()))); + model.put("availableRoleFunctions", + mapper.writeValueAsString(service.getRoleFunctions(user.getOrgUserId()))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); + response.getWriter().write(j.toString()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getROleFunctionList failed", e); } - } - - @RequestMapping(value = {"/role_function_list/saveRoleFunction" }, method = RequestMethod.POST) - public void saveRoleFunction(HttpServletRequest request, - HttpServletResponse response, @RequestBody String roleFunc) throws Exception { + + @RequestMapping(value = { "/role_function_list/saveRoleFunction" }, method = RequestMethod.POST) + public void saveRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) + throws IOException { ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); String restCallStatus = ""; try { String data = roleFunc; - RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class); + RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class); String code = availableRoleFunction.getCode(); - RoleFunction domainRoleFunction = service.getRoleFunction(user.getOrgUserId(),code); + RoleFunction domainRoleFunction = service.getRoleFunction(user.getOrgUserId(), code); domainRoleFunction.setName(availableRoleFunction.getName()); - domainRoleFunction.setCode(code); - restCallStatus="success"; - service.saveRoleFunction(user.getOrgUserId(),domainRoleFunction); + domainRoleFunction.setCode(code); + restCallStatus = "success"; + service.saveRoleFunction(user.getOrgUserId(), domainRoleFunction); } catch (Exception e) { - restCallStatus="fail"; logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e); - throw new Exception("failed while Saving RoleFunction"); + throw new IOException(e); } JsonMessage msg = new JsonMessage(mapper.writeValueAsString(restCallStatus)); JSONObject j = new JSONObject(msg); response.getWriter().write(j.toString()); } - - @RequestMapping(value = {"/role_function_list/addRoleFunction" }, method = RequestMethod.POST) - public void addRoleFunction(HttpServletRequest request, - HttpServletResponse response, @RequestBody String roleFunc) throws Exception { + + @RequestMapping(value = { "/role_function_list/addRoleFunction" }, method = RequestMethod.POST) + public void addRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) + throws IOException { ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); String restCallStatus = ""; - boolean canSave=true; + boolean canSave = true; try { String data = roleFunc; - RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class); - String code = availableRoleFunction.getCode(); + RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class); + String code = availableRoleFunction.getCode(); List<RoleFunction> currentRoleFunction = service.getRoleFunctions(user.getOrgUserId()); - restCallStatus="success"; - for(RoleFunction roleF:currentRoleFunction){ - if(roleF.getCode().equals(code)){ - restCallStatus="code exists"; - canSave=false; + restCallStatus = "success"; + for (RoleFunction roleF : currentRoleFunction) { + if (roleF.getCode().equals(code)) { + restCallStatus = "code exists"; + canSave = false; break; } } - if(canSave) - service.saveRoleFunction(user.getOrgUserId(),availableRoleFunction); + if (canSave) + service.saveRoleFunction(user.getOrgUserId(), availableRoleFunction); } catch (Exception e) { - restCallStatus="fail"; logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunction failed", e); - throw new Exception(e.getMessage()); + throw new IOException(e); } JsonMessage msg = new JsonMessage(mapper.writeValueAsString(restCallStatus)); JSONObject j = new JSONObject(msg); response.getWriter().write(j.toString()); } - @RequestMapping(value = {"/role_function_list/removeRoleFunction" }, method = RequestMethod.POST) - public void removeRoleFunction(HttpServletRequest request, - HttpServletResponse response, @RequestBody String roleFunc) throws Exception { + @RequestMapping(value = { "/role_function_list/removeRoleFunction" }, method = RequestMethod.POST) + public void removeRoleFunction(HttpServletRequest request, HttpServletResponse response, + @RequestBody String roleFunc) throws IOException { ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); String restCallStatus = ""; try { String data = roleFunc; - + RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class); - RoleFunction domainRoleFunction = service.getRoleFunction(user.getOrgUserId(),availableRoleFunction.getCode()); - - service.deleteRoleFunction(user.getOrgUserId(),domainRoleFunction); + RoleFunction domainRoleFunction = service.getRoleFunction(user.getOrgUserId(), + availableRoleFunction.getCode()); + + service.deleteRoleFunction(user.getOrgUserId(), domainRoleFunction); logger.info(EELFLoggerDelegate.auditLogger, "Remove role function " + domainRoleFunction.getName()); - restCallStatus="success"; + restCallStatus = "success"; } catch (Exception e) { - restCallStatus="fail"; logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed", e); - throw new Exception(e.getMessage()); + throw new IOException(e); } JsonMessage msg = new JsonMessage(mapper.writeValueAsString(restCallStatus)); JSONObject j = new JSONObject(msg); response.getWriter().write(j.toString()); } + @Override public String getViewName() { return viewName; } + + @Override public void setViewName(String viewName) { this.viewName = viewName; } - - + } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleListController.java index 13310b07..e7682809 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleListController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,6 +37,7 @@ */ package org.onap.portalapp.controller.core; +import java.io.IOException; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; @@ -70,61 +71,52 @@ public class RoleListController extends RestrictedBaseController { @Autowired private RoleService service; - + private String viewName; - - @RequestMapping(value = {"/role_list" }, method = RequestMethod.GET) + + @RequestMapping(value = { "/role_list" }, method = RequestMethod.GET) public ModelAndView getRoleList(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); - ObjectMapper mapper = new ObjectMapper(); + Map<String, Object> model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); - - try { model.put("availableRoles", mapper.writeValueAsString(service.getAvailableRoles(user.getOrgUserId()))); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getRoleList failed", e); } - - return new ModelAndView(getViewName(),model); + return new ModelAndView(getViewName(), model); } - - @RequestMapping(value = {"/get_roles" }, method = RequestMethod.GET) + + @RequestMapping(value = { "/get_roles" }, method = RequestMethod.GET) public void getRoles(HttpServletRequest request, HttpServletResponse response) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); - - try { model.put("availableRoles", mapper.writeValueAsString(service.getAvailableRoles(user.getOrgUserId()))); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); + response.getWriter().write(j.toString()); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "getRoles failed", e); } } - - - @RequestMapping(value = {"/role_list/toggleRole" }, method = RequestMethod.POST) - public ModelAndView toggleRole(HttpServletRequest request, - HttpServletResponse response) throws Exception { - User user = UserUtils.getUserSession(request); - + @RequestMapping(value = { "/role_list/toggleRole" }, method = RequestMethod.POST) + public ModelAndView toggleRole(HttpServletRequest request, HttpServletResponse response) throws IOException { + User user = UserUtils.getUserSession(request); try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); Role role = mapper.readValue(root.get("role").toString(), Role.class); - Role domainRole = service.getRole(user.getOrgUserId(),role.getId()); - //role. toggle active ind + Role domainRole = service.getRole(user.getOrgUserId(), role.getId()); + // role. toggle active ind boolean active = domainRole.getActive(); domainRole.setActive(!active); - - service.saveRole(user.getOrgUserId(),domainRole); + + service.saveRole(user.getOrgUserId(), domainRole); logger.info(EELFLoggerDelegate.auditLogger, "Toggle active status for role " + domainRole.getId()); response.setCharacterEncoding("UTF-8"); @@ -133,38 +125,35 @@ public class RoleListController extends RestrictedBaseController { PrintWriter out = response.getWriter(); String responseString = mapper.writeValueAsString(service.getAvailableRoles(user.getOrgUserId())); - JSONObject j = new JSONObject("{availableRoles: "+responseString+"}"); - + JSONObject j = new JSONObject("{availableRoles: " + responseString + "}"); + out.write(j.toString()); - + return null; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "toggleRole failed", e); response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.write(e.getMessage()); return null; } } - - @RequestMapping(value = {"/role_list/removeRole" }, method = RequestMethod.POST) - public ModelAndView removeRole(HttpServletRequest request, - HttpServletResponse response) throws Exception { + + @RequestMapping(value = { "/role_list/removeRole" }, method = RequestMethod.POST) + public ModelAndView removeRole(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); try { - ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); Role role = mapper.readValue(root.get("role").toString(), Role.class); - Role domainRole = service.getRole(user.getOrgUserId(),role.getId()); - - service.deleteDependcyRoleRecord(user.getOrgUserId(),role.getId()); - service.deleteRole(user.getOrgUserId(),domainRole); + Role domainRole = service.getRole(user.getOrgUserId(), role.getId()); + + service.deleteDependcyRoleRecord(user.getOrgUserId(), role.getId()); + service.deleteRole(user.getOrgUserId(), domainRole); logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + domainRole.getId()); response.setCharacterEncoding("UTF-8"); @@ -172,11 +161,11 @@ public class RoleListController extends RestrictedBaseController { request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); - + String responseString = mapper.writeValueAsString(service.getAvailableRoles(user.getOrgUserId())); - JSONObject j = new JSONObject("{availableRoles: "+responseString+"}"); + JSONObject j = new JSONObject("{availableRoles: " + responseString + "}"); out.write(j.toString()); - + return null; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "removeRole failed", e); @@ -189,9 +178,12 @@ public class RoleListController extends RestrictedBaseController { } + @Override public String getViewName() { return viewName; } + + @Override public void setViewName(String viewName) { this.viewName = viewName; } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SDKLoginController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SDKLoginController.java index fe24f3c3..0cfc6cd8 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SDKLoginController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SDKLoginController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,6 +37,7 @@ */ package org.onap.portalapp.controller.core; +import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -68,19 +69,19 @@ public class SDKLoginController extends UnRestrictedBaseController { private String viewName; @RequestMapping(value = { "/login.htm" }, method = RequestMethod.GET) - public ModelAndView login(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + public ModelAndView login() { + Map<String, Object> model = new HashMap<>(); return new ModelAndView("login", "model", model); } @RequestMapping(value = { "/login_external.htm" }, method = RequestMethod.GET) - public ModelAndView externalLogin(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + public ModelAndView externalLogin() { + Map<String, Object> model = new HashMap<>(); return new ModelAndView("login_external", "model", model); } @RequestMapping(value = { "/login_external" }, method = RequestMethod.POST) - public ModelAndView doexternalLogin(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView doexternalLogin(HttpServletRequest request, HttpServletResponse response) throws IOException { return loginStrategy.doExternalLogin(request, response); } @@ -98,10 +99,12 @@ public class SDKLoginController extends UnRestrictedBaseController { PortalTimeoutHandler.sessionCreated(jSessionId, jSessionId, AppUtils.getSession(request)); } + @Override public String getViewName() { return viewName; } + @Override public void setViewName(String viewName) { this.viewName = viewName; } 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 80fd67d9..17630643 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 @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -81,6 +81,9 @@ public class SingleSignOnController extends UnRestrictedBaseController { @Autowired private LoginStrategy loginStrategy; + @Autowired + private RoleService roleService; + private String viewName; private String welcomeView; @@ -91,13 +94,10 @@ public class SingleSignOnController extends UnRestrictedBaseController { public void setWelcomeView(String welcomeView) { this.welcomeView = welcomeView; } - - @Autowired - RoleService roleService; /** - * Handles requests directed to the single sign-on page by the session - * timeout interceptor. + * Handles requests directed to the single sign-on page by the session timeout + * interceptor. * * @param request * @return Redirect to an appropriate address @@ -106,8 +106,8 @@ public class SingleSignOnController extends UnRestrictedBaseController { @RequestMapping(value = { "/single_signon.htm" }, method = RequestMethod.GET) public ModelAndView singleSignOnLogin(HttpServletRequest request) throws Exception { - Map<String, String> model = new HashMap<String, String>(); - HashMap<String, String> additionalParamsMap = new HashMap<String, String>(); + Map<String, String> model = new HashMap<>(); + HashMap<String, String> additionalParamsMap = new HashMap<>(); LoginBean commandBean = new LoginBean(); // SessionTimeoutInterceptor sets these parameters @@ -115,8 +115,7 @@ public class SingleSignOnController extends UnRestrictedBaseController { String redirectToPortal = request.getParameter("redirectToPortal"); if (isLoginCookieExist(request) && redirectToPortal == null) { - HttpSession session = null; - session = AppUtils.getSession(request); + HttpSession session = AppUtils.getSession(request); User user = UserUtils.getUserSession(request); if (session == null || user == null) { @@ -126,7 +125,7 @@ public class SingleSignOnController extends UnRestrictedBaseController { commandBean = getLoginService().findUser(commandBean, (String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY), additionalParamsMap); - List<RoleFunction> roleFunctionList= roleService.getRoleFunctions(userId); + List<RoleFunction> roleFunctionList = roleService.getRoleFunctions(userId); if (commandBean.getUser() == null) { String loginErrorMessage = (commandBean.getLoginErrorMessage() != null) ? commandBean.getLoginErrorMessage() @@ -165,19 +164,17 @@ public class SingleSignOnController extends UnRestrictedBaseController { } else { /* - * Login cookie not found, or redirect-to-portal parameter was - * found. + * Login cookie not found, or redirect-to-portal parameter was found. * - * Redirect the user to the portal with a suitable return URL. The - * forwardURL parameter that arrives as a parameter is a partial - * (not absolute) request path for a page in the application. The - * challenge here is to compute the correct absolute path for the - * original request so the portal can redirect the user back to the - * right place. If the application sits behind WebJunction, or if - * separate FE-BE hosts are used, then the URL yielded by the - * request has a host name that is not reachable by the user. + * Redirect the user to the portal with a suitable return URL. The forwardURL + * parameter that arrives as a parameter is a partial (not absolute) request + * path for a page in the application. The challenge here is to compute the + * correct absolute path for the original request so the portal can redirect the + * user back to the right place. If the application sits behind WebJunction, or + * if separate FE-BE hosts are used, then the URL yielded by the request has a + * host name that is not reachable by the user. */ - String returnToAppUrl = null; + String returnToAppUrl; if (SystemProperties.containsProperty(SystemProperties.APP_BASE_URL)) { // New feature as of 1610, release 3.3.3: // application can publish a base URL in system.properties @@ -191,7 +188,7 @@ public class SingleSignOnController extends UnRestrictedBaseController { // This is the controller for the single_signon.htm page, so the // replace // should always find the specified token. - returnToAppUrl = ((HttpServletRequest) request).getRequestURL().toString().replace("single_signon.htm", + returnToAppUrl = request.getRequestURL().toString().replace("single_signon.htm", forwardURL); logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: computed redirectURL {}", returnToAppUrl); @@ -217,7 +214,7 @@ public class SingleSignOnController extends UnRestrictedBaseController { public boolean isLoginCookieExist(HttpServletRequest request) { Cookie ep = WebUtils.getCookie(request, LoginStrategy.EP_SERVICE); - return (ep != null); + return ep != null; } public String getPortalJSessionId(HttpServletRequest request) { @@ -229,10 +226,12 @@ public class SingleSignOnController extends UnRestrictedBaseController { return request.getSession().getId(); } + @Override public String getViewName() { return viewName; } + @Override public void setViewName(String viewName) { this.viewName = viewName; } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java index 13a59f12..df017288 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UsageListController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,9 +37,10 @@ */ package org.onap.portalapp.controller.core; +import java.io.IOException; import java.io.PrintWriter; -import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -67,7 +68,7 @@ public class UsageListController extends RestrictedBaseController { @SuppressWarnings({ "unchecked", "rawtypes" }) @RequestMapping(value = { "/usage_list" }, method = RequestMethod.GET) public ModelAndView usageList(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); HttpSession httpSession = request.getSession(); HashMap activeUsers = (HashMap) httpSession.getServletContext().getAttribute("activeUsers"); @@ -75,7 +76,7 @@ public class UsageListController extends RestrictedBaseController { activeUsers.put(httpSession.getId(), httpSession); httpSession.getServletContext().setAttribute("activeUsers", activeUsers); } - ArrayList<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers); + List<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers); JSONArray ja = new JSONArray(); try { for (UserRowBean userRowBean : rows) { @@ -112,7 +113,7 @@ public class UsageListController extends RestrictedBaseController { activeUsers.put(httpSession.getId(), httpSession); httpSession.getServletContext().setAttribute("activeUsers", activeUsers); } - ArrayList<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers); + List<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers); JSONArray ja = new JSONArray(); try { for (UserRowBean userRowBean : rows) { @@ -146,14 +147,14 @@ public class UsageListController extends RestrictedBaseController { @SuppressWarnings("rawtypes") @RequestMapping(value = { "/usage_list/removeSession" }, method = RequestMethod.GET) - public void removeSession(HttpServletRequest request, HttpServletResponse response) throws Exception { + public void removeSession(HttpServletRequest request, HttpServletResponse response) throws IOException { HashMap activeUsers = (HashMap) request.getSession().getServletContext().getAttribute("activeUsers"); UserRowBean data = new UserRowBean(); data.setSessionId(request.getParameter("deleteSessionId")); UsageUtils.getActiveUsersAfterDelete(activeUsers, data); HttpSession httpSession = request.getSession(); - ArrayList<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers); + List<UserRowBean> rows = UsageUtils.getActiveUsers(activeUsers); JSONArray ja = new JSONArray(); try { for (UserRowBean userRowBean : rows) { diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java index 99493266..f32fdda5 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/UserProfileController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,12 +37,11 @@ */ package org.onap.portalapp.controller.core; +import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; - import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.domain.Profile; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; @@ -70,8 +69,8 @@ public class UserProfileController extends RestrictedBaseController { private ProfileService service; @RequestMapping(value = { "/user_profile" }, method = RequestMethod.GET) - public ModelAndView userProfile(HttpServletRequest request) throws Exception { - Map<String, Object> model = new HashMap<String, Object>(); + public ModelAndView userProfile() throws IOException { + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); List<Profile> profileList = service.findAll(); try { diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java index 77a9b20e..a063969a 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/WelcomeController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -37,8 +37,6 @@ */ package org.onap.portalapp.controller.core; -import javax.servlet.http.HttpServletRequest; - import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -54,7 +52,7 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/") public class WelcomeController extends RestrictedBaseController { @RequestMapping(value = { "/welcome" }, method = RequestMethod.GET) - public ModelAndView welcome(HttpServletRequest request) { + public ModelAndView welcome() { final String defaultViewName = null; return new ModelAndView(defaultViewName); } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java index 2caabf21..e038a044 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java index 5182a398..316f35cd 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java index d567c008..fa1bcbeb 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastListController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CallflowController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CallflowController.java index 27a3003c..36528495 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CallflowController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CallflowController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CamundaCockpitController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CamundaCockpitController.java index a1ab6a52..cc83041c 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CamundaCockpitController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CamundaCockpitController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborateListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborateListController.java index 3dad8312..ebf31e65 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborateListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborateListController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java index 4a358555..204bdf7e 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/DS2SampleController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/DS2SampleController.java index 02547c35..f01c8a9e 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/DS2SampleController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/DS2SampleController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElasticSearchController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElasticSearchController.java index 758d8ab3..a53887e2 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElasticSearchController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElasticSearchController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java index a6afd2d6..34e4db7d 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/LeafletMapContoller.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/LeafletMapContoller.java index a22be15e..5ccfd3af 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/LeafletMapContoller.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/LeafletMapContoller.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java index 3b758207..d3277a71 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java index aea008ab..41b783cf 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java index 7245d027..3782751e 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ReportDashboardController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java index 41ac23b9..99a938d5 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/model/Result.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/model/Result.java index c59479bb..ea9dd951 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/model/Result.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/model/Result.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * 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 3f560312..1a28eeae 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 @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java index 1e0bdc2d..ad52c1c6 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogRegistry.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/IAdminAuthExtension.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/IAdminAuthExtension.java index fbdd8aa4..7ea8ac2d 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/IAdminAuthExtension.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/IAdminAuthExtension.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * 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 3aa7de59..9c77441d 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 @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java index e47f7342..ccabb12c 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/util/CustomLoggingFilter.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * |