X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportalapp%2Fportal%2Fservice%2FEPRoleServiceImpl.java;h=4adf1fdb213a87618a58f67ebc6befa2e6382f88;hb=dd2c6fd1355f93857dc7b5ab23776a1d6543f006;hp=5d38317a06d0d4f47fa6eb851f1613483caa1f3b;hpb=60e54d31cb84aad363897043f810b87ac0ceb5d1;p=portal.git diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java index 5d38317a..4adf1fdb 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPRoleServiceImpl.java @@ -62,6 +62,9 @@ import org.onap.portalsdk.core.service.DataAccessService; public class EPRoleServiceImpl implements EPRoleService { EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPRoleServiceImpl.class); + private static final String GET_APP_ROLE_SQL_FORMAT = + "SELECT * FROM fn_role where APP_ID = %s AND APP_ROLE_ID = %s"; + @Autowired private DataAccessService dataAccessService; @@ -123,10 +126,6 @@ public class EPRoleServiceImpl implements EPRoleService { return (EPRole) getDataAccessService().getDomainObject(EPRole.class, id, null); } - // TODO: refactor - private static final String GET_APP_ROLE_SQL_FORMAT = - "SELECT * FROM fn_role where APP_ID = %s AND APP_ROLE_ID = %s"; - @SuppressWarnings("unchecked") public EPRole getRole(Long appId, Long appRoleid) { if (appId == null || appRoleid == null) { @@ -185,7 +184,7 @@ public class EPRoleServiceImpl implements EPRoleService { if (roles != null) { return roles.get(0); } - } else if (resultsCount == 1) { + } else if (roles!=null && resultsCount == 1) { return roles.get(0); } return null;