package org.onap.portal.service.role;
import java.util.List;
+import java.util.Optional;
+import javax.swing.text.html.Option;
import org.onap.portal.domain.db.fn.FnRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
@Transactional
interface FnRoleDao extends JpaRepository<FnRole, Long> {
- @Query
- List<FnRole> retrieveAppRoleByAppRoleIdAndByAppId(final @Param("appId") Long appId,
- final @Param("appRoleId") Long appRoleId);
+ @Query
+ List<FnRole> retrieveAppRoleByAppRoleIdAndByAppId(final @Param("appId") Long appId,
+ final @Param("appRoleId") Long appRoleId);
- @Query
- List<FnRole> getUserRoleOnUserIdAndAppId(final @Param("userId") Long userId, final @Param("appId") Long appId);
+ @Query
+ List<FnRole> getUserRoleOnUserIdAndAppId(final @Param("userId") Long userId, final @Param("appId") Long appId);
- @Query
- List<FnRole> retrieveAppRoleByRoleIdWhereAppIdIsNull(final @Param("roleId") Long roleId);
+ @Query
+ List<FnRole> retrieveAppRoleByRoleIdWhereAppIdIsNull(final @Param("roleId") Long roleId);
- @Query
- List<FnRole> retrieveAppRolesWhereAppIdIsNull();
+ @Query
+ List<FnRole> retrieveAppRolesWhereAppIdIsNull();
- @Query
- List<FnRole> retrieveAppRolesByAppId(final @Param("appId") Long id);
+ @Query
+ List<FnRole> retrieveAppRolesByAppId(final @Param("appId") Long id);
- @Query
- List<FnRole> retrieveActiveRolesOfApplication(final @Param("appId") Long appId);
+ @Query
+ List<FnRole> retrieveActiveRolesOfApplication(final @Param("appId") Long appId);
- @Query
- List<FnRole> retrieveAppRolesByRoleNameAndByAppId(final @Param("roleName") String roleName, final @Param("appId") Long appId);
+ @Query
+ List<FnRole> retrieveAppRolesByRoleNameAndByAppId(final @Param("roleName") String roleName,
+ final @Param("appId") Long appId);
- @Query
- List<FnRole> getGlobalRolesOfPortal();
+ @Query
+ List<FnRole> getGlobalRolesOfPortal();
- @Query
- FnRole getSysAdminRoleId();
+ @Query
+ FnRole getSysAdminRoleId();
+
+ @Query
+ Optional<List<FnRole>> retrieveAppRolesByRoleNameAndWhereAppIdIsNull(final @Param("roleName") String roleName);
+
+ @Query
+ Optional<List<FnRole>> userAppGlobalRoles(final @Param("userId") long userId, final @Param("appId") long appId);
+
+ @Query
+ Optional<List<FnRole>> retrieveActiveRolesWhereAppIdIsNull();
}