Package org.codelibs.fess.thumbnail.impl
Class BaseThumbnailGenerator
java.lang.Object
org.codelibs.fess.thumbnail.impl.BaseThumbnailGenerator
- All Implemented Interfaces:
ThumbnailGenerator
- Direct Known Subclasses:
CommandGenerator,EmptyGenerator,HtmlTagBasedGenerator
Abstract base class for thumbnail generators.
Provides common functionality for thumbnail generation implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BooleanAvailability status of this generator.Map of conditions for thumbnail generation.protected intLength for directory name generation.Map of file paths for thumbnail generation.List of generator names.protected intMaximum number of redirects to follow.protected StringThe name of this thumbnail generator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCondition(String key, String regex) Adds a condition for thumbnail generation.createTask(String path, Map<String, Object> docMap) Creates a thumbnail generation task.protected StringexpandPath(String value) Expands a file path using the file path mapping.getName()Gets the name of this thumbnail generator.booleanChecks if this thumbnail generator is available for use.booleanChecks if this generator can handle the given document.protected booleanprocess(String id, BiPredicate<String, String> consumer) Processes thumbnail generation with a consumer function.protected booleanProcesses thumbnail generation with a response data consumer.voidregister()Registers this thumbnail generator with the thumbnail manager.voidsetDirectoryNameLength(int directoryNameLength) Sets the directory name length for thumbnail storage.voidsetGeneratorList(List<String> generatorList) Sets the list of generator names.voidsetMaxRedirectCount(int maxRedirectCount) Sets the maximum number of redirects to follow.voidSets the name of this thumbnail generator.protected voidupdateThumbnailField(String thumbnailId, String value) Updates the thumbnail field in the search index.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codelibs.fess.thumbnail.ThumbnailGenerator
destroy, generate
-
Field Details
-
conditionMap
Map of conditions for thumbnail generation. -
directoryNameLength
protected int directoryNameLengthLength for directory name generation. -
generatorList
List of generator names. -
filePathMap
Map of file paths for thumbnail generation. -
name
The name of this thumbnail generator. -
maxRedirectCount
protected int maxRedirectCountMaximum number of redirects to follow. -
available
Availability status of this generator.
-
-
Constructor Details
-
BaseThumbnailGenerator
public BaseThumbnailGenerator()Default constructor for BaseThumbnailGenerator.
-
-
Method Details
-
register
public void register()Registers this thumbnail generator with the thumbnail manager. -
addCondition
Adds a condition for thumbnail generation.- Parameters:
key- The condition key.regex- The regex pattern for the condition.
-
isTarget
Description copied from interface:ThumbnailGeneratorChecks if this generator can handle the given document.- Specified by:
isTargetin interfaceThumbnailGenerator- Parameters:
docMap- The document map containing metadata.- Returns:
- True if this generator can handle the document, false otherwise.
-
isAvailable
public boolean isAvailable()Description copied from interface:ThumbnailGeneratorChecks if this thumbnail generator is available for use.- Specified by:
isAvailablein interfaceThumbnailGenerator- Returns:
- True if available, false otherwise.
-
createTask
public org.codelibs.core.misc.Tuple3<String,String, createTaskString> (String path, Map<String, Object> docMap) Description copied from interface:ThumbnailGeneratorCreates a thumbnail generation task.- Specified by:
createTaskin interfaceThumbnailGenerator- Parameters:
path- The path to the source document.docMap- The document map containing metadata.- Returns:
- A tuple containing task information.
-
setDirectoryNameLength
public void setDirectoryNameLength(int directoryNameLength) Sets the directory name length for thumbnail storage.- Parameters:
directoryNameLength- The directory name length.
-
expandPath
Expands a file path using the file path mapping.- Parameters:
value- The original path value.- Returns:
- The expanded path or the original value if no mapping exists.
-
updateThumbnailField
Updates the thumbnail field in the search index.- Parameters:
thumbnailId- The thumbnail ID.value- The thumbnail value to update.
-
process
Processes thumbnail generation with a consumer function.- Parameters:
id- The document ID.consumer- The consumer function to process thumbnail and config ID.- Returns:
- True if processing was successful, false otherwise.
-
process
protected boolean process(String id, Predicate<org.codelibs.fess.crawler.entity.ResponseData> consumer) Processes thumbnail generation with a response data consumer.- Parameters:
id- The document ID.consumer- The consumer function to process response data.- Returns:
- True if processing was successful, false otherwise.
-
setGeneratorList
Sets the list of generator names.- Parameters:
generatorList- The list of generator names.
-
getName
Description copied from interface:ThumbnailGeneratorGets the name of this thumbnail generator.- Specified by:
getNamein interfaceThumbnailGenerator- Returns:
- The generator name.
-
setName
Sets the name of this thumbnail generator.- Parameters:
name- The generator name.
-
setMaxRedirectCount
public void setMaxRedirectCount(int maxRedirectCount) Sets the maximum number of redirects to follow.- Parameters:
maxRedirectCount- The maximum redirect count.
-