public interface PojoWorkPlan
Works are accumulated when methods such as add(Object) or update(Object, Object) are called,
and executed only when execute() is called.
Relative ordering of works within a work plan will be preserved.
Implementations may not be thread-safe.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Object entity)
Add an entity to the index, assuming that the entity is absent from the index.
|
void |
add(Object providedId,
Object entity)
Add an entity to the index, assuming that the entity is absent from the index.
|
void |
clearNotPrepared()
Discard all works that are not prepared yet.
|
void |
delete(Object entity)
Delete an entity from the index.
|
void |
delete(Object providedId,
Object entity)
Delete an entity from the index.
|
void |
discard()
Discard all works that are prepared but not yet executed.
|
CompletableFuture<?> |
execute()
Start executing all the works in this plan, and clear the plan so that it can be re-used.
|
void |
prepare()
Prepare the work plan execution, i.e.
|
void |
purge(Class<?> clazz,
Object providedId)
Purge an entity from the index.
|
void |
update(Object entity)
Update an entity in the index, or add it if it's absent from the index.
|
void |
update(Object providedId,
Object entity)
Update an entity in the index, or add it if it's absent from the index.
|
void |
update(Object providedId,
Object entity,
String... dirtyPaths)
Update an entity in the index, or add it if it's absent from the index,
but try to avoid reindexing if the given dirty paths
are known not to impact the indexed form of that entity.
|
void |
update(Object entity,
String... dirtyPaths)
Update an entity in the index, or add it if it's absent from the index,
but try to avoid reindexing if the given dirty paths
are known not to impact the indexed form of that entity.
|
void add(Object entity)
Shorthand for add(null, entity); see add(Object, Object).
entity - The entity to add to the index.void add(Object providedId, Object entity)
Note: depending on the backend, this may lead to errors or duplicate entries in the index
if the entity was actually already present in the index before this call.
When in doubt, you should rather use update(Object, Object) or update(Object).
providedId - A value to extract the document ID from.
Generally the expected value is the entity ID, but a different value may be expected depending on the mapping.
If null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to add to the index.void update(Object entity)
Shorthand for update(null, entity); see update(Object, Object).
entity - The entity to update in the index.void update(Object providedId, Object entity)
providedId - A value to extract the document ID from.
Generally the expected value is the entity ID, but a different value may be expected depending on the mapping.
If null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to update in the index.void update(Object entity, String... dirtyPaths)
Assumes that the entity may already be present in the index.
Shorthand for update(null, entity, dirtyPaths); see update(Object, Object).
entity - The entity to update in the index.dirtyPaths - The paths to consider dirty, formatted using the dot-notation
("directEntityProperty.nestedPropery").void update(Object providedId, Object entity, String... dirtyPaths)
providedId - A value to extract the document ID from.
Generally the expected value is the entity ID, but a different value may be expected depending on the mapping.
If null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to update in the index.dirtyPaths - The paths to consider dirty, formatted using the dot-notation
("directEntityProperty.nestedPropery").void delete(Object entity)
Shorthand for delete(null, entity); see delete(Object, Object).
entity - The entity to delete from the index.void delete(Object providedId, Object entity)
No effect on the index if the entity is not in the index.
providedId - A value to extract the document ID from.
Generally the expected value is the entity ID, but a different value may be expected depending on the mapping.
If null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to delete from the index.void purge(Class<?> clazz, Object providedId)
Entities to reindex as a result from this operation will not be resolved.
No effect on the index if the entity is not in the index.
clazz - The type of the entity.providedId - A value to extract the document ID from.
Generally the expected value is the entity ID, but a different value may be expected depending on the mapping.void prepare()
In particular, ensure that all data is extracted from the POJOs and converted to the backend-specific format.
Calling this method is optional: the execute() method
will perform the preparation if necessary.
CompletableFuture<?> execute()
CompletableFuture that will be completed when all the works are complete.void discard()
void clearNotPrepared()
Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.