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
BaseItemProcessorto add a new field to documents.- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdefaultValueOptional default value for the new field.protected StringnewFieldName of the new field to add.
-
Constructor Summary
Constructors Constructor Description AbstractTaggingProcessor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddNewField(Item item, String values)Tags the item adding the new field with the specified values.protected abstract StringgetTagValues(Item item)If this method returns null or an empty string the item will not be tagged.Itemprocess(Context context, CachingOptions cachingOptions, Item item)Processes anItem.voidsetDefaultValue(String defaultValue)voidsetNewField(String newField)
-
-
-
Method Detail
-
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:ItemProcessorProcesses anItem.- Specified by:
processin interfaceItemProcessor- Parameters:
context- the current contextcachingOptions- caching options in case you need access to itemsitem- the item to process- Returns:
- the modified item or a new item.
- Throws:
ItemProcessingException- if an error occurred while processing the item
-
-