diff options
Diffstat (limited to 'ecomp-sdk/epsdk-core/src')
2 files changed, 18 insertions, 6 deletions
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<Long> getParentId(String label); @SuppressWarnings("rawtypes") List<List> getParentList(); - List<RoleFunction> getFunctionCDList(HttpServletRequest request); + List<RoleFunction> getFunctionCDList(HttpServletRequest request) throws Exception; void removeMenuItem(Menu domainFnMenu); Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList, List<MenuData> parentList, Set<MenuData> 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<MenuData> getFnMenuItems() { @@ -104,10 +108,18 @@ public class FnMenuServiceImpl implements FnMenuService{ @SuppressWarnings("unchecked") @Override - public List<RoleFunction> getFunctionCDList(HttpServletRequest request) { - Set roleFunctionList = new HashSet<>(); - roleFunctionList = UserUtils.getRoleFunctions(request); - List roleFunctionFinalList = new ArrayList<>(roleFunctionList); + public List<RoleFunction> 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; } |