Class AbstractTaggingProcessor

java.lang.Object
org.craftercms.core.processors.impl.AbstractTaggingProcessor
All Implemented Interfaces:
ItemProcessor
Direct Known Subclasses:
TaggingByFieldValueProcessor, TaggingByPathProcessor

public abstract class AbstractTaggingProcessor extends Object implements ItemProcessor
Base ItemProcessor to add a new field to documents.
Author:
joseross
  • Field Details

    • newField

      protected String newField
      Name of the new field to add.
    • defaultValue

      protected String defaultValue
      Optional default value for the new field.
  • Constructor Details

    • AbstractTaggingProcessor

      public AbstractTaggingProcessor()
  • Method Details

    • setNewField

      public void setNewField(String newField)
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
    • getTagValues

      protected abstract String getTagValues(Item item)
      If this method returns null or an empty string the item will not be tagged.
      Parameters:
      item -
      Returns:
      values to use for tagging the item
    • addNewField

      protected void addNewField(Item item, String values)
      Tags the item adding the new field with the specified values.
      Parameters:
      item -
      values -
    • process

      public Item process(Context context, CachingOptions cachingOptions, Item item) throws ItemProcessingException
      Description copied from interface: ItemProcessor
      Processes an Item.
      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.
      Throws:
      ItemProcessingException - if an error occurred while processing the item