Fixes in SDK AAF JAR 67/47267/1
authorKishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Fri, 11 May 2018 20:08:49 +0000 (16:08 -0400)
committerKishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Fri, 11 May 2018 20:08:49 +0000 (16:08 -0400)
Issue-ID: PORTAL-281

Portal SDK AAF jar throws null pointer exception

Change-Id: Icdbd5a254221994a921fd9b58e8ca6786956273d
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/LoginExternalAuthServiceImpl.java
ecomp-sdk/epsdk-aaf/src/main/java/org/onap/portalsdk/external/authorization/service/UserApiServiceImpl.java
ecomp-sdk/epsdk-app-os/README.md

index d2ccfc2..063c207 100644 (file)
@@ -59,6 +59,7 @@ import org.onap.portalsdk.core.web.support.AppUtils;
 import org.onap.portalsdk.core.web.support.UserUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 @Service("loginExternalAuthService")
 public class LoginExternalAuthServiceImpl implements LoginExternalAuthService {
@@ -79,6 +80,7 @@ public class LoginExternalAuthServiceImpl implements LoginExternalAuthService {
 
        @Override
        @SuppressWarnings("rawtypes")
+       @Transactional
        public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, Map additionalParams,
                        boolean matchPassword, HttpServletRequest request) throws  Exception {
 
index 8425f7d..32a7421 100644 (file)
@@ -71,6 +71,7 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -103,6 +104,7 @@ public class UserApiServiceImpl implements UserApiService {
        private AppService appService;
 
        @Override
+       @Transactional
        public User getUser(String orgUserId, HttpServletRequest request)
                        throws UserNotFoundException {
                User user = null;
@@ -207,28 +209,30 @@ public class UserApiServiceImpl implements UserApiService {
                                                        role.setPriority(Integer.valueOf(roleDesc.getPriority()));
                                                }
                                        }
-                                       for (ExternalAccessPerms extPerm : roleDesc.getPermissions()) {
-                                               RoleFunction roleFunction = new RoleFunction();
-                                               roleFunction.setCode(extPerm.getInstance());
-                                               roleFunction.setAction(extPerm.getAction());
-                                               if (extPerm.getDescription() != null
-                                                               && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
-                                                       roleFunction.setName(extPerm.getDescription());
-                                               } else if (extPerm.getDescription() == null
-                                                               && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
-                                                       roleFunction.setName(extPerm.getType().substring(namespace.length() + 1) + "|"
-                                                                       + extPerm.getInstance() + "|" + extPerm.getAction());
-                                               } else if (extPerm.getDescription() == null
-                                                               && !EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
-                                                       roleFunction.setName(
-                                                                       extPerm.getType() + "|" + extPerm.getInstance() + "|" + extPerm.getAction());
+                                       if (roleDesc.getPermissions() != null) {
+                                               for (ExternalAccessPerms extPerm : roleDesc.getPermissions()) {
+                                                       RoleFunction roleFunction = new RoleFunction();
+                                                       roleFunction.setCode(extPerm.getInstance());
+                                                       roleFunction.setAction(extPerm.getAction());
+                                                       if (extPerm.getDescription() != null
+                                                                       && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
+                                                               roleFunction.setName(extPerm.getDescription());
+                                                       } else if (extPerm.getDescription() == null
+                                                                       && EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
+                                                               roleFunction.setName(extPerm.getType().substring(namespace.length() + 1) + "|"
+                                                                               + extPerm.getInstance() + "|" + extPerm.getAction());
+                                                       } else if (extPerm.getDescription() == null
+                                                                       && !EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
+                                                               roleFunction.setName(
+                                                                               extPerm.getType() + "|" + extPerm.getInstance() + "|" + extPerm.getAction());
+                                                       }
+                                                       if (EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
+                                                               roleFunction.setType(extPerm.getType().substring(namespace.length() + 1));
+                                                       } else {
+                                                               roleFunction.setType(extPerm.getType());
+                                                       }
+                                                       roleFunctions.add(roleFunction);
                                                }
-                                               if (EcompExternalAuthUtils.checkNameSpaceMatching(extPerm.getType(), namespace)) {
-                                                       roleFunction.setType(extPerm.getType().substring(namespace.length() + 1));
-                                               } else {
-                                                       roleFunction.setType(extPerm.getType());
-                                               }
-                                               roleFunctions.add(roleFunction);
                                        }
                                }
                                role.setRoleFunctions(roleFunctions);
index c61ebe6..675919b 100644 (file)
@@ -14,6 +14,7 @@ https://www.eclipse.org/m2e-wtp/
 ## Release Notes
 Version 2.3.0
 - PORTAL 254 ECOMP AAF jar
+- PORTAL-281 Portal SDK AAF jar throws null pointer exception
 
 Version 2.2.0
 - PORTAL 136 Junits for SDK