summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/FnMenuController.java6
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties4
-rw-r--r--ecomp-sdk/epsdk-app-os/src/main/webapp/app/fusion/scripts/DS2-view-models/header-logo.html2
-rw-r--r--ecomp-sdk/epsdk-app-overlay/README.md13
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js3
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html3
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusionapp/icons/logo_onap_transbg.pngbin0 -> 52523 bytes
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java219
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java20
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java97
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListService.java13
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java42
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceImpl.java33
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java52
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserService.java15
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java51
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceImpl.java16
19 files changed, 317 insertions, 278 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/FnMenuController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/FnMenuController.java
index 5082dad5..78c1440d 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/FnMenuController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/FnMenuController.java
@@ -34,6 +34,7 @@ import org.openecomp.portalsdk.core.domain.Menu;
import org.openecomp.portalsdk.core.domain.MenuData;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.service.FnMenuService;
+import org.openecomp.portalsdk.core.service.FunctionalMenuListService;
import org.openecomp.portalsdk.core.util.SystemProperties;
import org.openecomp.portalsdk.core.web.support.JsonMessage;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,6 +59,9 @@ public class FnMenuController extends RestrictedBaseController {
@Autowired
FnMenuService service;
+
+ @Autowired
+ FunctionalMenuListService functionalMenuListService;
private String viewName;
@@ -79,7 +83,7 @@ public class FnMenuController extends RestrictedBaseController {
public void getFunctionCDList(HttpServletRequest request, HttpServletResponse response) throws Exception {
ObjectMapper mapper = new ObjectMapper();
try {
- response.getWriter().write(mapper.writeValueAsString(service.getFunctionCDList(request)));
+ response.getWriter().write(mapper.writeValueAsString(functionalMenuListService.getFunctionCDList(request)));
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getFunctionCDList", e);
response.setCharacterEncoding("UTF-8");
diff --git a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties
index e5917c6b..d988ec21 100644
--- a/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties
+++ b/ecomp-sdk/epsdk-app-os/src/main/webapp/WEB-INF/conf/system.properties
@@ -27,8 +27,8 @@ decryption_key = AGLDdG4D04BKm2IxIWEr8o==
#Mysql
db.driver = com.mysql.jdbc.Driver
db.connectionURL = jdbc:mysql://localhost:3306/ecomp_sdk_os
-db.userName = xxxx
-db.password = xxxxxxxx
+db.userName = userName
+db.password = password
db.encrypt_flag = false
db.hib.dialect = org.hibernate.dialect.MySQLDialect
db.min_pool_size = 5
diff --git a/ecomp-sdk/epsdk-app-os/src/main/webapp/app/fusion/scripts/DS2-view-models/header-logo.html b/ecomp-sdk/epsdk-app-os/src/main/webapp/app/fusion/scripts/DS2-view-models/header-logo.html
new file mode 100644
index 00000000..2eec0cfb
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-os/src/main/webapp/app/fusion/scripts/DS2-view-models/header-logo.html
@@ -0,0 +1,2 @@
+<img src="app/fusionapp/icons/logo_onap_transbg.png" class="header-image">
+<span class="globe-text">ONAP Portal</span> \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/README.md b/ecomp-sdk/epsdk-app-overlay/README.md
index 1a0798f9..5ed68c5e 100644
--- a/ecomp-sdk/epsdk-app-overlay/README.md
+++ b/ecomp-sdk/epsdk-app-overlay/README.md
@@ -18,14 +18,15 @@ AngularJS version 1.5.0.
### ONAP Distributions
Version 1.3.0
-- [Portal-19] Renaming the Group Id in the POM file to org.onap.portal.sdk
-- [PORTAL-17] removing eye.js and utils.js - rework
-- [PORTAL-21] Increased Role name size in UI
+- Portal-17 removing eye.js and utils.js - rework
+- Portal-19 Renaming the Group Id in the POM file to org.onap.portal.sdk
+- Portal-21 Increased Role name size in UI
+- Portal-81 Add ONAP logo to header in app overlay
Version 1.1.0
-[Portal-7] Improvements added as part of the rebasing process
-[Portal-10] Enhancing Drill Down Capabilities of EcompSDK Analytics
-[PORTAL-17] Remove jfree related items
+- Portal-7 Improvements added as part of the rebasing process
+- Portal-10 Enhancing Drill Down Capabilities of EcompSDK Analytics
+- PORTAL-17 Remove jfree related items
Version 1.0.0
- Initial release
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js
index 109c1c7b..d7adaf36 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/admin-controller.js
@@ -741,6 +741,7 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal
$scope.saveRole = function() {
var errorMsg;
+ if($scope.role.id == null || $scope.role.id == undefined ){
$scope.role = {
'id':null,
'created':null,
@@ -759,7 +760,7 @@ appDS2.controller('adminController', function($scope, $http,AdminService, $modal
'toggleActiveImage':" / static fusion images inactive.png ",
'editUrl':" role.htm ? role_id = null",
};
-
+ }
// Validate non-empty priority as integer
if ($scope.role.priority && $scope.role.priority != '' && isNaN(parseInt($scope.role.priority))) {
errorMsg = 'Priority must be an integer.';
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html
index 5c0e2bcc..d0748e1d 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2Header.html
@@ -2,8 +2,7 @@
<header class="b2b-header-tabs" b2b-header-responsive ng-show="{{showHeader}}">
<ul class="header__items" role="navigation">
<li class="header__item icon__item" tabindex="0" ng-click="returnToPortal()">
- <span class="icon-primary-att-globe"></span>
- <span class="globe-text">ECOMP Portal</span>
+ <div ng-include src="'app/fusion/scripts/DS2-view-models/header-logo.html'"></div>
</li>
<li b2b-header-menu class="header__item b2b-headermenu" ng-repeat="item in menuItems" role="presentation">
<a href="javascript:void(0);" class="menu__item" role="menuitem" ng-bind="item.text"></a>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css
index 9a0716a5..e593c24a 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/styles/ecomp.css
@@ -167,4 +167,8 @@ p,a{
.left-menu-child
{
margin-left: 37px;
+}
+
+.header-image{
+ height:28px;
} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusionapp/icons/logo_onap_transbg.png b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusionapp/icons/logo_onap_transbg.png
new file mode 100644
index 00000000..8d601009
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusionapp/icons/logo_onap_transbg.png
Binary files differ
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java
index 6b00d3fb..04163d06 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java
@@ -6,106 +6,121 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class AccessConfiguration {
-
-
-
- /**
- *
- * @return RoleServiceImpl bean if LocalAccessCondition is true
- */
- @Bean
- @Conditional(LocalAccessCondition.class)
- public RoleService roleServiceImpl() {
- return new RoleServiceImpl();
- }
-
-
- /**
- *
- * @return RoleServiceCentralizedAccess bean if CentralAccessCondition is true
- */
- @Bean
- @Conditional(CentralAccessCondition.class)
- public RoleService roleServiceCentralizedAccess() {
- return new RoleServiceCentralizedAccess();
- }
-
-
- /**
- *
- * @return LoginServiceImpl bean if LocalAccessCondition is true
- */
- @Bean
- @Conditional(LocalAccessCondition.class)
- public LoginService loginServiceImpl() {
- return new LoginServiceImpl();
- }
-
-
- /**
- *
- * @return LoginServiceCentralizedImpl bean if CentralAccessCondition is true
- */
- @Bean
- @Conditional(CentralAccessCondition.class)
- public LoginService loginServiceCEntralizedImpl() {
- return new LoginServiceCentralizedImpl();
- }
-
- /**
- *
- * @return UserProfileServiceImpl bean if LocalAccessCondition is true
- */
- @Bean
- @Conditional(LocalAccessCondition.class)
- public UserService userServiceImpl() {
- return new UserServiceImpl();
- }
-
-
- /**
- *
- * @return returns UserProfileServiceCentalizedImpl bean if CentralAccessCondition is true
- */
- @Bean
- @Conditional(CentralAccessCondition.class)
- public UserService userServiceCentalizedImpl() {
- return new UserServiceCentalizedImpl();
- }
-
-
-
- /**
- *
- * @return returns ProfileServiceImpl bean if LocalAccessCondition is true
- */
- @Bean
- @Conditional(LocalAccessCondition.class)
- public ProfileService profileServiceImpl() {
- return new ProfileServiceImpl();
- }
-
-
- /**
- *
- * @return returns ProfileServiceCentralizedImpl bean if CentralAccessCondition is true
- */
-
- @Bean
- @Conditional(CentralAccessCondition.class)
- public ProfileService profileServiceCentralizedImpl() {
- return new ProfileServiceCentralizedImpl();
- }
-
-
- /**
- *
- * @return returns RestApiRequestBuilder bean if CentralAccessCondition is true
- */
- @Bean
- @Conditional(CentralAccessCondition.class)
- public RestApiRequestBuilder restApiRequestBuilder() {
- return new RestApiRequestBuilder();
- }
-
+
+ /**
+ *
+ * @return RoleServiceImpl bean if LocalAccessCondition is true
+ */
+ @Bean
+ @Conditional(LocalAccessCondition.class)
+ public RoleService roleServiceImpl() {
+ return new RoleServiceImpl();
+ }
+
+ /**
+ *
+ * @return RoleServiceCentralizedAccess bean if CentralAccessCondition is true
+ */
+ @Bean
+ @Conditional(CentralAccessCondition.class)
+ public RoleService roleServiceCentralizedAccess() {
+ return new RoleServiceCentralizedAccess();
+ }
+
+ /**
+ *
+ * @return LoginServiceImpl bean if LocalAccessCondition is true
+ */
+ @Bean
+ @Conditional(LocalAccessCondition.class)
+ public LoginService loginServiceImpl() {
+ return new LoginServiceImpl();
+ }
+
+ /**
+ *
+ * @return LoginServiceCentralizedImpl bean if CentralAccessCondition is true
+ */
+ @Bean
+ @Conditional(CentralAccessCondition.class)
+ public LoginService loginServiceCEntralizedImpl() {
+ return new LoginServiceCentralizedImpl();
+ }
+
+ /**
+ *
+ * @return UserProfileServiceImpl bean if LocalAccessCondition is true
+ */
+ @Bean
+ @Conditional(LocalAccessCondition.class)
+ public UserService userServiceImpl() {
+ return new UserServiceImpl();
+ }
+
+ /**
+ *
+ * @return returns UserProfileServiceCentalizedImpl bean if
+ * CentralAccessCondition is true
+ */
+ @Bean
+ @Conditional(CentralAccessCondition.class)
+ public UserService userServiceCentalizedImpl() {
+ return new UserServiceCentalizedImpl();
+ }
+
+ /**
+ *
+ * @return returns ProfileServiceImpl bean if LocalAccessCondition is true
+ */
+ @Bean
+ @Conditional(LocalAccessCondition.class)
+ public ProfileService profileServiceImpl() {
+ return new ProfileServiceImpl();
+ }
+
+ /**
+ *
+ * @return returns ProfileServiceCentralizedImpl bean if CentralAccessCondition
+ * is true
+ */
+
+ @Bean
+ @Conditional(CentralAccessCondition.class)
+ public ProfileService profileServiceCentralizedImpl() {
+ return new ProfileServiceCentralizedImpl();
+ }
+
+ /**
+ *
+ * @return returns RestApiRequestBuilder bean if CentralAccessCondition is true
+ */
+ @Bean
+ @Conditional(CentralAccessCondition.class)
+ public RestApiRequestBuilder restApiRequestBuilder() {
+ return new RestApiRequestBuilder();
+ }
+
+ /**
+ *
+ * @return returns FunctionalMenuListServiceImpl bean if LocalAccessCondition is
+ * true
+ */
+ @Bean
+ @Conditional(LocalAccessCondition.class)
+ public FunctionalMenuListService functionalMenuListService() {
+ return new FunctionalMenuListServiceImpl();
+ }
+
+ /**
+ *
+ * @return returns FunctionalMenuListServiceCentralizedImpl bean if
+ * CentralAccessCondition is true
+ */
+
+ @Bean
+ @Conditional(CentralAccessCondition.class)
+ public FunctionalMenuListService functionalMenuListServiceCentralizedImpl() {
+ return new FunctionalMenuListServiceCentralizedImpl();
+ }
+
}
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 913c9de1..0cd65df2 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
@@ -1,6 +1,6 @@
/*-
* ================================================================================
- * eCOMP Portal SDK
+ * ECOMP Portal SDK
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property
* ================================================================================
@@ -23,26 +23,32 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-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;
/**
- * Description: this java class is an interface of services for Admin to add/edit/delete menu items from FN_MENU
+ * Services for Admin to add/edit/delete menu items from FN_MENU
*/
public interface FnMenuService {
List<MenuData> getFnMenuItems();
+
void saveFnMenuData(MenuData domainFnMenu);
+
void saveFnMenu(Menu domainFnMenu);
+
void removeMenuItem(MenuData domainFnMenu);
+
MenuData getMenuItemRow(Long id);
+
Menu getMenuItem(Long id);
+
List<Long> getParentId(String label);
+
@SuppressWarnings("rawtypes")
List<List> getParentList();
- 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;
+
+ 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 22bc9675..6d8667f9 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
@@ -1,6 +1,6 @@
/*-
* ================================================================================
- * eCOMP Portal SDK
+ * ECOMP Portal SDK
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property
* ================================================================================
@@ -21,154 +21,105 @@ package org.openecomp.portalsdk.core.service;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-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
+ * Description: this java class is an implementation of services for Admin to
+ * add/edit/delete menu items from FN_MENU
*/
@Service("fnMenuService")
@Transactional
-public class FnMenuServiceImpl implements FnMenuService{
+public class FnMenuServiceImpl implements FnMenuService {
-
- private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnMenuServiceImpl.class);
@Autowired
- private DataAccessService dataAccessService;
-
- @Autowired
- private RestApiRequestBuilder restApiRequestBuilder;
-
- @SuppressWarnings("unchecked")
- public List<MenuData> getFnMenuItems() {
- //List msgDB = getDataAccessService().getList(Profile.class, null);
- return getDataAccessService().getList(MenuData.class, null, "1", null);
+ private DataAccessService dataAccessService;
+ @SuppressWarnings("unchecked")
+ public List<MenuData> getFnMenuItems() {
+ return getDataAccessService().getList(MenuData.class, null, "1", null);
}
-
public DataAccessService getDataAccessService() {
return dataAccessService;
}
-
public void setDataAccessService(DataAccessService dataAccessService) {
this.dataAccessService = dataAccessService;
}
-
@Override
public void saveFnMenuData(MenuData domainFnMenu) {
- // TODO Auto-generated method stub
getDataAccessService().saveDomainObject(domainFnMenu, null);
-
}
@SuppressWarnings("unchecked")
@Override
public List<Long> getParentId(String label) {
- // TODO Auto-generated method stub
- //List<String> functioCDlist = new ArrayList<String>();
- //functioCDlist.add("Mahdy1");
- //functioCDlist.add("Mahdy2");
- Map<String, String> params = new HashMap<String, String>();
- params.put("paramLabel", label);
+ Map<String, String> params = new HashMap<String, String>();
+ params.put("paramLabel", label);
return getDataAccessService().executeNamedQuery("IdForLabelList", params, null);
- }
+ }
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public List<List> getParentList() {
- // TODO Auto-generated method stub
- //List<String> functioCDlist = new ArrayList<String>();
- //functioCDlist.add("Mahdy1");
- //functioCDlist.add("Mahdy2");
return getDataAccessService().executeNamedQuery("parentList", null, null);
-
- //return null;
}
- @SuppressWarnings("unchecked")
- @Override
- 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;
- }
-
@Override
public void removeMenuItem(MenuData domainFnMenu) {
getDataAccessService().deleteDomainObject(domainFnMenu, null);
}
-
+
@Override
public void removeMenuItem(Menu domainFnMenu) {
getDataAccessService().deleteDomainObject(domainFnMenu, null);
}
-
+
public MenuData getMenuItemRow(Long id) {
- return (MenuData)getDataAccessService().getDomainObject(MenuData.class, id, null);
+ return (MenuData) getDataAccessService().getDomainObject(MenuData.class, id, null);
}
-
+
@Override
public Menu getMenuItem(Long id) {
- return (Menu)getDataAccessService().getDomainObject(Menu.class, id, null);
+ return (Menu) getDataAccessService().getDomainObject(Menu.class, id, null);
}
-
+
@Override
public void saveFnMenu(Menu domainFnMenu) {
- // TODO Auto-generated method stub
getDataAccessService().saveDomainObject(domainFnMenu, null);
-
}
+
@Override
- public Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList, List<MenuData> parentList, Set<MenuData> menuResult) throws Exception{
- for(MenuData menu: menuResult){
+ public Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList,
+ List<MenuData> parentList, Set<MenuData> menuResult) throws Exception {
+ for (MenuData menu : menuResult) {
MenuData parentData = new MenuData();
parentData.setLabel(menu.getLabel());
parentData.setAction(menu.getAction());
parentData.setImageSrc(menu.getImageSrc());
parentList.add(parentData);
List<MenuData> tempList = new ArrayList<MenuData>();
- for(Object o:menu.getChildMenus()){
- MenuData m = (MenuData)o;
+ for (Object o : menu.getChildMenus()) {
+ MenuData m = (MenuData) o;
MenuData data = new MenuData();
data.setLabel(m.getLabel());
data.setAction(m.getAction());
- data.setImageSrc(m.getImageSrc());
+ data.setImageSrc(m.getImageSrc());
tempList.add(data);
}
childItemList.add(tempList);
}
return null;
}
-
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListService.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListService.java
new file mode 100644
index 00000000..9419f213
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListService.java
@@ -0,0 +1,13 @@
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+
+public interface FunctionalMenuListService {
+
+ List<RoleFunction> getFunctionCDList(HttpServletRequest request) throws Exception;
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java
new file mode 100644
index 00000000..c7474de1
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java
@@ -0,0 +1,42 @@
+package org.openecomp.portalsdk.core.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+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 com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+
+public class FunctionalMenuListServiceCentralizedImpl implements FunctionalMenuListService{
+
+private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FunctionalMenuListServiceCentralizedImpl.class);
+
+ @Autowired
+ private RestApiRequestBuilder restApiRequestBuilder;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ 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, "getFunctionCDList Failed", e);
+ throw new Exception(e.getMessage());
+ }
+ return roleFunctionFinalList;
+ }
+
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceImpl.java
new file mode 100644
index 00000000..dd448856
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/FunctionalMenuListServiceImpl.java
@@ -0,0 +1,33 @@
+package org.openecomp.portalsdk.core.service;
+
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class FunctionalMenuListServiceImpl implements FunctionalMenuListService{
+
+private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FunctionalMenuListServiceImpl.class);
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<RoleFunction> getFunctionCDList(HttpServletRequest request) throws Exception {
+ return getDataAccessService().executeNamedQuery("functionCDlist", null, null);
+ }
+
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java
index 270369c5..e5d380c9 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java
@@ -6,14 +6,10 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
import org.openecomp.portalsdk.core.command.LoginBean;
import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.domain.UserApp;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.menu.MenuBuilder;
import org.openecomp.portalsdk.core.service.support.FusionService;
@@ -23,8 +19,6 @@ import org.openecomp.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
@Transactional
public class LoginServiceCentralizedImpl extends FusionService implements LoginService {
@@ -39,6 +33,9 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
@Autowired
RestApiRequestBuilder restApiRequestBuilder;
+
+ @Autowired
+ UserService userService;
@SuppressWarnings("unused")
private MenuBuilder menuBuilder;
@@ -132,51 +129,12 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
@SuppressWarnings("null")
public User findUser(LoginBean bean) throws Exception {
-
User user = null;
-
- ObjectMapper mapper = new ObjectMapper();
- HashSet<RoleFunction> rolefun = null;
-
String repsonse = restApiRequestBuilder.getViaREST("/user/" + bean.getUserid(), true, bean.getUserid());
-
-
- user = mapper.readValue(repsonse, User.class);
-
- Set<RoleFunction> roleFunctionListNew = new HashSet<>();
- Set<RoleFunction> roleFunctionList = new HashSet<>();
- SortedSet<UserApp> UserAppSet = new TreeSet<>();
-
- @SuppressWarnings("unchecked")
- Set<UserApp> setAppsObj = user.getUserApps();
-
- Iterator<UserApp> it = setAppsObj.iterator();
- while (it.hasNext()) {
- Object next = it.next();
-
- UserApp nextApp = mapper.convertValue(next, UserApp.class);
- rolefun = new HashSet<>();
- Role role = nextApp.getRole();
-
- roleFunctionList = role.getRoleFunctions();
-
- Iterator<RoleFunction> itetaror = roleFunctionList.iterator();
- while (itetaror.hasNext()) {
- Object nextValue = itetaror.next();
- RoleFunction roleFunction = mapper.convertValue(nextValue, RoleFunction.class);
- roleFunctionListNew.add(roleFunction);
- }
-
- role.setRoleFunctions(roleFunctionListNew);
- nextApp.setRole(role);
- nextApp.getRole().getRoleFunctions();
-
- UserAppSet.add(nextApp);
- user.setUserApps(UserAppSet);
- }
-
+ user = userService.userMapper(repsonse);
return user;
}
+
public User findUser(String loginId, String password) {
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java
index 94ecfaf4..00673682 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java
@@ -12,7 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class RestApiRequestBuilder {
- private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleServiceCentralizedAccess.class);
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestApiRequestBuilder.class);
@Autowired
AppService appService;
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserService.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserService.java
index 170361c3..d1c2f4b4 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserService.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserService.java
@@ -4,13 +4,22 @@ import org.openecomp.portalsdk.core.domain.User;
public interface UserService {
-
/**
+ * Gets the user object for the specified ID.
*
- * @param id orgUserID
+ * @param id
+ * orgUserID
* @return User object
* @throws Exception
- * Method getUser returns the User Object
*/
User getUser(String id) throws Exception;
+
+ /**
+ * Builds a User object from a JSON string.
+ *
+ * @param response
+ * @return User object
+ * @throws Exception
+ */
+ User userMapper(String response) throws Exception;
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java
index 879b2a9a..979d6658 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java
@@ -44,16 +44,36 @@ public class UserServiceCentalizedImpl implements UserService {
@Override
public User getUser(String id) throws Exception {
- ObjectMapper mapper = new ObjectMapper();
- User user = new User();
- HashSet<RoleFunction> rolefun = null;
+ User user = null;
String orgUserId = getUserByProfileId(id);
String responseString = restApiRequestBuilder.getViaREST("/user/" + orgUserId, true, id);
- user = mapper.readValue(responseString, User.class);
-
+ user = userMapper(responseString);
+ return user;
+ }
+
+ public String getUserByProfileId(String id) {
+ Map<String, Long> params = new HashMap<String, Long>();
+ params.put("user_id", new Long(id));
+ @SuppressWarnings("rawtypes")
+ List list = getDataAccessService().executeNamedQuery("getUserByProfileId", params, null);
+ String orgUserId = "";
+ if (list != null && !list.isEmpty())
+ orgUserId = (String) list.get(0);
+ return orgUserId;
+ }
+
+ @Override
+ public User userMapper(String res) throws Exception
+ {
+ User user= new User();
+ ObjectMapper mapper = new ObjectMapper();
+ HashSet<RoleFunction> rolefun = null;
+ user = mapper.readValue(res, User.class);
+ Set<RoleFunction> roleFunctionListNew = new HashSet<>();
+ Set<RoleFunction> roleFunctionList = new HashSet<>();
+ SortedSet<UserApp> UserAppSet = new TreeSet<>();
@SuppressWarnings("unchecked")
Set<UserApp> setAppsObj = user.getUserApps();
-
Iterator<UserApp> it = setAppsObj.iterator();
while (it.hasNext()) {
Object next = it.next();
@@ -61,36 +81,21 @@ public class UserServiceCentalizedImpl implements UserService {
UserApp nextApp = mapper.convertValue(next, UserApp.class);
rolefun = new HashSet<>();
Role role = nextApp.getRole();
-
- Set<RoleFunction> roleFunctionList = role.getRoleFunctions();
- Set<RoleFunction> roleFunctionListNew = new HashSet<>();
+ roleFunctionList = role.getRoleFunctions();
Iterator<RoleFunction> itetaror = roleFunctionList.iterator();
while (itetaror.hasNext()) {
Object nextValue = itetaror.next();
RoleFunction roleFunction = mapper.convertValue(nextValue, RoleFunction.class);
roleFunctionListNew.add(roleFunction);
}
-
role.setRoleFunctions(roleFunctionListNew);
nextApp.setRole(role);
nextApp.getRole().getRoleFunctions();
- SortedSet<UserApp> UserAppSet = new TreeSet<>();
+
UserAppSet.add(nextApp);
user.setUserApps(UserAppSet);
}
-
return user;
}
- public String getUserByProfileId(String id) {
- Map<String, Long> params = new HashMap<String, Long>();
- params.put("user_id", new Long(id));
- @SuppressWarnings("rawtypes")
- List list = getDataAccessService().executeNamedQuery("getUserByProfileId", params, null);
- String orgUserId = "";
- if (list != null && !list.isEmpty())
- orgUserId = (String) list.get(0);
- return orgUserId;
- }
-
}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceImpl.java
index 24404fda..80f8bb2a 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceImpl.java
@@ -10,18 +10,14 @@ public class UserServiceImpl implements UserService {
@Autowired
private DataAccessService dataAccessService;
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
@Override
public User getUser(String id) {
- return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(id), null);
-
+ return (User) dataAccessService.getDomainObject(User.class, Long.parseLong(id), null);
+ }
+
+ @Override
+ public User userMapper(String response) throws Exception {
+ throw new UnsupportedOperationException("method cannot be used");
}
}