Interface UserGroupAssoRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<UserGroupAsso,UserGroupId>, org.springframework.data.jpa.repository.JpaRepository<UserGroupAsso,UserGroupId>, org.springframework.data.repository.ListCrudRepository<UserGroupAsso,UserGroupId>, org.springframework.data.repository.ListPagingAndSortingRepository<UserGroupAsso,UserGroupId>, org.springframework.data.repository.PagingAndSortingRepository<UserGroupAsso,UserGroupId>, org.springframework.data.repository.query.QueryByExampleExecutor<UserGroupAsso>, org.springframework.data.repository.Repository<UserGroupAsso,UserGroupId>

public interface UserGroupAssoRepository extends org.springframework.data.jpa.repository.JpaRepository<UserGroupAsso,UserGroupId>
Repository interface for the UserGroupAsso association entity
Version:
1.3
Author:
Pedro, Birk, Anders
  • Method Summary

    Modifier and Type
    Method
    Description
    createConnectionAfterCreateGroup(String username, long groupId)
    Creates a new user-group association with the specified user and group IDs and assigns the user as the primary group administrator with ADMIN authority.
    Retrieves a list of UserGroupAsso objects for the specified Group object.
    Finds all UserGroupAsso objects associated with the specified group and user.
    Finds all groups a user is a member of
    Finds the authority level of a user in a group
    Finds primary group for given user
    Finds UserGroupAsso by UserGroupId
    findFirstByUserAndPrimaryGroup(User user, boolean primaryGroup)
    Finds the first UserGroupAsso object associated with the specified user and primary group status.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • createConnectionAfterCreateGroup

      @Query(value="insert into user_group (\'username\', \'group_id\', \'primary_group\',\'group_authority\') values (:username , :groupId , TRUE , \'ADMIN\')", nativeQuery=true) Optional<Group> createConnectionAfterCreateGroup(String username, long groupId)
      Creates a new user-group association with the specified user and group IDs and assigns the user as the primary group administrator with ADMIN authority.
      Parameters:
      username - the username of the user to add to the group
      groupId - the ID of the group to add the user to
      Returns:
      an Optional containing the Group object for the newly created user-group association, or an empty Optional if the operation failed
    • findAllByGroup

      List<UserGroupAsso> findAllByGroup(Group group)
      Retrieves a list of UserGroupAsso objects for the specified Group object.
      Parameters:
      group - the Group object to retrieve information for
      Returns:
      a List of UserGroupAsso objects for the specified Group object
    • findAllByGroupAndUser

      Optional<UserGroupAsso> findAllByGroupAndUser(Group group, User user)
      Finds all UserGroupAsso objects associated with the specified group and user.
      Parameters:
      group - the group for which to find the user-group associations
      user - the user for which to find the user-group associations
      Returns:
      an optional object containing a list of UserGroupAsso objects associated with the specified group and user, or an empty optional if no such user-group associations exist in the database
    • findFirstByUserAndPrimaryGroup

      Optional<UserGroupAsso> findFirstByUserAndPrimaryGroup(User user, boolean primaryGroup)
      Finds the first UserGroupAsso object associated with the specified user and primary group status.
      Parameters:
      user - the user for which to find the user-group association
      primaryGroup - the primary group status for which to find the user-group association
      Returns:
      an optional object containing the first UserGroupAsso object associated with the specified user and primary group status, or an empty optional if no such user-group associations exist in the database
    • findByUserGroupId

      Optional<UserGroupAsso> findByUserGroupId(UserGroupId userGroupId)
      Finds UserGroupAsso by UserGroupId
      Parameters:
      userGroupId - the UserGroupId to find by
      Returns:
      an optional containing the UserGroupAsso if it exists
    • findByUser_UsernameAndPrimaryGroupTrue

      Optional<UserGroupAsso> findByUser_UsernameAndPrimaryGroupTrue(String username)
      Finds primary group for given user
      Parameters:
      username - the username of the user
      Returns:
      an optional containing the UserGroupAsso if it exists
    • findAuthorityByUser_UsernameAndGroup_GroupId

      String findAuthorityByUser_UsernameAndGroup_GroupId(String username, long groupId)
      Finds the authority level of a user in a group
      Parameters:
      username - the username of the user
      groupId - the id of the group
      Returns:
      the authority level of the user in the group
    • findAllByUserUsername

      List<UserGroupAsso> findAllByUserUsername(String username)
      Finds all groups a user is a member of
      Parameters:
      username - the username of the user
      Returns:
      a list of all groups the user is a member of