Interface DocumentRepository
- All Known Implementing Classes:
InMemoryDocumentRepository
public interface DocumentRepository
Port that provides and stores documents. An implementation never returns
null.-
Method Summary
Modifier and TypeMethodDescriptionbooleandeleteById(String id) Deletes a document; does nothing when it does not exist.findAll()Finds every document.Finds a document by its identifier.findByOwner(String owner) Finds the documents of one owner.Stores a document, replacing any document with the same id.
-
Method Details
-
findByOwner
Finds the documents of one owner.- Parameters:
owner- subject of the owner.- Returns:
- the documents of the owner, empty when there are none.
-
findById
Finds a document by its identifier.- Parameters:
id- identifier of the document.- Returns:
- the document, or an empty optional when there is none.
-
findAll
Finds every document.- Returns:
- all documents, empty when there are none.
-
deleteById
Deletes a document; does nothing when it does not exist.- Parameters:
id- identifier of the document.- Returns:
truewhen a document was deleted.
-
save
Stores a document, replacing any document with the same id.- Parameters:
document- document to store.- Returns:
- the stored document.
-