Class AbstractTaggingProcessor
java.lang.Object
org.craftercms.core.processors.impl.AbstractTaggingProcessor
- All Implemented Interfaces:
ItemProcessor
- Direct Known Subclasses:
TaggingByFieldValueProcessor
,TaggingByPathProcessor
Base
ItemProcessor
to add a new field to documents.- Author:
- joseross
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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.process
(Context context, CachingOptions cachingOptions, Item item) Processes anItem
.void
setDefaultValue
(String defaultValue) void
setNewField
(String newField) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.craftercms.core.processors.ItemProcessor
isExclusive
-
Field Details
-
newField
Name of the new field to add. -
defaultValue
Optional default value for the new field.
-
-
Constructor Details
-
AbstractTaggingProcessor
public AbstractTaggingProcessor()
-
-
Method Details
-
setNewField
-
setDefaultValue
-
getTagValues
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
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
-