Class IndexingCommand
java.lang.Object
org.nuxeo.ecm.core.search.index.commands.IndexingCommand
- All Implemented Interfaces:
Serializable
Holds information about what type of indexing operation must be processed. IndexingCommands are create "on the fly"
via a Synchronous event listener and at post commit time the system will merge the commands and execute worker to
process them.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected longprotected Stringstatic final Stringprotected booleanprotected Stringprotected static final AtomicLongprotected booleanprotected Stringprotected IndexingCommand.Type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIndexingCommand(DocumentModel document, IndexingCommand.Type commandType, boolean sync, boolean recurse) Create an indexing command -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSchemas(String schema) voidattach(CoreSession session) protected booleancanBeMerged(IndexingCommand other) clone(DocumentModel newDoc) static IndexingCommandfromJSON(com.fasterxml.jackson.databind.JsonNode jsonNode) static IndexingCommandCreate a command from a JSON string.getId()longgetOrder()getPath()String[]Return the document or null if it does not exists anymore.getType()protected DocumentModelgetValidTargetDocument(DocumentModel target) booleanbooleanisSync()voidmakeSync()Try to make the command synchronous.protected voidmerge(boolean sync, boolean recurse) booleanmerge(IndexingCommand other) voidsetOrder(long order) toJSON()voidtoJSON(com.fasterxml.jackson.core.JsonGenerator jsonGen) toString()
-
Field Details
-
PREFIX
- See Also:
-
id
-
type
-
sync
protected boolean sync -
recurse
protected boolean recurse -
targetDocumentId
-
path
-
repositoryName
-
schemas
-
order
protected long order -
seq
-
-
Constructor Details
-
IndexingCommand
protected IndexingCommand() -
IndexingCommand
public IndexingCommand(DocumentModel document, IndexingCommand.Type commandType, boolean sync, boolean recurse) Create an indexing command- Parameters:
document- the target documentcommandType- the type of commandsync- if true the command will be processed on the same thread after transaction completion and the Elasticsearch index will be refreshrecurse- the command affect the document and all its descendants
-
-
Method Details
-
getValidTargetDocument
-
attach
-
getTargetDocument
Return the document or null if it does not exists anymore.- Throws:
IllegalStateException- if there is no session attached
-
getRepositoryName
-
merge
- Returns:
- true if merged
-
merge
protected void merge(boolean sync, boolean recurse) -
canBeMerged
-
isSync
public boolean isSync() -
isRecurse
public boolean isRecurse() -
getType
-
toJSON
- Throws:
IOException
-
toJSON
- Throws:
IOException
-
fromJSON
Create a command from a JSON string.- Throws:
IllegalArgumentException- if json is invalid or command is invalid
-
fromJSON
-
getId
-
getTargetDocumentId
-
clone
-
getSchemas
-
addSchemas
-
getPath
-
toString
-
makeSync
public void makeSync()Try to make the command synchronous. Recurse command will stay in async for update. -
getOrder
public long getOrder() -
setOrder
public void setOrder(long order)
-