Class 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.
    • 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 collection
      java.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 in namespace, 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 in namespace, creating indexes which allow equality filtering on the list of fields provided.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockDocumentStore

        public MockDocumentStore()
    • 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.
      • store

        public void store​(java.lang.String namespace,
                          IngestDocument doc,
                          java.util.List<java.lang.String> filterFields,
                          boolean storeContentPointers)
                   throws AttivioException
        Stores the document in namespace, 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 from doc, 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 interface DocumentStoreApi
        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 in namespace, 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 from doc, 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 interface DocumentStoreApi
        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 interface DocumentStoreApi
        Returns:
        an iterable over the matching documents
        Throws:
        AttivioException