Class EntityContext<T extends Entity>

java.lang.Object
com.cloudimpl.outstack.runtime.EntityContext<T>
Type Parameters:
T -
All Implemented Interfaces:
Context
Direct Known Subclasses:
ChildEntityContext, RootEntityContext, UnboundedEntityContext

public abstract class EntityContext<T extends Entity>
extends java.lang.Object
implements Context
Author:
nuwansa
  • Field Details

    • entityType

      protected final java.lang.Class<T extends Entity> entityType
    • entitySupplier

      protected final java.util.Optional<EntityProvider<? extends RootEntity>> entitySupplier
    • idGenerator

      protected final java.util.function.Supplier<java.lang.String> idGenerator
    • crudOperations

      protected final java.util.Optional<CRUDOperations> crudOperations
    • queryOperation

      protected final QueryOperations<?> queryOperation
    • eventPublisher

      protected final java.util.Optional<java.util.function.Consumer<Event>> eventPublisher
    • tx

      protected ITransaction tx
    • validator

      protected final java.util.function.Consumer<java.lang.Object> validator
    • queryOperationSelector

      protected final java.util.function.Function<java.lang.Class<? extends RootEntity>,​QueryOperations<?>> queryOperationSelector
    • version

      protected final java.lang.String version
    • entityMeta

      protected EntityMetaDetail entityMeta
  • Constructor Details

    • EntityContext

      public EntityContext​(java.lang.Class<T> entityType, java.lang.String tenantId, java.util.Optional<EntityProvider<? extends RootEntity>> entitySupplier, java.util.function.Supplier<java.lang.String> idGenerator, java.util.Optional<CRUDOperations> crudOperations, QueryOperations<?> queryOperation, java.util.Optional<java.util.function.Consumer<Event>> eventPublisher, java.util.function.Consumer<java.lang.Object> validator, java.util.function.Function<java.lang.Class<? extends RootEntity>,​QueryOperations<?>> queryOperationSelector, java.lang.String version)
  • Method Details

    • getTx

      public ITransaction getTx()
    • getVersion

      protected java.lang.String getVersion()
    • getEntityProvider

      protected <R extends RootEntity> EntityProvider<R> getEntityProvider()
    • getQueryOperations

      protected <R extends RootEntity> QueryOperations<R> getQueryOperations()
    • setTx

      public <X extends EntityContext> X setTx​(ITransaction tx)
    • getEventPublisher

      public java.util.function.Consumer<Event> getEventPublisher()
    • getTenantId

      public java.lang.String getTenantId()
    • getEvents

      public java.util.List<Event> getEvents()
    • getCrudOperations

      protected CRUDOperations getCrudOperations()
    • addEvent

      protected void addEvent​(Event<T> event)
    • getEntityMeta

      protected EntityMetaDetail getEntityMeta()
    • create

      public abstract T create​(java.lang.String id, Event<T> event)
    • update

      public abstract T update​(java.lang.String id, Event<T> event)
    • delete

      public abstract T delete​(java.lang.String id)
    • rename

      public abstract T rename​(java.lang.String id, java.lang.String newId)
    • asRootContext

      public abstract <R extends RootEntity> RootEntityContext<R> asRootContext()
    • asAsyncEntityContext

      public abstract <R extends RootEntity> AsyncEntityContext<R> asAsyncEntityContext()
    • asUnboundedEntityContext

      public <R extends RootEntity> UnboundedEntityContext<R> asUnboundedEntityContext()
    • asChildContext

      public abstract <R extends RootEntity,​ K extends ChildEntity<R>> ChildEntityContext<R,​K> asChildContext()
    • getEntityQueryProvider

      public <R extends RootEntity> ExternalEntityQueryProvider<R> getEntityQueryProvider​(java.lang.Class<R> rootType)
    • getEntityQueryProviderFromTenantList

      public <R extends RootEntity> ExternalEntityQueryProvider<R> getEntityQueryProviderFromTenantList​(java.lang.Class<R> rootType, java.util.Collection<java.lang.String> tenantId)
    • getEntityQueryProvider

      public <R extends RootEntity> ExternalEntityQueryProvider<R> getEntityQueryProvider​(java.lang.Class<R> rootType, java.lang.String tenantId)