Package io.stargate.sdk.doc
Class StargateDocumentRepository<DOC>
java.lang.Object
io.stargate.sdk.doc.StargateDocumentRepository<DOC>
- Type Parameters:
DOC- current document bean.
Super class helping you to work with the document API.
- Author:
- Cedrick LUNVEN (@clunven)
-
Constructor Summary
ConstructorsConstructorDescriptionStargateDocumentRepository(CollectionClient col, Class<DOC> clazz) Default constructor.StargateDocumentRepository(NamespaceClient nc, Class<DOC> clazz) Constructor fromNamespaceClient. -
Method Summary
Modifier and TypeMethodDescriptionlongcount()Count items in the collection.voidDelete a document from its iid.booleanCheck existence of a document from its id.Find a person from ids unique identifier.findAll()Retrieve all documents from the collection.Search document based on a search queryfindPage(PageableQuery query) Search document with attributes.Evaluation on which collection we are working.Create a new document a generating identifier.voidCreate if not exist with defined ID.voidCreate if not exist with defined ID.
-
Constructor Details
-
StargateDocumentRepository
Default constructor.- Parameters:
col- collection client parentclazz- working bean class
-
StargateDocumentRepository
Constructor fromNamespaceClient.- Parameters:
nc- reference to the StargateClientclazz- working namespace identifier
-
-
Method Details
-
count
public long count()Count items in the collection.- Returns:
- number of records.
-
delete
Delete a document from its iid.- Parameters:
docId- document identifier
-
exists
Check existence of a document from its id.- Parameters:
docId- document identifier- Returns:
- existence status
-
insert
Create a new document a generating identifier.- Parameters:
p- working document- Returns:
- an unique identifier for the document
-
insert
Create if not exist with defined ID.- Parameters:
docId- expected document iddoc- document
-
save
Create if not exist with defined ID.- Parameters:
docId- expected document iddoc- document
-
getCollectionName
Evaluation on which collection we are working.- Returns:
- collection identifier
-
find
Find a person from ids unique identifier.- Parameters:
docId- document Id- Returns:
- the object only if present
-
findAll
Retrieve all documents from the collection.- Returns:
- every document of the collection
-
findAll
Search document based on a search query- Parameters:
query- current query- Returns:
- all the element matching
-
findPage
Search document with attributes.- Parameters:
query- current query- Returns:
- result page
-