From a2f5a35c06a526b05e4efd9fe275d6639bf22cd3 Mon Sep 17 00:00:00 2001 From: st782s Date: Mon, 14 Aug 2017 11:41:04 -0400 Subject: DDL updates and cleanup - remove unused javascript libraries - remove contentious icons and images - Remove constraints to support Role Centralization Issue: PORTAL-21, Portal-17 Change-Id: I347accb04343d1c866c075ee716c46fea9e0d036 Signed-off-by: st782s --- .../portalsdk/core/service/FnMenuService.java | 2 +- .../portalsdk/core/service/FnMenuServiceImpl.java | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'ecomp-sdk/epsdk-core') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java index 2face03a..913c9de1 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java @@ -42,7 +42,7 @@ public interface FnMenuService { List getParentId(String label); @SuppressWarnings("rawtypes") List getParentList(); - List getFunctionCDList(HttpServletRequest request); + List getFunctionCDList(HttpServletRequest request) throws Exception; void removeMenuItem(Menu domainFnMenu); Map> setMenuDataStructure(List> childItemList, List parentList, Set menuResult) throws Exception; } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java index 9b16aabb..22bc9675 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java @@ -31,12 +31,16 @@ import javax.servlet.http.HttpServletRequest; import org.openecomp.portalsdk.core.domain.Menu; import org.openecomp.portalsdk.core.domain.MenuData; import org.openecomp.portalsdk.core.domain.RoleFunction; +import org.openecomp.portalsdk.core.domain.User; import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.openecomp.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; + /** * Description: this java class is an implementation of services for Admin to add/edit/delete menu items from FN_MENU */ @@ -51,7 +55,7 @@ public class FnMenuServiceImpl implements FnMenuService{ private DataAccessService dataAccessService; @Autowired - private RoleService roleService; + private RestApiRequestBuilder restApiRequestBuilder; @SuppressWarnings("unchecked") public List getFnMenuItems() { @@ -104,10 +108,18 @@ public class FnMenuServiceImpl implements FnMenuService{ @SuppressWarnings("unchecked") @Override - public List getFunctionCDList(HttpServletRequest request) { - Set roleFunctionList = new HashSet<>(); - roleFunctionList = UserUtils.getRoleFunctions(request); - List roleFunctionFinalList = new ArrayList<>(roleFunctionList); + public List getFunctionCDList(HttpServletRequest request) throws Exception { + User user = UserUtils.getUserSession(request); + ObjectMapper mapper = new ObjectMapper(); + List roleFunctionFinalList = new ArrayList<>(); + try { + String menuList = restApiRequestBuilder.getViaREST("/menuFunctions", true, user.getOrgUserId()); + roleFunctionFinalList = mapper.readValue(menuList, + TypeFactory.defaultInstance().constructCollectionType(List.class, String.class)); + } catch (Exception e) { + logger.error(EELFLoggerDelegate.errorLogger, "saveRole Failed", e); + throw new Exception(e.getMessage()); + } return roleFunctionFinalList; } -- cgit 1.2.3-korg