Interface VaultDao

All Known Implementing Classes:
MongoVaultDao

public interface VaultDao
Manages instance of the Vault.
  • Method Details

    • getVaults

      Pagination<Vault> getVaults(int offset, int count, String userId)
      Gets all vaults in the system.
      Parameters:
      offset - the offset
      count - the count
      userId - the user ID, or null
      Returns:
      a Pagination<Vault>
    • findVault

      Optional<Vault> findVault(String vaultId)
      Finds a Vault.
      Parameters:
      vaultId - the Vault id
      Returns:
      an Optional Vault
    • getVault

      default Vault getVault(String vaultId)
      Gets a Vault the vault.
      Parameters:
      vaultId - the vault ID
      Returns:
      the vault, never null
    • findVaultForUser

      Optional<Vault> findVaultForUser(String vaultId, String userId)
      Finds a Vault with the supplied id and user id.
      Parameters:
      vaultId - the vault ID
      userId - the user ID
      Returns:
      the vault ID
    • getVaultForUser

      default Vault getVaultForUser(String vaultId, String userId)
      Gets the the vault ID.
      Parameters:
      vaultId - the vault ID
      userId - the user ID
      Returns:
      the vault, never null.
    • createVault

      Vault createVault(Vault vault)
      Creates a new Vault.
      Parameters:
      vault - the vault
      Returns:
      the Vault as was written to the database
    • updateVault

      Vault updateVault(Vault vault)
      Updates the Vault.
      Parameters:
      vault - the vault
      Returns:
      the Vault as was written to the database
    • findAndUpdateVaultBelongingToUser

      Optional<Vault> findAndUpdateVaultBelongingToUser(Vault vault, String userId)
      Updates a vault with the provided user. If the requested vault exists for the supplied user, then the specifed vault will be updated.

      If no vault exists for the supplied user, then no changes will be made to the database and the returned Optional will be empty.

      Parameters:
      vault - the vault to update
      userId - the user ID to search
      Returns:
      an Optional<Vault>
    • deleteVault

      void deleteVault(String vaultId)
      Deletes a Vault with the supplied identifier.
      Parameters:
      vaultId - the Vault ID
    • deleteVaultForUser

      void deleteVaultForUser(String vaultId, String userId)
      Deletes the Vault for the supplied urse
      Parameters:
      vaultId - the vauld ID
      userId - the user ID