Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.repo.content.transform
Class ComplexContentTransformer
java.lang.Object
  org.alfresco.repo.content.transform.ContentTransformerHelper
      org.alfresco.repo.content.transform.AbstractContentTransformerLimits
          org.alfresco.repo.content.transform.AbstractContentTransformer2
              org.alfresco.repo.content.transform.ComplexContentTransformer
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, ContentTransformer, ContentWorker, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.Aware

public class ComplexContentTransformer
extends AbstractContentTransformer2
implements org.springframework.beans.factory.InitializingBean
Transformer that passes a document through several nested transformations in order to accomplish its goal.
Author:
Derek Hulley

Fields inherited from class org.alfresco.repo.content.transform.AbstractContentTransformerLimits
transformerDebug
Fields inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
transformerConfig
Constructor Summary
ComplexContentTransformer()
Method Summary
void
afterPropertiesSet()
          Ensures that required properties have been set
getComments(boolean available)
          Returns the transformer properties predefined (hard coded or implied) by this transformer.
getIntermediateMimetypes()
getIntermediateTransformers()
getLimits(String sourceMimetype, String targetMimetype, TransformationOptions options)
          Returns the limits from this transformer combined with those of the first transformer in the chain.
protected boolean
isPageLimitSupported(String sourceMimetype, String targetMimetype, TransformationOptions options)
          Indicates if 'page' limits are supported by the first transformer in the chain.
boolean
isTransformable(String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
          Indicates whether the provided source mimetype can be transformed into the target mimetype with the options specified by this content transformer.
boolean
isTransformableMimetype(String sourceMimetype, String targetMimetype, TransformationOptions options)
          Indicates if this transformer is able to transform the given source mimetype to the target mimetype.
void
setContentService(ContentService contentService)
          Sets the ContentService.
void
setIntermediateMimetypes(List<String> intermediateMimetypes)
          Set the intermediate mimetypes that the transformer must take the content through.
void
setTransformationOptionOverrides(Map<String,Serializable> transformationOptionOverrides)
          Sets any properties to be set on the TransformationOption as passed in.
void
setTransformers(List<ContentTransformer> transformers)
          The list of transformers to use.
void
transformInternal(ContentReader reader, ContentWriter writer, TransformationOptions options)
          Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformer2
checkTransformable, getExecutorService, getTransformationTime, getTransformationTime, isTransformationLimitedInternally, recordError, recordTime, recordTime, register, setAdditionalThreadTimout, setExecutorService, setRegisterTransformer, setRegistry, setRetryTransformOnDifferentMimeType, setUseTimeoutThread, toString, transform, transform, transform
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformerLimits
getLimits, getLimits, getMaxPages, getMaxSourceSizeKBytes, getMaxSourceSizeKBytes, getPageLimit, getReadLimitKBytes, getReadLimitTimeMs, getTimeoutMs, isTransformable, isTransformableSize, setLimits, setMaxPages, setMaxSourceSizeKBytes, setMimetypeLimits, setPageLimit, setPageLimitsSupported, setReaderLimits, setReadLimitKBytes, setReadLimitTimeMs, setTimeoutMs, setTransformerDebug
Methods inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
deprecatedSetter, equals, getBeanName, getCommentsOnlySupports, getExtensionOrAny, getMimetype, getMimetypeService, getName, getSimpleName, hashCode, isExplicitTransformation, isSupportedTransformation, onlySupports, setBeanName, setExplicitTransformations, setMimetypeService, setSupportedTransformations, setTransformerConfig, setUnsupportedTransformations
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.alfresco.repo.content.transform.ContentTransformer
getName, isExplicitTransformation
Constructor Detail
ComplexContentTransformer
public ComplexContentTransformer()
Method Detail
setTransformers
public void setTransformers(List<ContentTransformer> transformers)
The list of transformers to use. If any element is null all possible transformers will be considered. If any element is null, the contentService property must be set.

If a single transformer is supplied, then it will still be used.

Parameters:
transformers - list of at least one transformer
See Also:
setContentService(ContentService)

setIntermediateMimetypes
public void setIntermediateMimetypes(List<String> intermediateMimetypes)
Set the intermediate mimetypes that the transformer must take the content through. If the transformation A..B..C is performed in order to simulate A..C, then B is the intermediate mimetype. There must always be n-1 intermediate mimetypes, where n is the number of transformers taking part in the transformation.
Parameters:
intermediateMimetypes - intermediate mimetypes to transition the content through.

setTransformationOptionOverrides
public void setTransformationOptionOverrides(Map<String,Serializable> transformationOptionOverrides)
Sets any properties to be set on the TransformationOption as passed in. This allows you to force certain properties to always be set on it, to control the transformers in a different way to their default. Note that only properties that are supported by the passed-in TransformationOptions are changed, others are ignored.
Parameters:
transformationOptionOverrides - Map

setContentService
public void setContentService(ContentService contentService)
Sets the ContentService. Only required if null transformers are provided to setTransformers(List).

afterPropertiesSet
public void afterPropertiesSet()
                        throws Exception
Ensures that required properties have been set
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

isTransformable
public boolean isTransformable(String sourceMimetype,
                               long sourceSize,
                               String targetMimetype,
                               TransformationOptions options)
Description copied from class: AbstractContentTransformerLimits
Indicates whether the provided source mimetype can be transformed into the target mimetype with the options specified by this content transformer.

Implementation calls the deprecated overloaded method without the sourceSize parameter and then AbstractContentTransformerLimits.isTransformableSize(String, long, String, TransformationOptions).

Specified by:
isTransformable in interface ContentTransformer
Overrides:
isTransformable in class AbstractContentTransformerLimits
Parameters:
sourceMimetype - the source mimetype
sourceSize - the size (bytes) of the source. If negative it is unknown.
targetMimetype - the target mimetype
options - the transformation options
Returns:
boolean true if this content transformer can satify the mimetypes and options specified, false otherwise

isTransformableMimetype
public boolean isTransformableMimetype(String sourceMimetype,
                                       String targetMimetype,
                                       TransformationOptions options)
Description copied from class: AbstractContentTransformerLimits
Indicates if this transformer is able to transform the given source mimetype to the target mimetype. If overridden, consider also overriding ContentTransformerHelper.getComments(boolean).
Specified by:
isTransformableMimetype in interface ContentTransformer
Overrides:
isTransformableMimetype in class AbstractContentTransformerLimits
Parameters:
sourceMimetype - the source mimetype
targetMimetype - the target mimetype
options - the transformation options
Returns:
boolean true if this content transformer can satify the mimetypes, false otherwise

isPageLimitSupported
protected boolean isPageLimitSupported(String sourceMimetype,
                                       String targetMimetype,
                                       TransformationOptions options)
Indicates if 'page' limits are supported by the first transformer in the chain. If the first transformer is dynamic, all possible first transformers must support it.
Overrides:
isPageLimitSupported in class AbstractContentTransformerLimits
Returns:
true if the first transformer supports them.

getLimits
protected TransformationOptionLimits getLimits(String sourceMimetype,
                                               String targetMimetype,
                                               TransformationOptions options)
Returns the limits from this transformer combined with those of the first transformer in the chain. If the first transformer is dynamic, the lowest common denominator between all possible first transformers are combined.
Overrides:
getLimits in class AbstractContentTransformerLimits

transformInternal
public void transformInternal(ContentReader reader,
                              ContentWriter writer,
                              TransformationOptions options)
                       throws Exception
Description copied from class: AbstractContentTransformer2
Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.
Overrides:
transformInternal in class AbstractContentTransformer2
Parameters:
reader - the source of the content to transform
writer - the target to which to write the transformed content
options - a map of options to use when performing the transformation. The map will never be null.
Throws:
Exception - exceptions will be handled by this class - subclasses can throw anything
See Also:
AbstractContentTransformer2.transformInternal(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter, org.alfresco.service.cmr.repository.TransformationOptions)

getIntermediateMimetypes
public List<StringgetIntermediateMimetypes()

getIntermediateTransformers
public List<ContentTransformergetIntermediateTransformers()

getComments
public String getComments(boolean available)
Returns the transformer properties predefined (hard coded or implied) by this transformer.
Specified by:
getComments in interface ContentTransformer
Overrides:
getComments in class ContentTransformerHelper
Parameters:
available - indicates if the transformer has been registered and is available to be selected. false indicates that the transformer is only available as a component of a complex transformer.
Returns:
one line per property. The simple transformer name is returned by default as a comment.

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2016 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.