diff options
author | 2017-07-14 14:19:22 -0400 | |
---|---|---|
committer | 2017-07-14 14:29:49 -0400 | |
commit | 3aec9d2ab7f373a12e052d5e2c1c59b2a19770dc (patch) | |
tree | fd13e4b474891a3efa1320524026d7ddad757297 /ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java | |
parent | 30b8e1fd4328ea37fc5599f8a9723ea79ae0e369 (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/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java')
-rw-r--r-- | ecomp-sdk/epsdk-app-common/src/main/java/org/openecomp/portalapp/controller/core/RoleFunctionListController.java | 12 |
1 files changed, 5 insertions, 7 deletions
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); |