Class DocStoreBeanBaseAdapter<T>
- java.lang.Object
-
- io.ebeanservice.docstore.api.support.DocStoreBeanBaseAdapter<T>
-
- All Implemented Interfaces:
BeanDocType<T>
,DocStoreBeanAdapter<T>
- Direct Known Subclasses:
NoneDocStoreBeanAdapter
public abstract class DocStoreBeanBaseAdapter<T> extends Object implements DocStoreBeanAdapter<T>
Base implementation for much of DocStoreBeanAdapter.
-
-
Constructor Summary
Constructors Constructor Description DocStoreBeanBaseAdapter(io.ebeaninternal.server.deploy.BeanDescriptor<T> desc, io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor<T> deploy)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
applyPath(Query<T> query)
Apply the document structure to the query so that it fetches the required properties to build the document (typically in JSON form).DocumentMapping
createDocMapping()
Create the document mapping.abstract void
deleteById(Object idValue, DocStoreUpdateContext txn)
Process a delete by id of a given document.FetchPath
getEmbedded(String path)
Return the FetchPath for the embedded document.FetchPath
getEmbeddedManyRoot(String path)
For embedded 'many' properties we need a FetchPath relative to the root which is used to build and replace the embedded list.String
getIndexName()
Return the index name for this bean type.String
getIndexType()
Return the index type for this bean type.io.ebean.annotation.DocStoreMode
getMode(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.String
getQueueId()
Return the unique queueId for this bean type.boolean
hasEmbeddedInvalidation()
Return true if this bean type as embedded invalidate registered.abstract void
index(Object idValue, T entityBean, DocStoreUpdateContext txn)
Process an index event which is effectively an insert or update (or put).abstract void
insert(Object idValue, io.ebeaninternal.server.core.PersistRequestBean<T> persistRequest, DocStoreUpdateContext txn)
Process an insert persist request.boolean
isMapped()
Return true if this type is mapped for doc storage.String
rawProperty(String property)
Return an un-analysed property to use instead of the given property.void
registerInvalidationPath(String queueId, String path, Set<String> properties)
Register a doc store invalidation listener for the given bean type, path and properties.void
registerPaths()
Register invalidation paths for embedded documents.abstract void
update(Object idValue, io.ebeaninternal.server.core.PersistRequestBean<T> persistRequest, DocStoreUpdateContext txn)
Process an update persist request.void
updateEmbedded(io.ebeaninternal.server.core.PersistRequestBean<T> request, DocStoreUpdates docStoreUpdates)
Process the persist request adding any embedded/nested document invalidation to the docStoreUpdates.abstract void
updateEmbedded(Object idValue, String embeddedProperty, String embeddedRawContent, DocStoreUpdateContext txn)
Process an update of an embedded document.
-
-
-
Constructor Detail
-
DocStoreBeanBaseAdapter
public DocStoreBeanBaseAdapter(io.ebeaninternal.server.deploy.BeanDescriptor<T> desc, io.ebeaninternal.server.deploy.meta.DeployBeanDescriptor<T> deploy)
-
-
Method Detail
-
hasEmbeddedInvalidation
public boolean hasEmbeddedInvalidation()
Description copied from interface:DocStoreBeanAdapter
Return true if this bean type as embedded invalidate registered.- Specified by:
hasEmbeddedInvalidation
in interfaceDocStoreBeanAdapter<T>
-
createDocMapping
public DocumentMapping createDocMapping()
Description copied from interface:DocStoreBeanAdapter
Create the document mapping.- Specified by:
createDocMapping
in interfaceDocStoreBeanAdapter<T>
-
getIndexType
public String getIndexType()
Description copied from interface:DocStoreBeanAdapter
Return the index type for this bean type.- Specified by:
getIndexType
in interfaceBeanDocType<T>
- Specified by:
getIndexType
in interfaceDocStoreBeanAdapter<T>
-
getIndexName
public String getIndexName()
Description copied from interface:DocStoreBeanAdapter
Return the index name for this bean type.- Specified by:
getIndexName
in interfaceBeanDocType<T>
- Specified by:
getIndexName
in interfaceDocStoreBeanAdapter<T>
-
applyPath
public void applyPath(Query<T> query)
Description copied from interface:DocStoreBeanAdapter
Apply the document structure to the query so that it fetches the required properties to build the document (typically in JSON form).- Specified by:
applyPath
in interfaceBeanDocType<T>
- Specified by:
applyPath
in interfaceDocStoreBeanAdapter<T>
-
rawProperty
public String rawProperty(String property)
Description copied from interface:DocStoreBeanAdapter
Return 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:
rawProperty
in interfaceBeanDocType<T>
- Specified by:
rawProperty
in interfaceDocStoreBeanAdapter<T>
-
registerPaths
public void registerPaths()
Register invalidation paths for embedded documents.- Specified by:
registerPaths
in interfaceDocStoreBeanAdapter<T>
-
registerInvalidationPath
public void registerInvalidationPath(String queueId, String path, Set<String> properties)
Register a doc store invalidation listener for the given bean type, path and properties.- Specified by:
registerInvalidationPath
in interfaceDocStoreBeanAdapter<T>
-
updateEmbedded
public void updateEmbedded(io.ebeaninternal.server.core.PersistRequestBean<T> request, DocStoreUpdates docStoreUpdates)
Description copied from interface:DocStoreBeanAdapter
Process 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:
updateEmbedded
in interfaceDocStoreBeanAdapter<T>
- Parameters:
request
- The persist requestdocStoreUpdates
- Invalidation events are registered to this docStoreUpdates
-
getEmbedded
public FetchPath getEmbedded(String path)
Description copied from interface:BeanDocType
Return the FetchPath for the embedded document.- Specified by:
getEmbedded
in interfaceBeanDocType<T>
-
getEmbeddedManyRoot
public FetchPath getEmbeddedManyRoot(String path)
Description copied from interface:BeanDocType
For embedded 'many' properties we need a FetchPath relative to the root which is used to build and replace the embedded list.- Specified by:
getEmbeddedManyRoot
in interfaceBeanDocType<T>
-
isMapped
public boolean isMapped()
Description copied from interface:DocStoreBeanAdapter
Return true if this type is mapped for doc storage.- Specified by:
isMapped
in interfaceDocStoreBeanAdapter<T>
-
getQueueId
public String getQueueId()
Description copied from interface:DocStoreBeanAdapter
Return 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:
getQueueId
in interfaceDocStoreBeanAdapter<T>
-
getMode
public io.ebean.annotation.DocStoreMode getMode(io.ebeaninternal.server.core.PersistRequest.Type persistType, io.ebean.annotation.DocStoreMode txnMode)
Description copied from interface:DocStoreBeanAdapter
Determine 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:
getMode
in interfaceDocStoreBeanAdapter<T>
-
deleteById
public abstract void deleteById(Object idValue, DocStoreUpdateContext txn) throws IOException
Description copied from interface:DocStoreBeanAdapter
Process a delete by id of a given document.- Specified by:
deleteById
in interfaceBeanDocType<T>
- Specified by:
deleteById
in interfaceDocStoreBeanAdapter<T>
- Throws:
IOException
-
index
public abstract void index(Object idValue, T entityBean, DocStoreUpdateContext txn) throws IOException
Description copied from interface:DocStoreBeanAdapter
Process an index event which is effectively an insert or update (or put).- Specified by:
index
in interfaceBeanDocType<T>
- Specified by:
index
in 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:DocStoreBeanAdapter
Process an insert persist request.- Specified by:
insert
in 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:DocStoreBeanAdapter
Process an update persist request.- Specified by:
update
in interfaceDocStoreBeanAdapter<T>
- Throws:
IOException
-
updateEmbedded
public abstract void updateEmbedded(Object idValue, String embeddedProperty, String embeddedRawContent, DocStoreUpdateContext txn) throws IOException
Description copied from interface:DocStoreBeanAdapter
Process an update of an embedded document.- Specified by:
updateEmbedded
in interfaceBeanDocType<T>
- Specified by:
updateEmbedded
in 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
-
-