java.lang.Object
io.ebeanservice.docstore.api.support.DocStoreBeanBaseAdapter<T>
- All Implemented Interfaces:
BeanDocType<T>,DocStoreBeanAdapter<T>
Base implementation for much of DocStoreBeanAdapter.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final io.ebean.annotation.DocStoreModeBehavior on delete.protected final io.ebeaninternal.server.deploy.BeanDescriptor<T>The associated BeanDescriptor.protected DocStructureNested path properties defining the doc structure for indexing.protected DocumentMappingprotected final List<DocStoreEmbeddedInvalidation>List of embedded paths from other documents that include this document type.protected final StringElasticSearch index name.protected final StringElasticSearch index type.protected final io.ebean.annotation.DocStoreModeBehavior on insert.protected final booleanThe type of index.protected final PathPropertiesprotected final StringIdentifier used in the queue system to identify the index.protected final io.ebeaninternal.api.SpiEbeanServerMap of properties to 'raw' properties.protected io.ebean.annotation.DocStoreModeBehavior on update. -
Constructor Summary
ConstructorsConstructorDescriptionDocStoreBeanBaseAdapter(io.ebeaninternal.server.deploy.BeanDescriptor<T> desc, io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor<T> deploy) -
Method Summary
Modifier and TypeMethodDescriptionvoidApply the document structure to the query so that it fetches the required properties to build the document (typically in JSON form).Create the document mapping.abstract voiddeleteById(Object idValue, DocUpdateContext txn) Process a delete by id of a given document.protected StringReturn the supplied value or default to the bean name lower case.protected DocStructurederivePathProperties(PathProperties pathProps) Return the pathProperties which defines the JSON document to index.protected DocStructuredocStructure(PathProperties pathProps, boolean includeByDefault) protected DocStoreEmbeddedInvalidationembeddedInvalidation(String queueId, String path, Set<String> properties) Return the DsInvalidationListener based on the properties, path.embeddedManyRoot(String path) booleanReturn true if this bean type as embedded invalidate registered.abstract voidindex(Object idValue, T entityBean, DocUpdateContext txn) Process an index event which is effectively an insert or update (or put).Return the index name for this bean type.Return the index type for this bean type.abstract voidinsert(Object idValue, io.ebeaninternal.server.core.PersistRequestBean<T> persistRequest, DocStoreUpdateContext txn) Process an insert persist request.booleanmapped()Return true if this type is mapped for doc storage.io.ebean.annotation.DocStoreModemode(io.ebeaninternal.server.core.PersistRequest.Type persistType, io.ebean.annotation.DocStoreMode txnMode) Determine and return how this persist type will be processed given the transaction mode.protected int[]propertyPositions(Set<String> properties) Return the property names as property index positions.queueId()Return the unique queueId for this bean type.rawProperty(String property) Return an un-analysed property to use instead of the given property.voidregisterInvalidationPath(String queueId, String path, Set<String> properties) Register a doc store invalidation listener for the given bean type, path and properties.voidRegister invalidation paths for embedded documents.abstract voidupdate(Object idValue, io.ebeaninternal.server.core.PersistRequestBean<T> persistRequest, DocStoreUpdateContext txn) Process an update persist request.voidupdateEmbedded(io.ebeaninternal.server.core.PersistRequestBean<T> request, DocStoreUpdates docStoreUpdates) Process the persist request adding any embedded/nested document invalidation to the docStoreUpdates.abstract voidupdateEmbedded(Object idValue, String embeddedProperty, String embeddedRawContent, DocUpdateContext txn) Process an update of an embedded document.
-
Field Details
-
server
-
desc
The associated BeanDescriptor. -
mapped
The type of index. -
queueId
Identifier used in the queue system to identify the index. -
indexType
ElasticSearch index type. -
indexName
ElasticSearch index name. -
insert
Behavior on insert. -
update
Behavior on update. -
delete
Behavior on delete. -
embeddedInvalidation
List of embedded paths from other documents that include this document type. As such an update to this doc type means that those embedded documents need to be updated. -
pathProps
-
sortableMap
Map of properties to 'raw' properties. -
docStructure
Nested path properties defining the doc structure for indexing. -
documentMapping
-
-
Constructor Details
-
DocStoreBeanBaseAdapter
public DocStoreBeanBaseAdapter(io.ebeaninternal.server.deploy.BeanDescriptor<T> desc, io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor<T> deploy)
-
-
Method Details
-
hasEmbeddedInvalidation
Description copied from interface:DocStoreBeanAdapterReturn true if this bean type as embedded invalidate registered.- Specified by:
hasEmbeddedInvalidationin interfaceDocStoreBeanAdapter<T>
-
createDocMapping
Description copied from interface:DocStoreBeanAdapterCreate the document mapping.- Specified by:
createDocMappingin interfaceDocStoreBeanAdapter<T>
-
indexType
Description copied from interface:DocStoreBeanAdapterReturn the index type for this bean type.- Specified by:
indexTypein interfaceBeanDocType<T>- Specified by:
indexTypein interfaceDocStoreBeanAdapter<T>
-
indexName
Description copied from interface:DocStoreBeanAdapterReturn the index name for this bean type.- Specified by:
indexNamein interfaceBeanDocType<T>- Specified by:
indexNamein interfaceDocStoreBeanAdapter<T>
-
applyPath
Description copied from interface:DocStoreBeanAdapterApply the document structure to the query so that it fetches the required properties to build the document (typically in JSON form).- Specified by:
applyPathin interfaceBeanDocType<T>- Specified by:
applyPathin interfaceDocStoreBeanAdapter<T>
-
rawProperty
Description copied from interface:DocStoreBeanAdapterReturn an un-analysed property to use instead of the given property.For analysed properties that we want to sort on we will map the property to an additional 'raw' property that we can use for sorting etc.
- Specified by:
rawPropertyin interfaceBeanDocType<T>- Specified by:
rawPropertyin interfaceDocStoreBeanAdapter<T>
-
registerPaths
Register invalidation paths for embedded documents.- Specified by:
registerPathsin interfaceDocStoreBeanAdapter<T>
-
registerInvalidationPath
Register a doc store invalidation listener for the given bean type, path and properties.- Specified by:
registerInvalidationPathin interfaceDocStoreBeanAdapter<T>
-
embeddedInvalidation
protected DocStoreEmbeddedInvalidation embeddedInvalidation(String queueId, String path, Set<String> properties) Return the DsInvalidationListener based on the properties, path. -
propertyPositions
Return the property names as property index positions. -
updateEmbedded
public void updateEmbedded(io.ebeaninternal.server.core.PersistRequestBean<T> request, DocStoreUpdates docStoreUpdates) Description copied from interface:DocStoreBeanAdapterProcess the persist request adding any embedded/nested document invalidation to the docStoreUpdates.This is expected to check the specific properties to see what other documents they are nested in and register invalidation events based on that.
- Specified by:
updateEmbeddedin interfaceDocStoreBeanAdapter<T>- Parameters:
request- The persist requestdocStoreUpdates- Invalidation events are registered to this docStoreUpdates
-
derivePathProperties
Return the pathProperties which defines the JSON document to index. This can add derived/embedded/nested parts to the document. -
docStructure
-
embedded
- Specified by:
embeddedin interfaceBeanDocType<T>
-
embeddedManyRoot
- Specified by:
embeddedManyRootin interfaceBeanDocType<T>
-
mapped
Description copied from interface:DocStoreBeanAdapterReturn true if this type is mapped for doc storage.- Specified by:
mappedin interfaceDocStoreBeanAdapter<T>
-
queueId
Description copied from interface:DocStoreBeanAdapterReturn the unique queueId for this bean type. This is expected to be a relatively short unique string (rather than a fully qualified class name).- Specified by:
queueIdin interfaceDocStoreBeanAdapter<T>
-
mode
public io.ebean.annotation.DocStoreMode mode(io.ebeaninternal.server.core.PersistRequest.Type persistType, io.ebean.annotation.DocStoreMode txnMode) Description copied from interface:DocStoreBeanAdapterDetermine and return how this persist type will be processed given the transaction mode.Some transactions (like bulk updates) might specifically turn off indexing for example.
- Specified by:
modein interfaceDocStoreBeanAdapter<T>
-
derive
Return the supplied value or default to the bean name lower case. -
deleteById
Description copied from interface:DocStoreBeanAdapterProcess a delete by id of a given document.- Specified by:
deleteByIdin interfaceBeanDocType<T>- Specified by:
deleteByIdin interfaceDocStoreBeanAdapter<T>- Throws:
IOException
-
index
Description copied from interface:DocStoreBeanAdapterProcess an index event which is effectively an insert or update (or put).- Specified by:
indexin interfaceBeanDocType<T>- Specified by:
indexin interfaceDocStoreBeanAdapter<T>- Throws:
IOException
-
insert
public abstract void insert(Object idValue, io.ebeaninternal.server.core.PersistRequestBean<T> persistRequest, DocStoreUpdateContext txn) throws IOException Description copied from interface:DocStoreBeanAdapterProcess an insert persist request.- Specified by:
insertin interfaceDocStoreBeanAdapter<T>- Throws:
IOException
-
update
public abstract void update(Object idValue, io.ebeaninternal.server.core.PersistRequestBean<T> persistRequest, DocStoreUpdateContext txn) throws IOException Description copied from interface:DocStoreBeanAdapterProcess an update persist request.- Specified by:
updatein interfaceDocStoreBeanAdapter<T>- Throws:
IOException
-
updateEmbedded
public abstract void updateEmbedded(Object idValue, String embeddedProperty, String embeddedRawContent, DocUpdateContext txn) throws IOException Description copied from interface:DocStoreBeanAdapterProcess an update of an embedded document.- Specified by:
updateEmbeddedin interfaceBeanDocType<T>- Specified by:
updateEmbeddedin interfaceDocStoreBeanAdapter<T>- Parameters:
idValue- the id of the bean effected by an embedded document updateembeddedProperty- the path of the propertyembeddedRawContent- the embedded content for this property in JSON formtxn- the doc store transaction to use to process the update- Throws:
IOException
-