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
BaseItemProcessor
to add a new field to documents.- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description protected String
defaultValue
Optional default value for the new field.protected String
newField
Name 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 void
addNewField(Item item, String values)
Tags the item adding the new field with the specified values.protected abstract String
getTagValues(Item item)
If this method returns null or an empty string the item will not be tagged.Item
process(Context context, CachingOptions cachingOptions, Item item)
Processes anItem
.void
setDefaultValue(String defaultValue)
void
setNewField(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:ItemProcessor
Processes anItem
.- Specified by:
process
in 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
-
-