Package com.attivio.sdk.service
Class MockDocumentStore
- java.lang.Object
-
- com.attivio.sdk.service.MockDocumentStore
-
- All Implemented Interfaces:
DocumentStoreApi
public class MockDocumentStore extends java.lang.Object implements DocumentStoreApi
Mock implementation of a document store. Does not do anything to content pointers, holds references to stored documents.
-
-
Field Summary
-
Fields inherited from interface com.attivio.sdk.client.DocumentStoreApi
CONTENT_STORE_NAMESPACE_PREFIX, DEFAULT_FILTER_FIELDS
-
-
Constructor Summary
Constructors Constructor Description MockDocumentStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(java.lang.String collection, java.lang.String docId)
Deletes the document from the specified collectionjava.lang.Iterable<IngestDocument>
filteredRetrieve(java.lang.String collection, java.util.Map<java.lang.String,java.lang.String> filterVals)
Finds and returns the documents matching the provided equality filters.java.util.List<java.lang.String>
getCollectionNames()
Get the name of all collections.int
getCollectionSize(java.lang.String collection)
Get the number of documents in a collection.IngestDocument
retrieve(java.lang.String collection, java.lang.String docId)
void
store(java.lang.String namespace, IngestDocument doc, java.util.List<java.lang.String> filterFields, boolean storeContentPointers)
Stores the document innamespace
, creating indexes which allow equality filtering on the list of fields provided.IngestDocument
storeAndUpdate(java.lang.String namespace, IngestDocument doc, java.util.List<java.lang.String> filterFields, boolean storeContentPointers)
Stores the document innamespace
, creating indexes which allow equality filtering on the list of fields provided.
-
-
-
Method Detail
-
getCollectionNames
public java.util.List<java.lang.String> getCollectionNames()
Get the name of all collections.
-
getCollectionSize
public int getCollectionSize(java.lang.String collection)
Get the number of documents in a collection.
-
delete
public void delete(java.lang.String collection, java.lang.String docId) throws AttivioException
Deletes the document from the specified collection- Specified by:
delete
in interfaceDocumentStoreApi
- Throws:
AttivioException
-
retrieve
public IngestDocument retrieve(java.lang.String collection, java.lang.String docId) throws AttivioException
- Specified by:
retrieve
in interfaceDocumentStoreApi
- Returns:
- the store document or null if it does not exist in the collection
- Throws:
AttivioException
-
store
public void store(java.lang.String namespace, IngestDocument doc, java.util.List<java.lang.String> filterFields, boolean storeContentPointers) throws AttivioException
Stores the document innamespace
, creating indexes which allow equality filtering on the list of fields provided. Only the first value any multi-valued fields is available for filtering. The document may be temporarily altered during invocation. If the document mode is set to PARTIAL, the document will first be retrieved, updated with any fields fromdoc
, then stored. If the document mode is set to ADD, any existing version of the document will be replaced.The input document is always unmodified upon return.
- Specified by:
store
in interfaceDocumentStoreApi
storeContentPointers
- if false, content associated with content pointers will not be stored and upon retrieval the content may no longer be present.- Throws:
AttivioException
-
storeAndUpdate
public IngestDocument storeAndUpdate(java.lang.String namespace, IngestDocument doc, java.util.List<java.lang.String> filterFields, boolean storeContentPointers) throws AttivioException
Stores the document innamespace
, creating indexes which allow equality filtering on the list of fields provided. Only the first value any multi-valued fields is available for filtering. The document may be temporarily altered during invocation. If the document mode is set to PARTIAL, the document will first be retrieved, updated with any fields fromdoc
, then stored. It will then be modified and returned (to support remote API calls). The returned document will always have its document mode set to ADD if it had been PARTIAL, regardless of whether or not it had ever been stored.If the document mode is set to ADD, any existing version of the document will be replaced and the returned document will be the original document.
- Specified by:
storeAndUpdate
in interfaceDocumentStoreApi
storeContentPointers
- if false, content associated with content pointers will not be stored and upon retrieval the content may not be present.- Returns:
- the updated document or original if mode was not PARTIAL
- Throws:
AttivioException
-
filteredRetrieve
public java.lang.Iterable<IngestDocument> filteredRetrieve(java.lang.String collection, java.util.Map<java.lang.String,java.lang.String> filterVals) throws AttivioException
Finds and returns the documents matching the provided equality filters. These filters must have been established during storage of documents in the collection.- Specified by:
filteredRetrieve
in interfaceDocumentStoreApi
- Returns:
- an iterable over the matching documents
- Throws:
AttivioException
-
-