Class TextMetaDataExtractingProcessor

java.lang.Object
org.craftercms.core.processors.impl.TextMetaDataExtractingProcessor
All Implemented Interfaces:
ItemProcessor

public class TextMetaDataExtractingProcessor extends Object implements ItemProcessor
ItemProcessor that extracts single text values from descriptor XPath-selected nodes and sets them as the properties of the item. All XPath queries should only return single nodes. For extracting values for a list of nodes use TextMetaDataCollectionExtractingProcessor.
Author:
Sumer Jabri, Alfonso Vásquez
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String[]
    Array of XPath queries for the nodes whose values should be extracted.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextMetaDataExtractingProcessor(String... metaDataNodesXPathQueries)
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the specified TextMetaDataExtractingProcessor's and this instance's metaDataNodesXPathQueries are equal.
    int
    Returns the hash code for this instance, which is basically hash code of the list of XPath queries.
    process(Context context, CachingOptions cachingOptions, Item item)
    For every XPath query provided in metaDataNodesXPathQueries, a single node is selected and its text value is extracted and put in the item's properties.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.craftercms.core.processors.ItemProcessor

    isExclusive
  • Field Details

    • metaDataNodesXPathQueries

      protected String[] metaDataNodesXPathQueries
      Array of XPath queries for the nodes whose values should be extracted.
  • Constructor Details

    • TextMetaDataExtractingProcessor

      @ConstructorProperties("metaDataNodesXPathQueries") public TextMetaDataExtractingProcessor(String... metaDataNodesXPathQueries)
      Default constructor. Sets the metaDataNodesXPathQueries to the provided argument.
  • Method Details

    • process

      public Item process(Context context, CachingOptions cachingOptions, Item item)
      For every XPath query provided in metaDataNodesXPathQueries, a single node is selected and its text value is extracted and put in the item's properties.
      Specified by:
      process in interface ItemProcessor
      Parameters:
      context - the current context
      cachingOptions - caching options in case you need access to items
      item - the item to process
      Returns:
      the modified item or a new item.
    • equals

      public boolean equals(Object o)
      Returns true if the specified TextMetaDataExtractingProcessor's and this instance's metaDataNodesXPathQueries are equal.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns the hash code for this instance, which is basically hash code of the list of XPath queries. As with any other ItemProcessor, this method is defined because any processor which is passed in the method call of a ContentStoreService can be used as part of a key for caching.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object