Package com.day.cq.dam.core.process
Class CreateThumbnailProcess
- java.lang.Object
-
- com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess
-
- com.day.cq.dam.core.process.CreateThumbnailProcess
-
- All Implemented Interfaces:
WorkflowProcess
@Service @Property(name="process.label", value="Create Thumbnail") public class CreateThumbnailProcess extends AbstractAssetWorkflowProcess
TheCreateThumbnailProcess
is called in a Workflow process step. This process will create one or more Thumbnails for the Asset to be procesed. The Thumbnail generation is delegated to the appropriateAssetHandler
. The thumbails Dimensions are given as the WorkflowProcess arguments
Each argument is considered as one thumbnail configuration. The configuration has to be enclosed in squared brackets ([]) The configuration consists of a number for the width, the height in pixel and an optional flag that indicates if the image should be centered.
These values are seperated by a colon character (:).
Dimension:
The thumbnail from an image will be created by resizeing according the thumbnail configuration. The ascpect ratio is respected and the image will have at most the dimension given by the configuration.
Centering:
If the center flag is set to true, the thumbnail image will have exactly the size given by the configuraiton. If the resized image is smaller it will be centered within the thumbnail.Example with the following Workflow step arguments:
[70:70], [80:100:true]
The Process creates two PNG images one of the size of 70x70 pixel and one 80x100 where the result is centred
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CreateThumbnailProcess.Arguments
The available arguments to this process implementation.static class
CreateThumbnailProcess.Config
The parsed configuration for this wf process
-
Field Summary
-
Fields inherited from class com.day.cq.dam.commons.process.AbstractAssetWorkflowProcess
TYPE_JCR_PATH
-
-
Constructor Summary
Constructors Constructor Description CreateThumbnailProcess()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RenditionTemplate[]
createRenditionTemplates(Asset asset, ThumbnailConfig[] thumbnails, RenditionMaker renditionMaker)
void
createThumbnails(Asset asset, CreateThumbnailProcess.Config config, RenditionMaker renditionMaker)
void
execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaData)
Executes a new Java process with the given
andWorkItem
.WorkflowSession
CreateThumbnailProcess.Config
parseConfig(MetaDataMap metaData)
static ThumbnailConfig
parseThumbnailArguments(java.lang.String arg)
static ThumbnailConfig[]
parseThumbnailArguments(java.lang.String[] args)
-
-
-
Method Detail
-
execute
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaData) throws WorkflowException
Description copied from interface:WorkflowProcess
Executes a new Java process with the given
andWorkItem
.WorkflowSession
- Parameters:
workItem
- The
that defines the newly startedWorkItem
JavaProcessNew
.workflowSession
- The
that is used for starting theWorkflowSession
JavaProcess
.metaData
- Process specific arguments can be passed here- Throws:
WorkflowException
- Thrown in case something goes wrong during execution.
-
createThumbnails
public void createThumbnails(Asset asset, CreateThumbnailProcess.Config config, RenditionMaker renditionMaker)
-
createRenditionTemplates
public static RenditionTemplate[] createRenditionTemplates(Asset asset, ThumbnailConfig[] thumbnails, RenditionMaker renditionMaker)
-
parseConfig
public CreateThumbnailProcess.Config parseConfig(MetaDataMap metaData)
-
parseThumbnailArguments
public static ThumbnailConfig[] parseThumbnailArguments(java.lang.String[] args)
-
parseThumbnailArguments
public static ThumbnailConfig parseThumbnailArguments(java.lang.String arg)
-
-