Class AbstractDataStore

java.lang.Object
io.jmix.core.datastore.AbstractDataStore
All Implemented Interfaces:
DataStore
Direct Known Subclasses:
JpaDataStore

public abstract class AbstractDataStore extends Object implements DataStore
  • Field Details

  • Constructor Details

    • AbstractDataStore

      public AbstractDataStore()
  • Method Details

    • setMetadata

      @Autowired public void setMetadata(Metadata metadata)
    • setMetadataTools

      @Autowired public void setMetadataTools(MetadataTools metadataTools)
    • setEntityStates

      @Autowired public void setEntityStates(EntityStates entityStates)
    • setKeyValueMapper

      @Autowired public void setKeyValueMapper(KeyValueMapper keyValueMapper)
    • load

      @Nullable public Object load(LoadContext<?> context)
      Description copied from interface: DataStore
      Loads a single entity instance.
      Specified by:
      load in interface DataStore
      Returns:
      the loaded object, or null if not found
    • loadList

      public List<Object> loadList(LoadContext<?> context)
      Description copied from interface: DataStore
      Loads collection of entity instances.
      Specified by:
      loadList in interface DataStore
      Returns:
      a list of instances, or empty list if nothing found
    • getCount

      public long getCount(LoadContext<?> context)
      Description copied from interface: DataStore
      Returns the number of entity instances for the given query passed in the LoadContext.
      Specified by:
      getCount in interface DataStore
      Returns:
      number of instances in the storage
    • save

      public Set<?> save(SaveContext context)
      Description copied from interface: DataStore
      Saves a collection of entity instances.
      Specified by:
      save in interface DataStore
      Returns:
      set of saved instances
    • loadValues

      public List<KeyValueEntity> loadValues(ValueLoadContext context)
      Description copied from interface: DataStore
      Loads list of key-value pairs.
      Specified by:
      loadValues in interface DataStore
      Parameters:
      context - defines a query for scalar values and a list of keys for returned KeyValueEntity
      Returns:
      list of KeyValueEntity instances
    • getCount

      public long getCount(ValueLoadContext context)
      Description copied from interface: DataStore
      Returns the number of key-value pairs for the given query passed in the ValueLoadContext.
      Specified by:
      getCount in interface DataStore
      Parameters:
      context - defines the query
      Returns:
      number of key-value pairs in the data store
    • loadOne

      @Nullable protected abstract Object loadOne(LoadContext<?> context)
    • loadAll

      protected abstract List<Object> loadAll(LoadContext<?> context)
    • countAll

      protected abstract long countAll(LoadContext<?> context)
    • saveAll

      protected abstract Set<Object> saveAll(SaveContext context)
    • deleteAll

      protected abstract Set<Object> deleteAll(SaveContext context)
    • loadAllValues

      protected abstract List<Object> loadAllValues(ValueLoadContext context)
    • countAllValues

      protected abstract long countAllValues(ValueLoadContext context)
    • beginLoadTransaction

      protected abstract Object beginLoadTransaction(boolean joinTransaction)
    • beginSaveTransaction

      protected abstract Object beginSaveTransaction(boolean joinTransaction)
    • commitTransaction

      protected abstract void commitTransaction(Object transaction)
    • rollbackTransaction

      protected abstract void rollbackTransaction(Object transaction)
    • beforeLoadTransactionCommit

      protected void beforeLoadTransactionCommit(LoadContext<?> context, Collection<Object> entities)
    • beforeSaveTransactionCommit

      protected void beforeSaveTransactionCommit(SaveContext context, Collection<Object> savedEntities, Collection<Object> removedEntities)
    • beforeSaveTransactionRollback

      protected void beforeSaveTransactionRollback(SaveContext context)
    • registerInterceptor

      public void registerInterceptor(DataStoreEventListener listener)
    • fireEvent

      protected <T extends BaseDataStoreEvent> void fireEvent(T event)
    • loadListByBatches

      protected List<Object> loadListByBatches(LoadContext<?> context, int actualSize, EventSharedState eventState)
    • checkAndReorderLoadedEntities

      protected List<Object> checkAndReorderLoadedEntities(LoadContext<?> context, List<Object> entities)
    • loadAllAfterSave

      protected Set<Object> loadAllAfterSave(SaveContext context, Set<Object> savedEntities)
    • getFetchPlanForSave

      protected FetchPlan getFetchPlanForSave(Map<Object,FetchPlan> fetchPlans, Object entity)
    • copyNonPersistentAttributes

      protected void copyNonPersistentAttributes(Object source, Object destination)