Interface UserUidDao

All Known Implementing Classes:
MongoUserUidDao

public interface UserUidDao
This is the UserUidDao which is used to manage associated unique user ids. These will represent different methods of authentication and associate them with a singular User object. All user id schemes that begin with 'dev.getelements' are reserved. Created by keithhudnall on 1/29/25.
  • Field Details

  • Method Details

    • getAllUserIdsForUser

      default List<UserUid> getAllUserIdsForUser(User user)
      Gets all user uids for a given user
      Returns:
      the user uid pagination object
    • getAllUserIdsForUser

      List<UserUid> getAllUserIdsForUser(String userId)
      Gets all user uids for a given user
      Returns:
      the user uid pagination object
    • getUserUids

      Pagination<UserUid> getUserUids(int offset, int count, String search)
      Attempts to get a certain number of user uids
      Parameters:
      offset - - the page offset
      count - - total results per page
      search - - search query - valid search properties are scheme, uid, and user id
      Returns:
      the user uid pagination object
    • getUserUid

      UserUid getUserUid(String id, String scheme)
      Gets the user uid with the given name or id
      Parameters:
      id - - the id associated with the scheme
      scheme - - the scheme name
      Returns:
      the user uid object
    • findUserUid

      default Optional<UserUid> findUserUid(String id, String scheme)
      Gets the user uid with the given name or id
      Parameters:
      id - - the id associated with the scheme
      scheme - - the scheme name
      Returns:
      the user uid object
    • createUserUidStrict

      @Deprecated UserUid createUserUidStrict(UserUid userUid)
      Deprecated.
      Attempts to create a new UserUid with the given userUid object. Using "Strict" semantics, if the user exists then this will throw an exception.
      Parameters:
      userUid - - the object to create in the db
      Returns:
      - the resultant userUid with any modifications made as a result of the creation
    • createUserUid

      UserUid createUserUid(UserUid userUid)
      Attempts to create a new UserUid with the given userUid object. Using "Strict" semantics, if the user exists then this will throw an exception.
      Parameters:
      userUid - - the object to create in the db
      Returns:
      - the resultant userUid with any modifications made as a result of the creation
    • deleteUserUid

      default void deleteUserUid(UserUid userUid)
      Deletes a user uid by its UserUid object.
      Parameters:
      userUid - the UserUid object to delete
      Throws:
      UserNotFoundException - if the UserUid with the given scheme and id does not exist
    • deleteUserUid

      default void deleteUserUid(String scheme, String id)
      Deletes a user uid by its scheme and user id.
      Parameters:
      scheme - Corresponds to UserUid.getScheme()
      id - Corresponds to UserUid.getId()
      Throws:
      UserNotFoundException - if the UserUid with the given scheme and id does not exist
    • tryDeleteUserUid

      default boolean tryDeleteUserUid(UserUid userUid)
      Deletes a user uid by its UserUid object.
      Parameters:
      userUid - the UserUid object to delete
      Returns:
      true if the UserUid was found and deleted, false otherwise
    • tryDeleteUserUid

      boolean tryDeleteUserUid(String scheme, String id)
      Deletes a user uid by its scheme and user id.
      Parameters:
      scheme - Corresponds to UserUid.getScheme()
      id - Corresponds to UserUid.getId()
      Returns:
      true if the UserUid was found and deleted, false otherwise
    • softDeleteUser

      default void softDeleteUser(User user)
      Soft deletes the user by removing all ID references to the user in the UserUid records. This does not delete the actual User object, just the references to it in UserUid records. It is STRONGLY RECOMMENDED to use this method from within a transaction to ensure data integrity as it requires multiple operations to complete. Outside of a transaction, there is a substantial risk of partial completion leaving the associated data in an inconsistent state.
      Parameters:
      user - the user to soft delete
    • softDeleteUser

      default void softDeleteUser(String userId)
      Soft deletes the user by removing all ID references to the user in the UserUid records. This does not delete the actual User object, just the references to it in UserUid records. It is STRONGLY RECOMMENDED to use this method from within a transaction to ensure data integrity as it requires multiple operations to complete. Outside of a transaction, there is a substantial risk of partial completion leaving the associated data in an inconsistent state.
      Parameters:
      userId - the user to soft delete
      Throws:
      UserNotFoundException - if the user with the given id does not exist
    • trySoftDeleteUser

      boolean trySoftDeleteUser(String userId)
      Soft deletes the user by removing all ID references to the user in the UserUid records. This does not delete the actual User object, just the references to it in UserUid records. It is STRONGLY RECOMMENDED to use this method from within a transaction to ensure data integrity as it requires multiple operations to complete. Outside of a transaction, there is a substantial risk of partial completion leaving the associated data in an inconsistent state.
      Parameters:
      userId - the user to soft delete
      Returns:
      true if the user was found and soft deleted, false otherwise
    • softDeleteUserUidsForUserId

      default void softDeleteUserUidsForUserId(User user)
      Deprecated.
      This will scrub all scheme ids for all UserUids referencing the user with the given id. It is STRONGLY RECOMMENDED to use this method from within a transaction to ensure data integrity as it requires multiple operations to complete. Outside of a transaction, there is a substantial risk of partial completion leaving the associated data in an inconsistent state.
      Parameters:
      user - - the id of the user to search for