Package com.cloudimpl.outstack.runtime
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 Summary
Fields Modifier and Type Field Description protected java.util.Optional<CRUDOperations>crudOperationsprotected EntityMetaDetailentityMetaprotected java.util.Optional<EntityProvider<? extends RootEntity>>entitySupplierprotected java.lang.Class<T>entityTypeprotected java.util.Optional<java.util.function.Consumer<Event>>eventPublisherprotected java.util.function.Supplier<java.lang.String>idGeneratorprotected QueryOperations<?>queryOperationprotected java.util.function.Function<java.lang.Class<? extends RootEntity>,QueryOperations<?>>queryOperationSelectorprotected ITransactiontxprotected java.util.function.Consumer<java.lang.Object>validatorprotected java.lang.Stringversion -
Constructor Summary
Constructors Constructor Description 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 Summary
Modifier and Type Method Description protected voidaddEvent(Event<T> event)abstract <R extends RootEntity>
AsyncEntityContext<R>asAsyncEntityContext()abstract <R extends RootEntity, K extends ChildEntity<R>>
ChildEntityContext<R,K>asChildContext()abstract <R extends RootEntity>
RootEntityContext<R>asRootContext()<R extends RootEntity>
UnboundedEntityContext<R>asUnboundedEntityContext()abstract Tcreate(java.lang.String id, Event<T> event)abstract Tdelete(java.lang.String id)protected CRUDOperationsgetCrudOperations()protected EntityMetaDetailgetEntityMeta()protected <R extends RootEntity>
EntityProvider<R>getEntityProvider()<R extends RootEntity>
ExternalEntityQueryProvider<R>getEntityQueryProvider(java.lang.Class<R> rootType)<R extends RootEntity>
ExternalEntityQueryProvider<R>getEntityQueryProvider(java.lang.Class<R> rootType, java.lang.String tenantId)<R extends RootEntity>
ExternalEntityQueryProvider<R>getEntityQueryProviderFromTenantList(java.lang.Class<R> rootType, java.util.Collection<java.lang.String> tenantId)java.util.function.Consumer<Event>getEventPublisher()java.util.List<Event>getEvents()protected <R extends RootEntity>
QueryOperations<R>getQueryOperations()java.lang.StringgetTenantId()ITransactiongetTx()protected java.lang.StringgetVersion()abstract Trename(java.lang.String id, java.lang.String newId)<X extends EntityContext>
XsetTx(ITransaction tx)abstract Tupdate(java.lang.String id, Event<T> event)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
entityType
-
entitySupplier
-
idGenerator
protected final java.util.function.Supplier<java.lang.String> idGenerator -
crudOperations
-
queryOperation
-
eventPublisher
-
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
-
-
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
-
getVersion
protected java.lang.String getVersion() -
getEntityProvider
-
getQueryOperations
-
setTx
-
getEventPublisher
-
getTenantId
public java.lang.String getTenantId() -
getEvents
-
getCrudOperations
-
addEvent
-
getEntityMeta
-
create
-
update
-
delete
-
rename
-
asRootContext
-
asAsyncEntityContext
-
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)
-