Interface DocumentRepository


public interface DocumentRepository
Port that provides and stores documents. An implementation never returns null.
  • Method Details

    • findByOwner

      List<Document> findByOwner(String owner)
      Finds the documents of one owner.
      Parameters:
      owner - subject of the owner.
      Returns:
      the documents of the owner, empty when there are none.
    • findById

      Optional<Document> findById(String id)
      Finds a document by its identifier.
      Parameters:
      id - identifier of the document.
      Returns:
      the document, or an empty optional when there is none.
    • findAll

      List<Document> findAll()
      Finds every document.
      Returns:
      all documents, empty when there are none.
    • deleteById

      boolean deleteById(String id)
      Deletes a document; does nothing when it does not exist.
      Parameters:
      id - identifier of the document.
      Returns:
      true when a document was deleted.
    • save

      Document save(Document document)
      Stores a document, replacing any document with the same id.
      Parameters:
      document - document to store.
      Returns:
      the stored document.