public class ImagingComponent extends DefaultComponent implements ImagingService
| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIGURATION_PARAMETERS_EP |
protected Map<String,String> |
configurationParameters |
static String |
PICTURE_CONVERSIONS_EP |
protected PictureConversionRegistry |
pictureConversionRegistry |
protected PictureMigrationHandler |
pictureMigrationHandler |
lastModified| Constructor and Description |
|---|
ImagingComponent() |
| Modifier and Type | Method and Description |
|---|---|
void |
activate(ComponentContext context)
Activates the component.
|
protected Blob |
callPictureConversionChain(DocumentModel doc,
Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo,
Point size,
String conversionFormat) |
protected boolean |
canApplyPictureConversion(PictureConversion pictureConversion,
DocumentModel doc) |
protected PictureView |
computeOriginalJpegView(Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo)
Deprecated.
since 7.1
|
protected PictureView |
computeOriginalView(Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo)
Deprecated.
since 7.1
|
protected PictureView |
computeView(Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo,
boolean convert) |
protected PictureView |
computeView(DocumentModel doc,
Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo) |
protected PictureView |
computeView(DocumentModel doc,
Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo,
boolean convert) |
protected String |
computeViewFilename(String filename,
String format)
Deprecated.
since 7.1. We now use the original Blob base name + the computed Blob filename extension.
|
PictureView |
computeViewFor(Blob blob,
PictureConversion pictureConversion,
boolean convert)
|
PictureView |
computeViewFor(Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo,
boolean convert)
|
List<PictureView> |
computeViewsFor(Blob blob,
List<PictureConversion> pictureConversions,
boolean convert)
|
List<PictureView> |
computeViewsFor(Blob blob,
List<PictureConversion> pictureConversions,
ImageInfo imageInfo,
boolean convert)
|
List<PictureView> |
computeViewsFor(DocumentModel doc,
Blob blob,
ImageInfo imageInfo,
boolean convert)
Compute all the registered
PictureConversion For each picture template the
ImagingService.computeViewFor(Blob, PictureConversion, ImageInfo, boolean) method is call |
List<List<PictureView>> |
computeViewsFor(List<Blob> blobs,
List<PictureConversion> pictureConversions,
boolean convert)
|
List<List<PictureView>> |
computeViewsFor(List<Blob> blobs,
List<PictureConversion> pictureConversions,
ImageInfo imageInfo,
boolean convert)
|
protected PictureView |
computeViewWithoutConversion(Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo) |
Blob |
convertToPDF(Blob blob)
Converts an image to PDF.
|
protected ActionContext |
createActionContext(DocumentModel doc) |
Blob |
crop(Blob blob,
int x,
int y,
int width,
int height)
Crops an image.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
String |
getConfigurationValue(String configurationName)
Returns the value a configuration which name is received as parameter.
|
String |
getConfigurationValue(String configurationName,
String defaultValue)
Returns the value a configuration which name is received as parameter.
|
ImageInfo |
getImageInfo(Blob blob)
|
Map<String,Object> |
getImageMetadata(Blob blob)
Retrieves metadata from an image contained in a
Blob. |
String |
getImageMimeType(Blob blob)
Returns the mime-type for the given Blob
|
String |
getImageMimeType(File file)
Returns the mime-type for the given file.
|
PictureConversion |
getPictureConversion(String id)
Returns a
PictureConversion given its id. |
List<PictureConversion> |
getPictureConversions()
Returns the registered picture conversions.
|
protected static Point |
getSize(Point current,
int max) |
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
Blob |
resize(Blob blob,
String finalFormat,
int width,
int height,
int depth)
Resizes image.
|
Blob |
rotate(Blob blob,
int angle)
Rotates an image.
|
void |
setConfigurationValue(String configurationName,
String configurationValue)
Sets the value of a configuration which could be used by the ImagingService.
|
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
protected Blob |
wrapBlob(Blob blob) |
getAdapter, getLastModified, registerExtension, setLastModified, setModifiedNow, start, stop, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStarted, getApplicationStartedOrderpublic static final String CONFIGURATION_PARAMETERS_EP
public static final String PICTURE_CONVERSIONS_EP
protected Map<String,String> configurationParameters
protected PictureConversionRegistry pictureConversionRegistry
protected final PictureMigrationHandler pictureMigrationHandler
public ImagingComponent()
public List<PictureConversion> getPictureConversions()
ImagingServicegetPictureConversions in interface ImagingServicepublic PictureConversion getPictureConversion(String id)
ImagingServicePictureConversion given its id.getPictureConversion in interface ImagingServicepublic Blob crop(Blob blob, int x, int y, int width, int height)
ImagingServicecrop in interface ImagingServicepublic Blob resize(Blob blob, String finalFormat, int width, int height, int depth)
ImagingServiceresize in interface ImagingServicepublic Blob rotate(Blob blob, int angle)
ImagingServicerotate in interface ImagingServiceblob - a Blob containing the imageangle - the angle of the rotationpublic Blob convertToPDF(Blob blob)
ImagingServiceconvertToPDF in interface ImagingServiceblob - a Blob containing the imagepublic Map<String,Object> getImageMetadata(Blob blob)
ImagingServiceBlob.getImageMetadata in interface ImagingServicepublic String getImageMimeType(File file)
ImagingServicegetImageMimeType in interface ImagingServicepublic String getImageMimeType(Blob blob)
ImagingServicegetImageMimeType in interface ImagingServicepublic ImageInfo getImageInfo(Blob blob)
ImagingServiceImageInfo of the Blob that is received as parameter.
The information provided by the ImageInfo, like width, height or format, is obtained using ImageMagick (see http://www.imagemagick.org/script/index.php for more details on ImageMagick).
getImageInfo in interface ImagingServiceblob - the blob of a pictureImageInfo of a blobpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution in class DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentpublic String getConfigurationValue(String configurationName)
ImagingServicegetConfigurationValue in interface ImagingServiceconfigurationName - the name of the configurationpublic String getConfigurationValue(String configurationName, String defaultValue)
ImagingServicegetConfigurationValue in interface ImagingServiceconfigurationName - the name of the configurationdefaultValue - the value of the configurationpublic void setConfigurationValue(String configurationName, String configurationValue)
ImagingServicesetConfigurationValue in interface ImagingServiceconfigurationName - the name of the configurationconfigurationValue - the value of the configurationpublic PictureView computeViewFor(Blob blob, PictureConversion pictureConversion, boolean convert) throws IOException
ImagingServicecomputeViewFor in interface ImagingServiceconvert - true if the blob is converted to fit the pictureConversion, false if the
blob is put as it in the PictureView (without any conversion)IOExceptionpublic PictureView computeViewFor(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) throws IOException
ImagingServicecomputeViewFor in interface ImagingServiceimageInfo - the ImageInfo to use when computing the viewconvert - true if the blob is converted to fit the pictureConversion, false if the
blob is put as it in the PictureView (without any conversion)IOExceptionpublic List<PictureView> computeViewsFor(Blob blob, List<PictureConversion> pictureConversions, boolean convert) throws IOException
ImagingServicecomputeViewsFor in interface ImagingServiceconvert - true if the blob is converted to fit each PictureConversion, false if the
blob is put as it in the PictureView (without any conversion)PictureViewsIOExceptionpublic List<PictureView> computeViewsFor(Blob blob, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) throws IOException
ImagingServicecomputeViewsFor in interface ImagingServiceimageInfo - the ImageInfo to use when computing the viewconvert - true if the blob is converted to fit each PictureConversion, false if the
blob is put as it in the PictureView (without any conversion)PictureViewsIOExceptionprotected PictureView computeView(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) throws IOException
IOExceptionprotected PictureView computeView(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) throws IOException
IOException@Deprecated protected PictureView computeOriginalView(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) throws IOException
computeView(org.nuxeo.ecm.core.api.DocumentModel, Blob, org.nuxeo.ecm.platform.picture.api.PictureConversion, ImageInfo)
by passing the Original picture template.IOException@Deprecated protected PictureView computeOriginalJpegView(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) throws IOException
computeView(org.nuxeo.ecm.core.api.DocumentModel, Blob, org.nuxeo.ecm.platform.picture.api.PictureConversion, ImageInfo)
by passing the OriginalJpeg picture template.IOException@Deprecated protected String computeViewFilename(String filename, String format)
protected PictureView computeView(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo)
protected Blob callPictureConversionChain(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, Point size, String conversionFormat)
public List<PictureView> computeViewsFor(DocumentModel doc, Blob blob, ImageInfo imageInfo, boolean convert) throws IOException
ImagingServicePictureConversion For each picture template the
ImagingService.computeViewFor(Blob, PictureConversion, ImageInfo, boolean) method is callcomputeViewsFor in interface ImagingServiceIOExceptionprotected boolean canApplyPictureConversion(PictureConversion pictureConversion, DocumentModel doc)
protected ActionContext createActionContext(DocumentModel doc)
protected PictureView computeViewWithoutConversion(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo)
public List<List<PictureView>> computeViewsFor(List<Blob> blobs, List<PictureConversion> pictureConversions, boolean convert) throws IOException
ImagingServicecomputeViewsFor in interface ImagingServiceconvert - true if the blob is converted to fit each PictureConversion, false if the
blob is put as it in the PictureView (without any conversion)IOExceptionpublic List<List<PictureView>> computeViewsFor(List<Blob> blobs, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) throws IOException
ImagingServicecomputeViewsFor in interface ImagingServiceimageInfo - the ImageInfo to use when computing the viewconvert - true if the blob is converted to fit each PictureConversion, false if the
blob is put as it in the PictureView (without any conversion)IOExceptionpublic void activate(ComponentContext context)
ComponentThis method is called by the runtime when a component is activated.
activate in interface Componentactivate in class DefaultComponentcontext - the runtime contextpublic void deactivate(ComponentContext context)
ComponentThis method is called by the runtime when a component is deactivated.
deactivate in interface Componentdeactivate in class DefaultComponentcontext - the runtime contextCopyright © 2018 Nuxeo. All rights reserved.