summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorst782s <statta@research.att.com>2017-07-14 14:19:22 -0400
committerst782s <statta@research.att.com>2017-07-14 14:29:49 -0400
commit3aec9d2ab7f373a12e052d5e2c1c59b2a19770dc (patch)
treefd13e4b474891a3efa1320524026d7ddad757297 /ecomp-sdk
parent30b8e1fd4328ea37fc5599f8a9723ea79ae0e369 (diff)
[Portal 21] Role management
This push includes continuation of the changes required to handle cetralized roles,user management Change-Id: I38e9dc946ff53ac61dd3b580c335f4ad52b372f7 Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-analytics/pom.xml4
-rw-r--r--ecomp-sdk/epsdk-app-common/pom.xml8
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java42
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileSearchController.java6
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleController.java8
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java12
-rw-r--r--ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/SingleSignOnController.java2
-rw-r--r--ecomp-sdk/epsdk-app-os/pom.xml4
-rw-r--r--ecomp-sdk/epsdk-app-overlay/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml4
-rw-r--r--ecomp-sdk/epsdk-core/pom.xml4
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/AccessConfiguration.java8
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceCentralizedImpl.java4
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java13
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RestApiRequestBuilder.java11
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java8
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java64
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java2
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java10
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java1
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceCentalizedImpl.java137
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java6
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserService.java16
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java96
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceImpl.java27
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java6
-rw-r--r--ecomp-sdk/epsdk-fw/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-workflow/pom.xml4
-rw-r--r--ecomp-sdk/pom.xml2
29 files changed, 262 insertions, 251 deletions
diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml
index c416f38a..4f612f90 100644
--- a/ecomp-sdk/epsdk-analytics/pom.xml
+++ b/ecomp-sdk/epsdk-analytics/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
@@ -68,7 +68,7 @@
<!-- sdk-core -->
<dependency>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-core</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/ecomp-sdk/epsdk-app-common/pom.xml b/ecomp-sdk/epsdk-app-common/pom.xml
index 90d9a7a2..f315974a 100644
--- a/ecomp-sdk/epsdk-app-common/pom.xml
+++ b/ecomp-sdk/epsdk-app-common/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
@@ -156,17 +156,17 @@
<dependencies>
<!-- SDK components -->
<dependency>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-core</artifactId>
<version>${epsdk.version}</version>
</dependency>
<dependency>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-analytics</artifactId>
<version>${epsdk.version}</version>
</dependency>
<dependency>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-workflow</artifactId>
<version>${epsdk.version}</version>
</dependency>
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java
index a40b20ac..f4132a9e 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileController.java
@@ -36,6 +36,7 @@ import org.openecomp.portalsdk.core.domain.User;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.service.RoleService;
import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.openecomp.portalsdk.core.service.UserService;
import org.openecomp.portalsdk.core.web.support.AppUtils;
import org.openecomp.portalsdk.core.web.support.JsonMessage;
import org.openecomp.portalsdk.core.web.support.UserUtils;
@@ -59,12 +60,15 @@ public class ProfileController extends RestrictedBaseController {
UserProfileService service;
@Autowired
+ UserService userService;
+
+ @Autowired
RoleService roleService;
private String viewName;
@RequestMapping(value = { "/profile" }, method = RequestMethod.GET)
- public ModelAndView profile(HttpServletRequest request, HttpServletResponse response) {
+ public ModelAndView profile(HttpServletRequest request, HttpServletResponse response) throws Exception{
Map<String, Object> model = new HashMap<String, Object>();
ObjectMapper mapper = new ObjectMapper();
User user = UserUtils.getUserSession(request);
@@ -77,7 +81,7 @@ public class ProfileController extends RestrictedBaseController {
profileId = profile.getId();
} else {
profileId = Long.parseLong(request.getParameter("profile_id"));
- profile = (User) service.getUser(request.getParameter("profile_id"));
+ profile = (User) userService.getUser(String.valueOf(profileId));
}
try {
@@ -94,7 +98,7 @@ public class ProfileController extends RestrictedBaseController {
}
@RequestMapping(value = { "/self_profile" }, method = RequestMethod.GET)
- public ModelAndView self_profile(HttpServletRequest request) {
+ public ModelAndView self_profile(HttpServletRequest request) throws Exception{
Map<String, Object> model = new HashMap<String, Object>();
ObjectMapper mapper = new ObjectMapper();
@@ -103,9 +107,6 @@ public class ProfileController extends RestrictedBaseController {
User user = UserUtils.getUserSession(request);
profile = UserUtils.getUserSession(request);
- profileId = profile.getId();
- profile = (User) service.getUser(profileId.toString());
-
try {
model.put("stateList", mapper.writeValueAsString(getStates()));
model.put("countries", mapper.writeValueAsString(getCountries()));
@@ -120,7 +121,7 @@ public class ProfileController extends RestrictedBaseController {
}
@RequestMapping(value = { "/get_self_profile" }, method = RequestMethod.GET)
- public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) {
+ public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) throws Exception{
Map<String, Object> model = new HashMap<String, Object>();
ObjectMapper mapper = new ObjectMapper();
User user = UserUtils.getUserSession(request);
@@ -128,10 +129,7 @@ public class ProfileController extends RestrictedBaseController {
User profile = null;
Long profileId = null;
- profile = UserUtils.getUserSession(request);
- profileId = profile.getId();
- profile = (User) service.getUser(profileId.toString());
-
+ profile = (User) UserUtils.getUserSession(request);
try {
model.put("stateList", mapper.writeValueAsString(getStates()));
model.put("countries", mapper.writeValueAsString(getCountries()));
@@ -161,7 +159,8 @@ public class ProfileController extends RestrictedBaseController {
profileId = profile.getId();
} else {
profileId = Long.parseLong(request.getParameter("profile_id"));
- profile = (User) service.getUser(request.getParameter("profile_id"));
+ profile = (User) userService.getUser(String.valueOf(profileId));
+
}
model.put("stateList", mapper.writeValueAsString(getStates()));
model.put("countries", mapper.writeValueAsString(getCountries()));
@@ -194,7 +193,7 @@ public class ProfileController extends RestrictedBaseController {
Long profileId = Long.parseLong(request.getParameter("profile_id"));
- User domainUser = (User) service.getUser(request.getParameter("profile_id"));
+ User domainUser = (User) userService.getUser(String.valueOf(profileId));
// user.setRoles(domainUser.getRoles());
user.setPseudoRoles(domainUser.getPseudoRoles());
user.setUserApps(domainUser.getUserApps());
@@ -248,14 +247,14 @@ public class ProfileController extends RestrictedBaseController {
JsonNode root = mapper.readTree(request.getReader());
Role role = mapper.readValue(root.get("role").toString(), Role.class);
- // Long profileId = Long.parseLong(request.getParameter("profile_id"));
+ String profileId = request.getParameter("profile_id");
- User domainUser = (User) service.getUser(request.getParameter("profile_id"));
+ User domainUser = (User) userService.getUser(profileId);
domainUser.removeRole(role.getId());
service.saveUser(domainUser);
- logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + role.getId() + " from user " + request.getParameter("profile_id"));
+ logger.info(EELFLoggerDelegate.auditLogger, "Remove role " + role.getId() + " from user " + profileId);
response.setCharacterEncoding("UTF-8");
response.setContentType("application / json");
@@ -291,22 +290,17 @@ public class ProfileController extends RestrictedBaseController {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
Role role = mapper.readValue(root.get("role").toString(), Role.class);
-
- // Long profileId = Long.parseLong(request.getParameter("profile_id"));
-
- User domainUser = (User) service.getUser(request.getParameter("profile_id"));
-
+ String profileId = request.getParameter("profile_id");
+ User domainUser = (User) userService.getUser(profileId);
domainUser.addRole(role);
-
service.saveUser(domainUser);
- logger.info(EELFLoggerDelegate.auditLogger, "Add new role " + role.getName() + " to user " + request.getParameter("profile_id"));
+ logger.info(EELFLoggerDelegate.auditLogger, "Add new role " + role.getName() + " to user " + profileId);
response.setCharacterEncoding("UTF-8");
response.setContentType("application / json");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
-
Map<String, Object> model = new HashMap<String, Object>();
model.put("profile", mapper.writeValueAsString(domainUser));
JSONObject j = new JSONObject(mapper.writeValueAsString(domainUser));
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileSearchController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileSearchController.java
index e44aef8b..1e600a30 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileSearchController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/ProfileSearchController.java
@@ -38,6 +38,7 @@ import org.openecomp.portalsdk.core.domain.User;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.service.FnMenuService;
import org.openecomp.portalsdk.core.service.UserProfileService;
+import org.openecomp.portalsdk.core.service.UserService;
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 ProfileSearchController extends RestrictedBaseController {
private UserProfileService service;
@Autowired
+ UserService userService;
+
+ @Autowired
private FnMenuService fnMenuService;
@RequestMapping(value = { "/profile_search" }, method = RequestMethod.GET)
@@ -142,7 +146,7 @@ public class ProfileSearchController extends RestrictedBaseController {
logger.info(EELFLoggerDelegate.applicationLogger,
"Initiating toggleProfileActive in ProfileSearchController");
String userId = request.getParameter("profile_id");
- User user = (User) service.getUser(userId);
+ User user = (User) userService.getUser(userId);
user.setActive(!user.getActive());
service.saveUser(user);
logger.info(EELFLoggerDelegate.auditLogger,
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleController.java
index 0fc4edc4..5d12f4aa 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleController.java
@@ -149,15 +149,19 @@ public class RoleController extends RestrictedBaseController {
domainRole = new Role();
domainRole.setName(role.getName());
domainRole.setPriority(role.getPriority());
- if (role.getChildRoles().size() > 0) {
+ if(role.getChildRoles() != null && role.getChildRoles().size() > 0 ){
+// if (role.getChildRoles().size() > 0 ) {
for (Object childRole : childRoles) {
domainRole.addChildRole((Role) childRole);
}
+// }
}
- if (role.getRoleFunctions().size() > 0) {
+ if(role.getRoleFunctions() != null && role.getRoleFunctions().size() > 0){
+// if (role.getRoleFunctions().size() > 0) {
for (Object roleFunction : roleFunctions) {
domainRole.addRoleFunction((RoleFunction) roleFunction);
}
+// }
}
}
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java
index 0014d0a5..0b8fb8c8 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java
@@ -76,8 +76,6 @@ public class RoleFunctionListController extends RestrictedBaseController {
Map<String, Object> model = new HashMap<String, Object>();
ObjectMapper mapper = new ObjectMapper();
User user = UserUtils.getUserSession(request);
-
-
try {
model.put("availableRoleFunctions", mapper.writeValueAsString(service.getRoleFunctions(user.getOrgUserId())));
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
@@ -108,6 +106,7 @@ public class RoleFunctionListController extends RestrictedBaseController {
} catch (Exception e) {
restCallStatus="fail";
logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e);
+ throw new Exception("failed while Saving RoleFunction");
}
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(restCallStatus));
JSONObject j = new JSONObject(msg);
@@ -125,10 +124,7 @@ public class RoleFunctionListController extends RestrictedBaseController {
try {
String data = roleFunc;
RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class);
- String code = availableRoleFunction.getCode();
- RoleFunction domainRoleFunction = service.getRoleFunction(user.getOrgUserId(),code);
- domainRoleFunction.setName(availableRoleFunction.getName());
- domainRoleFunction.setCode(code);
+ String code = availableRoleFunction.getCode();
List<RoleFunction> currentRoleFunction = service.getRoleFunctions(user.getOrgUserId());
restCallStatus="success";
for(RoleFunction roleF:currentRoleFunction){
@@ -139,10 +135,11 @@ public class RoleFunctionListController extends RestrictedBaseController {
}
}
if(canSave)
- service.saveRoleFunction(user.getOrgUserId(),domainRoleFunction);
+ service.saveRoleFunction(user.getOrgUserId(),availableRoleFunction);
} catch (Exception e) {
restCallStatus="fail";
logger.error(EELFLoggerDelegate.errorLogger, "addRoleFunction failed", e);
+ throw new Exception(e.getMessage());
}
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(restCallStatus));
JSONObject j = new JSONObject(msg);
@@ -169,6 +166,7 @@ public class RoleFunctionListController extends RestrictedBaseController {
} catch (Exception e) {
restCallStatus="fail";
logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed", e);
+ throw new Exception(e.getMessage());
}
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(restCallStatus));
JSONObject j = new JSONObject(msg);
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/SingleSignOnController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/SingleSignOnController.java
index 64ff160e..766d9eb9 100644
--- a/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/SingleSignOnController.java
+++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/SingleSignOnController.java
@@ -108,7 +108,7 @@ public class SingleSignOnController extends UnRestrictedBaseController {
commandBean = getLoginService().findUser(commandBean,
(String) request.getAttribute(MenuProperties.MENU_PROPERTIES_FILENAME_KEY),
additionalParamsMap);
- List<RoleFunction> roleFunctionList= roleService.getRoleFunctions(user.getLoginId());
+ List<RoleFunction> roleFunctionList= roleService.getRoleFunctions(userId);
if (commandBean.getUser() == null) {
String loginErrorMessage = (commandBean.getLoginErrorMessage() != null)
? commandBean.getLoginErrorMessage()
diff --git a/ecomp-sdk/epsdk-app-os/pom.xml b/ecomp-sdk/epsdk-app-os/pom.xml
index abba5fd3..9cc00184 100644
--- a/ecomp-sdk/epsdk-app-os/pom.xml
+++ b/ecomp-sdk/epsdk-app-os/pom.xml
@@ -4,7 +4,7 @@
<!-- This is the Maven project object model (POM) file for the open-source SDK web app.
This is NOT the Portal - but it is developed and supported by the Portal team. -->
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-app-os</artifactId>
<version>1.3.0-SNAPSHOT</version>
<packaging>war</packaging>
@@ -118,7 +118,7 @@
</archive>
<overlays>
<overlay>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-app-overlay</artifactId>
</overlay>
</overlays>
diff --git a/ecomp-sdk/epsdk-app-overlay/pom.xml b/ecomp-sdk/epsdk-app-overlay/pom.xml
index ebfd84fe..29d1cc5b 100644
--- a/ecomp-sdk/epsdk-app-overlay/pom.xml
+++ b/ecomp-sdk/epsdk-app-overlay/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
index 39939ca0..e569972a 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
@@ -381,5 +381,9 @@
<query name="deleteReportSecurityRoles">
delete from ReportUserRole where repId = :report_id and roleId =:role_id
</query>
+
+ <query name="getUserByProfileId">
+ select orgUserId from User where id = :user_id
+ </query>
</hibernate-mapping>
diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml
index 63689523..9a88f73a 100644
--- a/ecomp-sdk/epsdk-core/pom.xml
+++ b/ecomp-sdk/epsdk-core/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
@@ -94,7 +94,7 @@
<!-- internal -->
<dependency>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-fw</artifactId>
<version>${project.version}</version>
<exclusions>
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 ae6bd309..ee97bc93 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
@@ -58,8 +58,8 @@ public class AccessConfiguration {
*/
@Bean
@Conditional(LocalAccessCondition.class)
- public UserProfileService userProfileServiceImpl() {
- return new UserProfileServiceImpl();
+ public UserService userServiceImpl() {
+ return new UserServiceImpl();
}
@@ -69,8 +69,8 @@ public class AccessConfiguration {
*/
@Bean
@Conditional(CentralAccessCondition.class)
- public UserProfileService userProfileServiceCentalizedImpl() {
- return new UserProfileServiceCentalizedImpl();
+ public UserService userServiceCentalizedImpl() {
+ return new UserServiceCentalizedImpl();
}
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 45eff80c..6d723afa 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
@@ -21,9 +21,12 @@ import org.openecomp.portalsdk.core.util.SystemProperties;
import org.openecomp.portalsdk.core.web.support.AppUtils;
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 {
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LoginServiceCentralizedImpl.class);
@@ -102,7 +105,6 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS
Set appMenu = getMenuBuilder().getMenu(
SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME), dataAccessService);
bean.setMenu(appMenu != null ? appMenu : new HashSet());
- System.out.println(appMenu);
Set businessDirectMenu = getMenuBuilder().getMenu(
SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME),
dataAccessService);
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java
index c4da3338..e0b97254 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceCentralizedImpl.java
@@ -6,10 +6,11 @@ import org.openecomp.portalsdk.core.domain.Profile;
import org.openecomp.portalsdk.core.domain.User;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.type.TypeFactory;
+@Transactional
public class ProfileServiceCentralizedImpl implements ProfileService{
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ProfileServiceCentralizedImpl.class);
@@ -31,16 +32,10 @@ public class ProfileServiceCentralizedImpl implements ProfileService{
@Autowired
RestApiRequestBuilder restApiRequestBuilder ;
+ @SuppressWarnings("unchecked")
@Override
public List<Profile> findAll() throws Exception{
-
- List<Profile> profileList =null;
- ObjectMapper mapper = new ObjectMapper();
-
- String user = restApiRequestBuilder.getViaREST("/findAllProfiles", true,null);
- profileList = mapper.readValue(user,
- TypeFactory.defaultInstance().constructCollectionType(List.class, Profile.class));
- return profileList;
+ return getDataAccessService().getList(Profile.class, null);
}
@Override
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 6a2f7a47..f7a9cbec 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
@@ -19,7 +19,7 @@ public class RestApiRequestBuilder {
public static String content_type = "application/json";
- public String getViaREST(String restEndPoint, boolean isBasicAuth,String userId) {
+ public String getViaREST(String restEndPoint, boolean isBasicAuth,String userId) throws Exception {
String appName = "";
String requestId = "";
String appUserName = "";
@@ -51,13 +51,14 @@ public class RestApiRequestBuilder {
response = RestWebServiceClient.getInstance().getPortalContent(restEndPoint, userId,appName, requestId, appUserName,
decryptedPwd, isBasicAuth);
} catch (Exception ex) {
- response = "Failed to get roles " + ex.toString();
+ response = "Failed to perform GET " + ex.toString();
+ throw new Exception(ex.getMessage());
}
logger.debug(EELFLoggerDelegate.debugLogger, "getRoles response: {}", response);
return response;
}
- public void postViaREST(String restEndPoint, boolean isBasicAuth, String content,String userId) {
+ public void postViaREST(String restEndPoint, boolean isBasicAuth, String content,String userId) throws Exception {
String appName = "";
String requestId = "";
String appUserName = "";
@@ -90,12 +91,13 @@ public class RestApiRequestBuilder {
decryptedPwd, content_type, content, isBasicAuth);
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.debugLogger, "POST response: {}", ex);
+ throw new Exception("Save Failed");
}
logger.debug(EELFLoggerDelegate.debugLogger, "POST response: {}");
}
- public void deleteViaRest(String restEndPoint, boolean isBasicAuth, String content, String filter , String userId) {
+ public void deleteViaRest(String restEndPoint, boolean isBasicAuth, String content, String filter , String userId) throws Exception {
String appName = "";
String requestId = "";
String appUserName = "";
@@ -128,6 +130,7 @@ public class RestApiRequestBuilder {
decryptedPwd, content_type, content, isBasicAuth, filter);
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.debugLogger, "DELETE response: {}", ex);
+ throw new Exception("Delete Failed");
}
logger.debug(EELFLoggerDelegate.debugLogger, "DELETE response: {}");
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java
index f05adf64..ba8d4477 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java
@@ -63,7 +63,7 @@ public interface RoleService {
* @param domainRole Object to be saved
* Method saveRole saves the Role Object
*/
- void saveRole(String requestedLoginId,Role domainRole);
+ void saveRole(String requestedLoginId,Role domainRole) throws Exception;
/**
*
@@ -71,7 +71,7 @@ public interface RoleService {
* @param domainRole Object to be removed
* Method deleteRole deletes the requested Role Object
*/
- void deleteRole(String requestedLoginId,Role domainRole);
+ void deleteRole(String requestedLoginId,Role domainRole) throws Exception;
/**
*
@@ -109,7 +109,7 @@ public interface RoleService {
* @param domainRoleFunction
* Method saveRoleFunction saves the requested RoleFunction object
*/
- void saveRoleFunction(String requestedLoginId,RoleFunction domainRoleFunction);
+ void saveRoleFunction(String requestedLoginId,RoleFunction domainRoleFunction) throws Exception;
/**
*
@@ -117,7 +117,7 @@ public interface RoleService {
* @param domainRoleFunction
* Method deleteRoleFunction deletes the requested RoleFunction object
*/
- void deleteRoleFunction(String requestedLoginId,RoleFunction domainRoleFunction);
+ void deleteRoleFunction(String requestedLoginId,RoleFunction domainRoleFunction) throws Exception;
/**
*
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java
index f507a7fc..c7445b60 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceCentralizedAccess.java
@@ -1,5 +1,6 @@
package org.openecomp.portalsdk.core.service;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -72,41 +73,55 @@ public class RoleServiceCentralizedAccess implements RoleService {
@Override
public Role getRole(String loginId, Long id) throws Exception {
ObjectMapper mapper = new ObjectMapper();
-
String roleString = restApiRequestBuilder.getViaREST("/role/" + id, true, loginId);
Role role = null;
-
role = mapper.readValue(roleString, Role.class);
+ if (role.getRoleFunctions() != null) {
+ @SuppressWarnings("unchecked")
+ Set<RoleFunction> roleFunctionList = role.getRoleFunctions();
+ Set<RoleFunction> roleFunctionListNew = new HashSet<>();
+ Iterator<RoleFunction> itetaror = roleFunctionList.iterator();
+ while (itetaror.hasNext()) {
+ Object nextValue = itetaror.next();
+ RoleFunction roleFun = mapper.convertValue(nextValue, RoleFunction.class);
+ roleFunctionListNew.add(roleFun);
+ }
+ role.setRoleFunctions(roleFunctionListNew);
+ }
logger.info(EELFLoggerDelegate.applicationLogger, "role_id" + role.getId());
return role;
}
@Override
- public void saveRole(String loginId, Role domainRole) {
+ public void saveRole(String loginId, Role domainRole) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ String role = mapper.writeValueAsString(domainRole);
try {
- restApiRequestBuilder.postViaREST("/saveRole", true, domainRole.toString(), loginId);
+ restApiRequestBuilder.postViaREST("/saveRole", true, role, loginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "saveRole Failed", e);
+ throw new Exception(e.getMessage());
}
}
@Override
- public void deleteRole(String loginId, Role domainRole) {
-
+ public void deleteRole(String loginId, Role domainRole) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ String role = mapper.writeValueAsString(domainRole);
String filter = " where active_yn = 'Y' ";
try {
- restApiRequestBuilder.deleteViaRest("/deleteRole", true, domainRole.toString(), filter, loginId);
+ restApiRequestBuilder.deleteViaRest("/deleteRole", true, role, filter, loginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "deleteRole Failed", e);
+ throw new Exception(e.getMessage());
}
}
@Override
public List<Role> getAvailableRoles(String requestedLoginId) throws Exception {
ObjectMapper mapper = new ObjectMapper();
-
String roleList = restApiRequestBuilder.getViaREST("/getRoles", true, requestedLoginId);
List<Role> roles = null;
roles = mapper.readValue(roleList,
@@ -117,7 +132,7 @@ public class RoleServiceCentralizedAccess implements RoleService {
@Override
public List<Role> getActiveRoles(String requestedLoginId) throws Exception {
ObjectMapper mapper = new ObjectMapper();
- String roleString = restApiRequestBuilder.getViaREST("/activeRoles?active_yn = 'Y'", true, requestedLoginId);
+ String roleString = restApiRequestBuilder.getViaREST("/activeRoles", true, requestedLoginId);
List<Role> roles = null;
roles = mapper.readValue(roleString,
TypeFactory.defaultInstance().constructCollectionType(List.class, Role.class));
@@ -127,38 +142,41 @@ public class RoleServiceCentralizedAccess implements RoleService {
@Override
public RoleFunction getRoleFunction(String requestedLoginId, String code) throws Exception {
-
ObjectMapper mapper = new ObjectMapper();
String responseString = restApiRequestBuilder.getViaREST("/getRoleFunction/" + code, true, requestedLoginId);
- RoleFunction roleFunction = null;
- roleFunction = mapper.readValue(responseString, RoleFunction.class);
+ RoleFunction roleFunction = new RoleFunction();
+ if (!responseString.isEmpty()) {
+ roleFunction = mapper.readValue(responseString, RoleFunction.class);
+ }
return roleFunction;
}
@Override
- public void saveRoleFunction(String requestedLoginId, RoleFunction domainRoleFunction) {
- try {
- restApiRequestBuilder.postViaREST("/saveRoleFunction", true, domainRoleFunction.toString(),
- requestedLoginId);
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction Failed", e);
+ public void saveRoleFunction(String requestedLoginId, RoleFunction domainRoleFunction) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ String roleFunction = mapper.writeValueAsString(domainRoleFunction);
+ try{
+ restApiRequestBuilder.postViaREST("/saveRoleFunction", true, roleFunction, requestedLoginId);
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.errorLogger, "deleteDependcyRoleRecord Failed", e);
+ throw new Exception(e.getMessage());
}
}
@Override
- public void deleteRoleFunction(String requestedLoginId, RoleFunction domainRoleFunction) {
-
+ public void deleteRoleFunction(String requestedLoginId, RoleFunction domainRoleFunction) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ String roleFunction = mapper.writeValueAsString(domainRoleFunction);
try {
- restApiRequestBuilder.deleteViaRest("/deleteRoleFucntion", true, domainRoleFunction.toString(), null,
- requestedLoginId);
+ restApiRequestBuilder.deleteViaRest("/deleteRoleFunction", true, roleFunction, null, requestedLoginId);
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction Failed", e);
+ throw new Exception(e.getMessage());
}
}
@Override
public void deleteDependcyRoleRecord(String requestedLoginId, Long id) {
-
try {
restApiRequestBuilder.deleteViaRest("/deleteDependcyRoleRecord/" + id, true, null, null, requestedLoginId);
} catch (Exception e) {
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java
index c0275b87..528f1bbb 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessCentalizedImpl.java
@@ -14,7 +14,9 @@ import org.openecomp.portalsdk.core.util.SystemProperties;
import org.openecomp.portalsdk.core.web.support.AppUtils;
import org.openecomp.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+@Transactional
public class UrlAccessCentalizedImpl implements UrlAccessService {
@Autowired
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java
index e01abfbb..7074f512 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UrlAccessImpl.java
@@ -9,14 +9,14 @@ import javax.servlet.http.HttpServletRequest;
import org.openecomp.portalsdk.core.domain.UrlsAccessible;
import org.openecomp.portalsdk.core.web.support.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+@Transactional
public class UrlAccessImpl implements UrlAccessService{
@Autowired
DataAccessService dataAccessService;
-
-
@Override
public boolean isUrlAccessible(HttpServletRequest request, String currentUrl) {
boolean isAccessible = false;
@@ -27,12 +27,6 @@ public class UrlAccessImpl implements UrlAccessService{
// loop through the list of restricted URL's
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
- /*
- * Object[] restrictedUrl = (Object[])list.get(i);
- *
- * String url = (String)restrictedUrl[0]; String functionCd =
- * (String)restrictedUrl[1];
- */
UrlsAccessible urlFunctions = (UrlsAccessible) list.get(i);
// String url = (String) urlFunctions.getUrl();
String functionCd = (String) urlFunctions.getFunctionCd();
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java
index b844fb0c..2273bad1 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java
@@ -26,7 +26,6 @@ import org.openecomp.portalsdk.core.domain.User;
public interface UserProfileService {
List<User> findAll();
- User getUser(String id);
User getUserByLoginId(String loginId);
void saveUser(User user);
public List<User> findAllUserWithOnOffline(String originOrgUserId);
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceCentalizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceCentalizedImpl.java
deleted file mode 100644
index 3e7b2b14..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceCentalizedImpl.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.openecomp.portalsdk.core.service;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.SortedSet;
-
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.domain.support.CollaborateList;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.type.TypeFactory;
-
-
-@Transactional
-public class UserProfileServiceCentalizedImpl implements UserProfileService {
-
- private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(UserProfileServiceCentalizedImpl.class);
-
- @Autowired
- AppService appService;
-
- @Autowired
- RestApiRequestBuilder restApiRequestBuilder;
-
- @Autowired
- private DataAccessService dataAccessService;
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
- @Override
- public List<User> findAll() {
- List<User> roles = new ArrayList<>();
- ObjectMapper mapper = new ObjectMapper();
-
- String user = restApiRequestBuilder.getViaREST("/findAll", true,null);
- try {
- roles = mapper.readValue(user,
- TypeFactory.defaultInstance().constructCollectionType(List.class, User.class));
- } catch (JsonParseException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Json parsing failed", e);
- } catch (JsonMappingException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Json mapping failed", e);
- } catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "IO exception", e);
- }
-
- return roles;
- }
-
- @Override
- public User getUser(String id) {
- ObjectMapper mapper = new ObjectMapper();
- User user = new User();
- String responseString = restApiRequestBuilder.getViaREST("/getUser/" + id, true,id);
- try {
-
- user = mapper.readValue(responseString, User.class);
- } catch (JsonParseException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Json parsing failed", e);
- } catch (JsonMappingException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Json mapping failed", e);
- } catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "IO exception", e);
- }
-
- return user;
- }
-
- @Override
- public User getUserByLoginId(String loginId) {
- return getUser(loginId);
- }
-
- @Override
- public void saveUser(User user) {
- try {
- getDataAccessService().saveDomainObject(user, null);
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "saveUser Failed", e);
- }
- }
-
- @Override
- public List<User> findAllUserWithOnOffline(String originOrgUserId) {
- HashSet<String> onlineUser = CollaborateList.getInstance().getAllUserName();
- List<User> users = findAll();
- for (User u : users) {
- if (onlineUser.contains(u.getOrgUserId()))
- u.setOnline(true);
- if (u.getOrgUserId() != null) {
- if (originOrgUserId.compareTo(u.getOrgUserId()) > 0) {
- u.setChatId(originOrgUserId + "-" + u.getOrgUserId());
- } else
- u.setChatId(u.getOrgUserId() + "-" + originOrgUserId);
- }
- }
- return users;
- }
-
- @Override
- public List<User> findAllActive() {
- List<User> users = findAll();
- Iterator<User> itr = users.iterator();
- while (itr.hasNext()) {
- User u = (User) itr.next();
- if (!u.getActive())
- itr.remove();// if not active remove user from list
- else {
- SortedSet<Role> roles = u.getRoles();
- Iterator<Role> itrRoles = roles.iterator();
- while (itrRoles.hasNext()) {
- Role role = (Role) itrRoles.next();
- if (!role.getActive())
- u.removeRole(role.getId());// if not active remove role
- // from list
- }
- }
- }
- return users;
- }
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java
index 866318c5..93b87594 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java
@@ -31,8 +31,10 @@ import org.openecomp.portalsdk.core.domain.Role;
import org.openecomp.portalsdk.core.domain.User;
import org.openecomp.portalsdk.core.domain.support.CollaborateList;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+@Service("userProfile")
@Transactional
public class UserProfileServiceImpl implements UserProfileService{
@@ -45,10 +47,6 @@ public class UserProfileServiceImpl implements UserProfileService{
return getDataAccessService().getList(User.class, null);
}
- public User getUser(String userId){
- return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(userId), null);
- }
-
@SuppressWarnings("unchecked")
public User getUserByLoginId(String loginId){
User user=null;
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
new file mode 100644
index 00000000..2cc28cc2
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserService.java
@@ -0,0 +1,16 @@
+package org.openecomp.portalsdk.core.service;
+
+import org.openecomp.portalsdk.core.domain.User;
+
+public interface UserService {
+
+
+ /**
+ *
+ * @param id orgUserID
+ * @return
+ * @throws Exception
+ * Method getUser returns the User Object
+ */
+ User getUser(String id) 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
new file mode 100644
index 00000000..17691908
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceCentalizedImpl.java
@@ -0,0 +1,96 @@
+package org.openecomp.portalsdk.core.service;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Transactional
+public class UserServiceCentalizedImpl implements UserService {
+
+ @Autowired
+ AppService appService;
+
+ @Autowired
+ RestApiRequestBuilder restApiRequestBuilder;
+
+ @Autowired
+ LoginService loginService;
+
+ @Autowired
+ private DataAccessService dataAccessService;
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+
+ @Override
+ public User getUser(String id) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ User user = new User();
+ HashSet<RoleFunction> rolefun = null;
+ String orgUserId = getUserByProfileId(id);
+ String responseString = restApiRequestBuilder.getViaREST("/getUser/" + orgUserId, true, id);
+ user = mapper.readValue(responseString, User.class);
+
+ @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();
+
+ Set<RoleFunction> roleFunctionList = role.getRoleFunctions();
+ Set<RoleFunction> roleFunctionListNew = new HashSet<>();
+ 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
new file mode 100644
index 00000000..24404fda
--- /dev/null
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/service/UserServiceImpl.java
@@ -0,0 +1,27 @@
+package org.openecomp.portalsdk.core.service;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+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);
+
+ }
+
+}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
index 6b3dc4dc..ea26b969 100644
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
+++ b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/web/support/UserUtils.java
@@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.UUID;
@@ -37,7 +36,6 @@ import javax.servlet.http.HttpSession;
import org.openecomp.portalsdk.core.domain.Role;
import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.openecomp.portalsdk.core.domain.UrlsAccessible;
import org.openecomp.portalsdk.core.domain.User;
import org.openecomp.portalsdk.core.exception.SessionExpiredException;
import org.openecomp.portalsdk.core.lm.FusionLicenseManager;
@@ -46,7 +44,6 @@ import org.openecomp.portalsdk.core.menu.MenuBuilder;
import org.openecomp.portalsdk.core.restful.domain.EcompRole;
import org.openecomp.portalsdk.core.restful.domain.EcompUser;
import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.service.UrlAccessService;
import org.openecomp.portalsdk.core.util.SystemProperties;
import org.springframework.beans.factory.annotation.Autowired;
@@ -72,9 +69,6 @@ public class UserUtils {
getRoleFunctions(request);
- // truncate the role (and therefore the role function) data to save
- // memory in the session
- user.setRoles(null);
session.setAttribute(SystemProperties.getProperty(SystemProperties.USER_NAME), user.getFullName());
session.setAttribute(SystemProperties.FIRST_NAME, user.getFirstName());
session.setAttribute(SystemProperties.LAST_NAME, user.getLastName());
diff --git a/ecomp-sdk/epsdk-fw/pom.xml b/ecomp-sdk/epsdk-fw/pom.xml
index fdaa5fe8..42019604 100644
--- a/ecomp-sdk/epsdk-fw/pom.xml
+++ b/ecomp-sdk/epsdk-fw/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
diff --git a/ecomp-sdk/epsdk-workflow/pom.xml b/ecomp-sdk/epsdk-workflow/pom.xml
index 886668f5..8fe2372b 100644
--- a/ecomp-sdk/epsdk-workflow/pom.xml
+++ b/ecomp-sdk/epsdk-workflow/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
@@ -20,7 +20,7 @@
<dependencies>
<!-- sdk-core -->
<dependency>
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-core</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml
index d252b504..e9e47798 100644
--- a/ecomp-sdk/pom.xml
+++ b/ecomp-sdk/pom.xml
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<!-- ECOMP Portal SDK Maven parent project -->
- <groupId> org.openecomp.ecompsdkos</groupId>
+ <groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
<packaging>pom</packaging>