Interface MapStorage<V extends AbstractEntity,​M>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      V create​(V value)
      Instructs this storage to add a new value into the underlying store on commit in the context of the current transaction.
      boolean delete​(String key)
      Instructs this storage to delete a value associated with the identifier key from the underlying store upon commit.
      long delete​(QueryParameters<M> queryParameters)
      Instructs this transaction to remove values (identified by mcb filter) from the underlying store upon commit.
      default boolean exists​(String key)
      Returns true if the object with the given key exists in the underlying storage with respect to changes done in the current transaction.
      default boolean exists​(QueryParameters<M> queryParameters)
      Returns true if at least one object is satisfying given criteria from the underlying storage with respect to changes done in the current transaction.
      long getCount​(QueryParameters<M> queryParameters)
      Returns a number of values present in the underlying storage that fulfill the given criteria with respect to changes done in the current transaction.
      V read​(String key)
      Provides possibility to lookup for values by a key in the underlying store with respect to changes done in current transaction.
      Stream<V> read​(QueryParameters<M> queryParameters)
      Returns a stream of values from underlying storage that are updated based on the current transaction changes; i.e.
    • Method Detail

      • create

        V create​(V value)
        Instructs this storage to add a new value into the underlying store on commit in the context of the current transaction.

        Updates to the returned instances of V would be visible in the current transaction and will propagate into the underlying store upon commit. The ID of the entity passed in the parameter might change to a different value in the returned value if the underlying storage decided this was necessary. If the ID of the entity was null before, it will be set on the returned value.

        Parameters:
        value - the value
        Returns:
        Entity representing the value in the store. It may or may not be the same instance as value.
      • read

        V read​(String key)
        Provides possibility to lookup for values by a key in the underlying store with respect to changes done in current transaction. Updates to the returned instance would be visible in the current transaction and will propagate into the underlying store upon commit. If V implements ExpirableEntity this method should not return entities that are expired. See ExpirableEntity JavaDoc for more details.
        Parameters:
        key - identifier of a value
        Returns:
        a value associated with the given key
      • read

        Stream<V> read​(QueryParameters<M> queryParameters)
        Returns a stream of values from underlying storage that are updated based on the current transaction changes; i.e. the result contains updates and excludes of records that have been created, updated or deleted in this transaction by respective methods of this interface.

        Updates to the returned instances of V would be visible in the current transaction and will propagate into the underlying store upon commit. If V implements ExpirableEntity this method should not return entities that are expired. See ExpirableEntity JavaDoc for more details.

        Parameters:
        queryParameters - parameters for the query like firstResult, maxResult, requested ordering, etc.
        Returns:
        values that fulfill the given criteria, that are updated based on changes in the current transaction
      • getCount

        long getCount​(QueryParameters<M> queryParameters)
        Returns a number of values present in the underlying storage that fulfill the given criteria with respect to changes done in the current transaction.
        Parameters:
        queryParameters - parameters for the query like firstResult, maxResult, requested ordering, etc.
        Returns:
        number of values present in the storage that fulfill the given criteria
      • delete

        boolean delete​(String key)
        Instructs this storage to delete a value associated with the identifier key from the underlying store upon commit.
        Parameters:
        key - identifier of a value
        Returns:
        Returns true if the object has been deleted or result cannot be determined, false otherwise.
      • delete

        long delete​(QueryParameters<M> queryParameters)
        Instructs this transaction to remove values (identified by mcb filter) from the underlying store upon commit.
        Parameters:
        queryParameters - parameters for the query like firstResult, maxResult, requested ordering, etc.
        Returns:
        number of removed objects (might return -1 if not supported)
      • exists

        default boolean exists​(String key)
        Returns true if the object with the given key exists in the underlying storage with respect to changes done in the current transaction. false otherwise.
        Parameters:
        key - Key of the object. Must not be null.
        Returns:
        See description
        Throws:
        NullPointerException - if the key is null
      • exists

        default boolean exists​(QueryParameters<M> queryParameters)
        Returns true if at least one object is satisfying given criteria from the underlying storage with respect to changes done in the current transaction. false otherwise. The criteria are specified in the given criteria builder based on model properties.
        Parameters:
        queryParameters - parameters for the query
        Returns:
        See description