diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-common')
30 files changed, 138 insertions, 187 deletions
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 fbb9cc5d..09cbb0ac 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 @@ -52,6 +52,8 @@ import org.onap.portalsdk.core.logging.aspect.AuditLog; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.rest.FavoritesClient; import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.onboarding.util.KeyConstants; +import org.onap.portalsdk.core.onboarding.util.KeyProperties; import org.onap.portalsdk.core.service.AppService; import org.onap.portalsdk.core.util.SystemProperties; import org.slf4j.MDC; @@ -109,7 +111,7 @@ public class FavoritesController extends RestrictedBaseController { appUserName = app.getUsername(); try { decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(), - SystemProperties.getProperty(SystemProperties.Decryption_Key)); + KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "FavoritesController.getFavorites failed while decrypting password", e); 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 bbd08c45..d41bf239 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 @@ -37,20 +37,16 @@ */ 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.UnRestrictedBaseController; -import org.onap.portalsdk.core.domain.User; -import org.onap.portalsdk.core.logging.aspect.MetricsLog; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; -import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; -import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.servlet.ModelAndView; @Controller @@ -59,8 +55,6 @@ 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 @@ -72,53 +66,12 @@ public class LogoutController extends UnRestrictedBaseController { public ModelAndView globalLogout(HttpServletRequest request) { ModelAndView modelView = null; try { - chatRoomLogout(request); request.getSession().invalidate(); - 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); + Map<String, Object> model = new HashMap<>(); + return new ModelAndView("login", "model", model); } 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 - * @return modelView - */ - @RequestMapping(value = { "/app_logout.htm" }, method = RequestMethod.GET) - public ModelAndView appLogout(HttpServletRequest request) { - ModelAndView modelView = null; - try { - chatRoomLogout(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 failed", e); - } - return modelView; - } - - @MetricsLog - public void chatRoomLogout(HttpServletRequest request) { - request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); - setUser(UserUtils.getUserSession(request)); - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - } 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 ff80d413..b58b6146 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 @@ -66,6 +66,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.ObjectMapper; @@ -90,7 +91,7 @@ public class ProfileSearchController extends RestrictedBaseController { @Autowired private LoginStrategy loginStrategy; - @RequestMapping(value = { "/profile_search" }, method = RequestMethod.GET) + @GetMapping(value = { "/profile_search" }) public ModelAndView profileSearch(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -107,7 +108,7 @@ public class ProfileSearchController extends RestrictedBaseController { } - @RequestMapping(value = { "/get_user_pagination" }, method = RequestMethod.GET) + @GetMapping(value = { "/get_user_pagination" }) public void getUserPagination(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -139,6 +140,24 @@ public class ProfileSearchController extends RestrictedBaseController { logger.error(EELFLoggerDelegate.applicationLogger, "getUserPagination failed", e); } } + + @RequestMapping(value = { "/get_all_users" }, method = RequestMethod.GET) + public void getAllUsers(HttpServletRequest request, HttpServletResponse response) { + Map<String, Object> model = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + logger.info(EELFLoggerDelegate.applicationLogger, "Initiating get_all_users in ProfileSearchController"); + List<User> profileList = null; + try { + profileList = service.listAllUsers(); + model.put("profileList", mapper.writeValueAsString(profileList)); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); + JSONObject j = new JSONObject(msg); + response.setContentType(APPLICATION_JSON); + response.getWriter().write(j.toString()); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.applicationLogger, "getAllUsers failed", e); + } + } @SuppressWarnings("unchecked") private Map<String, Object> setDashboardData(HttpServletRequest request) @@ -161,7 +180,7 @@ public class ProfileSearchController extends RestrictedBaseController { return model; } - @RequestMapping(value = { "/profile/toggleProfileActive" }, method = RequestMethod.GET) + @GetMapping(value = { "/profile/toggleProfileActive" }) public void toggleProfileActive(HttpServletRequest request, HttpServletResponse response) throws IOException { try { logger.info(EELFLoggerDelegate.applicationLogger, 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 6ee84dd5..2853b83e 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 @@ -63,7 +63,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -84,7 +85,7 @@ public class RoleController extends RestrictedBaseController { @Autowired private RoleService roleService; - @RequestMapping(value = { "/role" }, method = RequestMethod.GET) + @GetMapping(value = { "/role" }) public ModelAndView role(HttpServletRequest request) throws IOException { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -106,7 +107,7 @@ public class RoleController extends RestrictedBaseController { return new ModelAndView(getViewName(), model); } - @RequestMapping(value = { "/get_role" }, method = RequestMethod.GET) + @GetMapping(value = { "/get_role" }) public void getRole(HttpServletRequest request, HttpServletResponse response) throws IOException { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -148,7 +149,7 @@ public class RoleController extends RestrictedBaseController { * @throws IOException * If the write to the result project fails */ - @RequestMapping(value = { "/role/saveRole" }, method = RequestMethod.POST) + @PostMapping(value = { "/role/saveRole" }) public ModelAndView saveRole(HttpServletRequest request, HttpServletResponse response) throws IOException { JSONObject j = null; User user = UserUtils.getUserSession(request); @@ -209,7 +210,7 @@ public class RoleController extends RestrictedBaseController { return null; } - @RequestMapping(value = { "/role/removeRoleFunction" }, method = RequestMethod.POST) + @PostMapping(value = { "/role/removeRoleFunction" }) public ModelAndView removeRoleFunction(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction"); @@ -246,7 +247,7 @@ public class RoleController extends RestrictedBaseController { } - @RequestMapping(value = { "/role/addRoleFunction" }, method = RequestMethod.POST) + @PostMapping(value = { "/role/addRoleFunction" }) public ModelAndView addRoleFunction(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeRoleFunction"); @@ -283,7 +284,7 @@ public class RoleController extends RestrictedBaseController { } - @RequestMapping(value = { "/role/removeChildRole" }, method = RequestMethod.POST) + @PostMapping(value = { "/role/removeChildRole" }) public ModelAndView removeChildRole(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.removeChileRole"); @@ -319,7 +320,7 @@ public class RoleController extends RestrictedBaseController { } - @RequestMapping(value = { "/role/addChildRole" }, method = RequestMethod.POST) + @PostMapping(value = { "/role/addChildRole" }) public ModelAndView addChildRole(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); logger.info(EELFLoggerDelegate.applicationLogger, "RoleController.addChileRole"); 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 4ac5f37a..ad41a9cc 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 @@ -57,7 +57,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.ObjectMapper; @@ -74,7 +75,7 @@ public class RoleFunctionListController extends RestrictedBaseController { private String viewName; - @RequestMapping(value = { "/role_function_list" }, method = RequestMethod.GET) + @GetMapping(value = { "/role_function_list" }) public ModelAndView welcome(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -88,7 +89,7 @@ public class RoleFunctionListController extends RestrictedBaseController { return new ModelAndView(getViewName(), model); } - @RequestMapping(value = { "/get_role_functions" }, method = RequestMethod.GET) + @GetMapping(value = { "/get_role_functions" }) public void getRoleFunctionList(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -104,7 +105,7 @@ public class RoleFunctionListController extends RestrictedBaseController { } } - @RequestMapping(value = { "/role_function_list/saveRoleFunction" }, method = RequestMethod.POST) + @PostMapping(value = { "/role_function_list/saveRoleFunction" }) public void saveRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) throws IOException { ObjectMapper mapper = new ObjectMapper(); @@ -129,7 +130,7 @@ public class RoleFunctionListController extends RestrictedBaseController { response.getWriter().write(j.toString()); } - @RequestMapping(value = { "/role_function_list/addRoleFunction" }, method = RequestMethod.POST) + @PostMapping(value = { "/role_function_list/addRoleFunction" }) public void addRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) throws IOException { ObjectMapper mapper = new ObjectMapper(); @@ -161,7 +162,7 @@ public class RoleFunctionListController extends RestrictedBaseController { response.getWriter().write(j.toString()); } - @RequestMapping(value = { "/role_function_list/removeRoleFunction" }, method = RequestMethod.POST) + @PostMapping(value = { "/role_function_list/removeRoleFunction" }) public void removeRoleFunction(HttpServletRequest request, HttpServletResponse response, @RequestBody String roleFunc) throws IOException { ObjectMapper mapper = new ObjectMapper(); 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 0360770e..53b1945e 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 @@ -58,7 +58,8 @@ import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -81,7 +82,7 @@ public class RoleListController extends RestrictedBaseController { private static final String isCentralized = "remote"; - @RequestMapping(value = { "/role_list" }, method = RequestMethod.GET) + @GetMapping(value = { "/role_list" }) public ModelAndView getRoleList(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -94,7 +95,7 @@ public class RoleListController extends RestrictedBaseController { return new ModelAndView(getViewName(), model); } - @RequestMapping(value = { "/get_roles" }, method = RequestMethod.GET) + @GetMapping(value = { "/get_roles" }) public void getRoles(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -109,7 +110,7 @@ public class RoleListController extends RestrictedBaseController { } } - @RequestMapping(value = { "/role_list/toggleRole" }, method = RequestMethod.POST) + @PostMapping(value = { "/role_list/toggleRole" }) public ModelAndView toggleRole(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); try { @@ -147,7 +148,7 @@ public class RoleListController extends RestrictedBaseController { } - @RequestMapping(value = { "/role_list/removeRole" }, method = RequestMethod.POST) + @PostMapping(value = { "/role_list/removeRole" }) public ModelAndView removeRole(HttpServletRequest request, HttpServletResponse response) throws IOException { User user = UserUtils.getUserSession(request); 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 6418b1e1..a585b9f7 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 @@ -53,7 +53,8 @@ import org.onap.portalsdk.core.web.support.AppUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; @Controller @@ -68,24 +69,24 @@ public class SDKLoginController extends UnRestrictedBaseController { private String viewName; - @RequestMapping(value = { "/login.htm" }, method = RequestMethod.GET) + @GetMapping(value = { "/login.htm" }) public ModelAndView login() { Map<String, Object> model = new HashMap<>(); return new ModelAndView("login", "model", model); } - @RequestMapping(value = { "/login_external.htm" }, method = RequestMethod.GET) + @GetMapping(value = { "/login_external.htm" }) public ModelAndView externalLogin() { Map<String, Object> model = new HashMap<>(); return new ModelAndView("login_external", "model", model); } - @RequestMapping(value = { "/login_external" }, method = RequestMethod.POST) + @PostMapping(value = { "/login_external" }) public ModelAndView doexternalLogin(HttpServletRequest request, HttpServletResponse response) throws IOException { return loginStrategy.doExternalLogin(request, response); } - @RequestMapping(value = { "/doLogin" }, method = RequestMethod.GET) + @GetMapping(value = { "/doLogin" }) public ModelAndView doLogin(HttpServletRequest request, HttpServletResponse response) throws Exception { return loginStrategy.doLogin(request, response); } 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 83962c63..95ac28d8 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 @@ -70,7 +70,7 @@ import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.client.RestTemplate; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.util.WebUtils; @@ -116,7 +116,7 @@ public class SingleSignOnController extends UnRestrictedBaseController { * @return Redirect to an appropriate address * @throws Exception */ - @RequestMapping(value = { "/single_signon.htm" }, method = RequestMethod.GET) + @GetMapping(value = { "/single_signon.htm" }) public ModelAndView singleSignOnLogin(HttpServletRequest request) throws Exception { Map<String, String> model = new HashMap<>(); 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 fabc06bf..00b8d796 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 @@ -56,7 +56,7 @@ import org.onap.portalsdk.core.util.UsageUtils; import org.onap.portalsdk.core.web.support.JsonMessage; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; @Controller @@ -93,7 +93,7 @@ public class UsageListController extends RestrictedBaseController { } @SuppressWarnings({ "unchecked", "rawtypes" }) - @RequestMapping(value = { "/usage_list" }, method = RequestMethod.GET) + @GetMapping(value = { "/usage_list" }) public ModelAndView usageList(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); @@ -117,7 +117,7 @@ public class UsageListController extends RestrictedBaseController { } @SuppressWarnings({ "unchecked", "rawtypes" }) - @RequestMapping(value = { "/get_usage_list" }, method = RequestMethod.GET) + @GetMapping(value = { "/get_usage_list" }) public void getUsageList(HttpServletRequest request, HttpServletResponse response) { HttpSession httpSession = request.getSession(); @@ -144,7 +144,7 @@ public class UsageListController extends RestrictedBaseController { } @SuppressWarnings("rawtypes") - @RequestMapping(value = { "/usage_list/removeSession" }, method = RequestMethod.GET) + @GetMapping(value = { "/usage_list/removeSession" }) public void removeSession(HttpServletRequest request, HttpServletResponse response) throws IOException { HashMap activeUsers = (HashMap) request.getSession().getServletContext().getAttribute(ACTIVE_USERS); UserRowBean data = new UserRowBean(); 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 5067be1e..c637719d 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 @@ -49,7 +49,7 @@ import org.onap.portalsdk.core.service.ProfileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.ObjectMapper; @@ -68,7 +68,7 @@ public class UserProfileController extends RestrictedBaseController { @Autowired private ProfileService service; - @RequestMapping(value = { "/user_profile" }, method = RequestMethod.GET) + @GetMapping(value = { "/user_profile" }) public ModelAndView userProfile() throws IOException { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); 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 7193f6bb..ce6b8ef1 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 @@ -40,7 +40,7 @@ package org.onap.portalapp.controller.core; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; /** @@ -51,7 +51,7 @@ import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") public class WelcomeController extends RestrictedBaseController { - @RequestMapping(value = { "/welcome" }, method = RequestMethod.GET) + @GetMapping(value = { "/welcome" }) 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 96b602c3..98f1db84 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 @@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; /** @@ -57,7 +57,7 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/") public class AngularSinglePageController extends RestrictedBaseController { - @RequestMapping(value = { "/singlePageSample" }, method = RequestMethod.GET) + @GetMapping(value = { "/singlePageSample" }) public ModelAndView view(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); return new ModelAndView("single_page_sample", "model", model); 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 4392aeb5..0cbcd2ed 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 @@ -12,7 +12,7 @@ * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software + * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and @@ -56,7 +56,8 @@ import org.onap.portalsdk.core.web.support.JsonMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -76,7 +77,7 @@ public class BroadcastController extends RestrictedBaseController { @Autowired private BroadcastService broadcastService; - @RequestMapping(value = { "/broadcast" }, method = RequestMethod.GET) + @GetMapping(value = { "/broadcast" }) public ModelAndView broadcast(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -90,7 +91,7 @@ public class BroadcastController extends RestrictedBaseController { return new ModelAndView(getViewName(), model); } - @RequestMapping(value = { "/get_broadcast" }, method = RequestMethod.GET) + @GetMapping(value = { "/get_broadcast" }) public void getBroadcast(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -121,7 +122,7 @@ public class BroadcastController extends RestrictedBaseController { return lookupData; } - @RequestMapping(value = { "/broadcast/save" }, method = RequestMethod.POST) + @PostMapping(value = { "/broadcast/save" }) public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws IOException { try { 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 c9c666fb..4e66743e 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 @@ -54,7 +54,8 @@ import org.onap.portalsdk.core.web.support.JsonMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -71,7 +72,7 @@ public class BroadcastListController extends RestrictedBaseController { @Autowired private BroadcastService broadcastService; - @RequestMapping(value = { "/broadcast_list" }, method = RequestMethod.GET) + @GetMapping(value = { "/broadcast_list" }) public ModelAndView broadcastList(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); @@ -79,7 +80,7 @@ public class BroadcastListController extends RestrictedBaseController { return new ModelAndView(getViewName(), model); } - @RequestMapping(value = { "/get_broadcast_list" }, method = RequestMethod.GET) + @GetMapping(value = { "/get_broadcast_list" }) public void getBroadcast(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -96,7 +97,7 @@ public class BroadcastListController extends RestrictedBaseController { } - @RequestMapping(value = { "/broadcast_list/remove" }, method = RequestMethod.POST) + @PostMapping(value = { "/broadcast_list/remove" }) public ModelAndView remove(HttpServletRequest request, HttpServletResponse response) throws IOException { try { @@ -131,7 +132,7 @@ public class BroadcastListController extends RestrictedBaseController { } - @RequestMapping(value = { "/broadcast_list/toggleActive" }, method = RequestMethod.POST) + @PostMapping(value = { "/broadcast_list/toggleActive" }) public ModelAndView toggleActive(HttpServletRequest request, HttpServletResponse response) throws IOException { try { 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 09b28dc1..34c777cd 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 @@ -40,7 +40,7 @@ package org.onap.portalapp.controller.sample; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; @@ -54,7 +54,7 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/") public class CallflowController extends RestrictedBaseController { - @RequestMapping(value = { "/callflow" }, method = RequestMethod.GET) + @GetMapping(value = { "/callflow" }) public ModelAndView plot() { final String defaultViewName = null; return new ModelAndView(defaultViewName); 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 4c32b964..f955e60a 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 @@ -47,7 +47,7 @@ import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -63,7 +63,7 @@ public class CamundaCockpitController extends RestrictedBaseController { private static final String CAMUNDA_COCKPIT_LINK = "camunda_cockpit_link"; @SuppressWarnings("rawtypes") - @RequestMapping(value = {"/get_camunda_cockpit_link" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = {"/get_camunda_cockpit_link" }, produces = "application/json") @ResponseBody public Map getCamundaCockpitLink(HttpServletRequest request,HttpServletResponse response) { Map<String,String> map = new HashMap<>(); 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 e2515256..0757026d 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 @@ -54,7 +54,7 @@ import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.ObjectMapper; @@ -68,7 +68,7 @@ public class CollaborateListController extends RestrictedBaseController { @Autowired private UserProfileService service; - @RequestMapping(value = {"/collaborate_list" }, method = RequestMethod.GET) + @GetMapping(value = {"/collaborate_list" }) public ModelAndView ProfileSearch(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); @@ -85,7 +85,7 @@ public class CollaborateListController extends RestrictedBaseController { return new ModelAndView(getViewName(),"model", model); } - @RequestMapping(value = {"/get_collaborate_list" }, method = RequestMethod.GET) + @GetMapping(value = {"/get_collaborate_list" }) public void getCollaborateList(HttpServletRequest request,HttpServletResponse response) { ObjectMapper mapper = new ObjectMapper(); 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 18cd6a6a..1addfa9a 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 @@ -47,14 +47,14 @@ import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") public class CollaborationController extends RestrictedBaseController{ - @RequestMapping(value = {"/collaboration" }, method = RequestMethod.GET) + @GetMapping(value = {"/collaboration" }) public ModelAndView view(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); User user = UserUtils.getUserSession(request); @@ -62,7 +62,7 @@ public class CollaborationController extends RestrictedBaseController{ model.put("name",(user.getFirstName() + " " + (user.getLastName() != null? user.getLastName().substring(0,1): "" ))); return new ModelAndView(getViewName(),"model", model); } - @RequestMapping(value = {"/openCollaboration" }, method = RequestMethod.GET) + @GetMapping(value = {"/openCollaboration" }) public ModelAndView openCollaboration(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); User user = UserUtils.getUserSession(request); 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 58eda311..fcec97eb 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 @@ -47,7 +47,7 @@ import org.onap.portalsdk.core.service.ProfileService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; @@ -63,7 +63,7 @@ public class DS2SampleController extends UnRestrictedBaseController { @Autowired ProfileService service; - @RequestMapping(value = { "/ds2_sample" }, method = RequestMethod.GET) + @GetMapping(value = { "/ds2_sample" }) public ModelAndView ProfileSearch(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); return new ModelAndView("ds2_sample", "model", model); 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 37c4eb77..af40c45b 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 @@ -47,7 +47,7 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; @@ -66,17 +66,17 @@ import io.searchbox.params.Parameters; @RestController public class ElasticSearchController extends RestrictedBaseController{ - @RequestMapping(value = {"/es_search_demo" }, method = RequestMethod.GET) + @GetMapping(value = {"/es_search_demo" }) public ModelAndView search() { return new ModelAndView("es_search_demo"); } - @RequestMapping(value = {"/es_suggest_demo" }, method = RequestMethod.GET) + @GetMapping(value = {"/es_suggest_demo" }) public ModelAndView suggest() { return new ModelAndView("es_suggest_demo"); } - @RequestMapping(value="/es_suggest/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value="/es_suggest/{task}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Result> doSuggest(@PathVariable("task") String task) throws IOException { JSONObject obj = new JSONObject(task); String searchTerm = obj.getString("data"); @@ -108,7 +108,7 @@ public class ElasticSearchController extends RestrictedBaseController{ return new ResponseEntity<>(new Result(result.getJsonObject().toString()),HttpStatus.OK); } - @RequestMapping(value="/es_search/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value="/es_search/{task}", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Result> doSearch(@PathVariable("task") String task) throws IOException { JSONObject obj = new JSONObject(task); String searchTerm = obj.getString("data"); 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 bc9e2667..65e2c7aa 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 @@ -40,7 +40,7 @@ package org.onap.portalapp.controller.sample; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; /** @@ -52,7 +52,7 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/") public class LeafletMapContoller extends RestrictedBaseController { - @RequestMapping(value = { "/leafletMap" }, method = RequestMethod.GET) + @GetMapping(value = { "/leafletMap" }) public ModelAndView plot() { final String defaultViewName = null; return new ModelAndView(defaultViewName); 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 f3f739f4..d8c9d8ab 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 @@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; /** @@ -56,7 +56,7 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/") public class NetMapController extends RestrictedBaseController { - @RequestMapping(value = { "/net_map" }, method = RequestMethod.GET) + @GetMapping(value = { "/net_map" }) public ModelAndView plot(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); model.put("frame_int", "net_map_int"); @@ -64,7 +64,7 @@ public class NetMapController extends RestrictedBaseController { return new ModelAndView("frame_insert", model); } - @RequestMapping(value = { "/net_map_int" }, method = RequestMethod.GET) + @GetMapping(value = { "/net_map_int" }) public ModelAndView plot2() { // The view name defaults to the request without any suffix. final String defaultViewName = null; 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 cf7fa06a..e0a2fdba 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 @@ -52,7 +52,8 @@ import org.onap.portalsdk.core.web.support.JsonMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -68,12 +69,12 @@ public class PostDroolsController extends RestrictedBaseController { @Autowired private PostDroolsService postDroolsService; - @RequestMapping(value = { "/drools" }, method = RequestMethod.GET) + @GetMapping(value = { "/drools" }) public ModelAndView drools(HttpServletRequest request) { return new ModelAndView(getViewName()); } - @RequestMapping(value = { "/getDrools" }, method = RequestMethod.GET) + @GetMapping(value = { "/getDrools" }) public void getDrools(HttpServletRequest request, HttpServletResponse response) { @@ -88,7 +89,7 @@ public class PostDroolsController extends RestrictedBaseController { } } - @RequestMapping(value = { "/getDroolDetails" }, method = RequestMethod.GET) + @GetMapping(value = { "/getDroolDetails" }) public void getDroolDetails(HttpServletRequest request, HttpServletResponse response) { ObjectMapper mapper = new ObjectMapper(); @@ -108,7 +109,7 @@ public class PostDroolsController extends RestrictedBaseController { } } - @RequestMapping(value = { "/post_drools/execute" }, method = RequestMethod.POST) + @PostMapping(value = { "/post_drools/execute" }) public ModelAndView search(HttpServletRequest request, HttpServletResponse response) { try { ObjectMapper mapper = new ObjectMapper(); 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 50e6d096..6147f960 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 @@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; /** @@ -56,7 +56,7 @@ import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") public class ReportDashboardController extends RestrictedBaseController { - @RequestMapping(value = {"/report_dashboard" }, method = RequestMethod.GET) + @GetMapping(value = {"/report_dashboard" }) public ModelAndView adminView(HttpServletRequest request) { 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/sample/SamplePageController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java index 5adaf66e..ef979e69 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 @@ -45,7 +45,7 @@ import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; /** @@ -56,7 +56,7 @@ import org.springframework.web.servlet.ModelAndView; @RequestMapping("/") public class SamplePageController extends RestrictedBaseController { - @RequestMapping(value = { "/samplePage" }, method = RequestMethod.GET) + @GetMapping(value = { "/samplePage" }) public ModelAndView plot(HttpServletRequest request) { Map<String, Object> model = new HashMap<>(); 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 2b75aea1..8598ed15 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 @@ -62,6 +62,8 @@ import org.onap.portalsdk.core.onboarding.exception.CipherUtilException; import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler; import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.onboarding.util.KeyConstants; +import org.onap.portalsdk.core.onboarding.util.KeyProperties; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; import org.onap.portalsdk.core.restful.domain.EcompRole; @@ -527,7 +529,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR appUserName = app.getUsername(); try { decryptedPwd = CipherUtil.decryptPKC(app.getAppPassword(), - SystemProperties.getProperty(SystemProperties.Decryption_Key)); + KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)); } catch (CipherUtilException e) { logger.error(EELFLoggerDelegate.errorLogger, "getAppCredentials failed", e); } diff --git a/ecomp-sdk/epsdk-app-common/src/main/webapp/app/fusion/external/d3/js/intro.js b/ecomp-sdk/epsdk-app-common/src/main/webapp/app/fusion/external/d3/js/intro.js deleted file mode 100644 index 0c3a3282..00000000 --- a/ecomp-sdk/epsdk-app-common/src/main/webapp/app/fusion/external/d3/js/intro.js +++ /dev/null @@ -1 +0,0 @@ -(function(){}) diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FavoritesControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FavoritesControllerTest.java index 5c54d40d..e980f2a1 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FavoritesControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/FavoritesControllerTest.java @@ -53,6 +53,8 @@ import org.onap.portalsdk.core.domain.App; import org.onap.portalsdk.core.domain.User; import org.onap.portalsdk.core.onboarding.rest.FavoritesClient; import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.onboarding.util.KeyConstants; +import org.onap.portalsdk.core.onboarding.util.KeyProperties; import org.onap.portalsdk.core.service.AppService; import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; @@ -60,7 +62,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) -@PrepareForTest({SystemProperties.class, CipherUtil.class, FavoritesClient.class}) +@PrepareForTest({SystemProperties.class, CipherUtil.class, FavoritesClient.class, KeyProperties.class, KeyConstants.class}) public class FavoritesControllerTest { @InjectMocks @@ -89,6 +91,8 @@ public class FavoritesControllerTest { HttpSession session = Mockito.mock(HttpSession.class); Mockito.when(request.getSession()).thenReturn(session); PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(KeyProperties.class); + PowerMockito.mockStatic(KeyConstants.class); User user = new User(); user.setId(123L); Mockito.when(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).thenReturn("user"); @@ -101,7 +105,7 @@ public class FavoritesControllerTest { Mockito.when(appService.getDefaultApp()).thenReturn(app); PowerMockito.mockStatic(CipherUtil.class); - Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword()); + Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(app.getAppPassword()); Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(), app.getAppPassword())).thenReturn(app.getAppPassword()); PowerMockito.mockStatic(FavoritesClient.class); @@ -120,6 +124,8 @@ public class FavoritesControllerTest { HttpSession session = Mockito.mock(HttpSession.class); Mockito.when(request.getSession()).thenReturn(session); PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(KeyProperties.class); + PowerMockito.mockStatic(KeyConstants.class); User user = new User(); user.setId(123L); Mockito.when(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).thenReturn("user"); @@ -131,7 +137,7 @@ public class FavoritesControllerTest { app.setAppPassword("Password"); Mockito.when(appService.getDefaultApp()).thenReturn(app); - Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword()); + Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(app.getAppPassword()); PowerMockito.mockStatic(FavoritesClient.class); Mockito.when(FavoritesClient.getFavorites(Mockito.anyString(), Mockito.anyString(), @@ -149,6 +155,8 @@ public class FavoritesControllerTest { HttpSession session = Mockito.mock(HttpSession.class); Mockito.when(request.getSession()).thenReturn(session); PowerMockito.mockStatic(SystemProperties.class); + PowerMockito.mockStatic(KeyProperties.class); + PowerMockito.mockStatic(KeyConstants.class); User user = new User(); user.setId(123L); Mockito.when(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).thenReturn("user"); @@ -161,7 +169,7 @@ public class FavoritesControllerTest { Mockito.when(appService.getDefaultApp()).thenReturn(null); PowerMockito.mockStatic(CipherUtil.class); - Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(app.getAppPassword()); + Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(app.getAppPassword()); Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(), app.getAppPassword())).thenReturn(app.getAppPassword()); PowerMockito.mockStatic(FavoritesClient.class); diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java index 8883cfa8..71d7277a 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java @@ -37,9 +37,6 @@ */ package org.onap.portalapp.controller.core; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -111,46 +108,4 @@ public class LogoutControllerTest { .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); logoutController.globalLogout(mockedRequest); } - - @Test - public void globalLogoutExceptionTest(){ - PowerMockito.mockStatic(PortalApiProperties.class); - PowerMockito.mockStatic(PortalApiConstants.class); - Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); - assertNull(logoutController.globalLogout(mockedRequest)); - } - - @Test - public void appLogoutTest(){ - ModelAndView actualModelView = new ModelAndView("redirect:http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); - PowerMockito.mockStatic(PortalApiProperties.class); - PowerMockito.mockStatic(PortalApiConstants.class); - PowerMockito.mockStatic(RequestContextHolder.class); - ServletRequestAttributes ServletRequestAttributes = new ServletRequestAttributes(mockedRequest); - Mockito.when(RequestContextHolder.currentRequestAttributes()).thenReturn(ServletRequestAttributes); - Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); - ModelAndView expectedModelView = logoutController.appLogout(mockedRequest); - assertEquals(actualModelView.getViewName(), expectedModelView.getViewName()); - } - - @Test - public void appLogoutExceptionTest(){ - PowerMockito.mockStatic(PortalApiProperties.class); - PowerMockito.mockStatic(PortalApiConstants.class); - Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); - assertNull(logoutController.appLogout(mockedRequest)); - } - - @Test - public void getUserTest(){ - User expectedUser = new User(); - expectedUser.setActive(false); - user.setActive(false); - logoutController.setUser(user); - User actualUser = logoutController.getUser(); - assertEquals(expectedUser.getActive(), actualUser.getActive()); - } } diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java index 9d5e4fea..2c6827ed 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java @@ -65,6 +65,8 @@ import org.onap.portalsdk.core.onboarding.exception.CipherUtilException; import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; import org.onap.portalsdk.core.onboarding.listener.PortalTimeoutHandler; import org.onap.portalsdk.core.onboarding.util.CipherUtil; +import org.onap.portalsdk.core.onboarding.util.KeyConstants; +import org.onap.portalsdk.core.onboarding.util.KeyProperties; import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.onap.portalsdk.core.onboarding.util.PortalApiProperties; import org.onap.portalsdk.core.restful.domain.EcompRole; @@ -83,7 +85,7 @@ import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.context.ApplicationContext; @RunWith(PowerMockRunner.class) -@PrepareForTest({ AppContextManager.class, PortalApiProperties.class, JSONUtil.class, PortalTimeoutHandler.class, SystemProperties.class, CipherUtil.class }) +@PrepareForTest({ AppContextManager.class, PortalApiProperties.class, JSONUtil.class, PortalTimeoutHandler.class, SystemProperties.class, CipherUtil.class, KeyProperties.class, KeyConstants.class }) public class OnBoardingApiServiceImplTest { @Mock @@ -426,7 +428,9 @@ public class OnBoardingApiServiceImplTest { PowerMockito.mockStatic(SystemProperties.class); PowerMockito.mockStatic(CipherUtil.class); - Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(key); + PowerMockito.mockStatic(KeyProperties.class); + PowerMockito.mockStatic(KeyConstants.class); + Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(key); Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(), key)).thenReturn(app.getAppPassword()); Mockito.when(appServiceImpl.getDefaultApp()).thenReturn(app); OnBoardingApiServiceImpl onBoardingApiServiceImpl = new OnBoardingApiServiceImpl(); @@ -453,7 +457,9 @@ public class OnBoardingApiServiceImplTest { PowerMockito.mockStatic(SystemProperties.class); PowerMockito.mockStatic(CipherUtil.class); - Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(key); + PowerMockito.mockStatic(KeyProperties.class); + PowerMockito.mockStatic(KeyConstants.class); + Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(key); Mockito.when(CipherUtil.decryptPKC(app.getAppPassword(), key)).thenThrow(CipherUtilException.class); Mockito.when(appServiceImpl.getDefaultApp()).thenReturn(app); OnBoardingApiServiceImpl onBoardingApiServiceImpl = new OnBoardingApiServiceImpl(); |