Class IndexingCommand

  • All Implemented Interfaces:
    Serializable

    public class IndexingCommand
    extends Object
    implements 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:
    Serialized Form
    • Constructor Detail

      • IndexingCommand

        protected IndexingCommand()
      • IndexingCommand

        public IndexingCommand​(DocumentModel document,
                               IndexingCommand.Type commandType,
                               boolean sync,
                               boolean recurse)
        Create an indexing command
        Parameters:
        document - the target document
        commandType - the type of command
        sync - if true the command will be processed on the same thread after transaction completion and the Elasticsearch index will be refresh
        recurse - the command affect the document and all its descendants
    • Method Detail

      • getTargetDocument

        public DocumentModel getTargetDocument()
        Return the document or null if it does not exists anymore.
        Throws:
        IllegalStateException - if there is no session attached
      • getRepositoryName

        public String getRepositoryName()
      • merge

        public boolean merge​(IndexingCommand other)
        Returns:
        true if merged
      • merge

        protected void merge​(boolean sync,
                             boolean recurse)
      • isSync

        public boolean isSync()
      • isRecurse

        public boolean isRecurse()
      • toJSON

        public void toJSON​(com.fasterxml.jackson.core.JsonGenerator jsonGen)
                    throws IOException
        Throws:
        IOException
      • fromJSON

        public static IndexingCommand fromJSON​(com.fasterxml.jackson.databind.JsonNode jsonNode)
      • getId

        public String getId()
      • getTargetDocumentId

        public String getTargetDocumentId()
      • getSchemas

        public String[] getSchemas()
      • addSchemas

        public void addSchemas​(String schema)
      • 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)