Class InMemoryDocumentRepository
java.lang.Object
com.irurueta.authserver.resourceserver.infrastructure.memory.InMemoryDocumentRepository
- All Implemented Interfaces:
DocumentRepository
Document store kept in process memory. It starts empty and holds no demo data.
-
Field Summary
Fields -
Constructor Summary
Constructors -
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.
-
Field Details
-
documents
Documents by id.
-
-
Constructor Details
-
InMemoryDocumentRepository
public InMemoryDocumentRepository()
-
-
Method Details
-
findByOwner
Description copied from interface:DocumentRepositoryFinds the documents of one owner.- Specified by:
findByOwnerin interfaceDocumentRepository- Parameters:
owner- subject of the owner.- Returns:
- the documents of the owner, empty when there are none.
-
findById
Description copied from interface:DocumentRepositoryFinds a document by its identifier.- Specified by:
findByIdin interfaceDocumentRepository- Parameters:
id- identifier of the document.- Returns:
- the document, or an empty optional when there is none.
-
findAll
Description copied from interface:DocumentRepositoryFinds every document.- Specified by:
findAllin interfaceDocumentRepository- Returns:
- all documents, empty when there are none.
-
deleteById
Description copied from interface:DocumentRepositoryDeletes a document; does nothing when it does not exist.- Specified by:
deleteByIdin interfaceDocumentRepository- Parameters:
id- identifier of the document.- Returns:
truewhen a document was deleted.
-
save
Description copied from interface:DocumentRepositoryStores a document, replacing any document with the same id.- Specified by:
savein interfaceDocumentRepository- Parameters:
document- document to store.- Returns:
- the stored document.
-