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.service.cmr.repository
Class TransformationOptions
java.lang.Object
  org.alfresco.service.cmr.repository.TransformationOptions
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
ImageTransformationOptions

public class TransformationOptions
extends Object
implements Cloneable
Class containing values of options that are passed to content transformers. These options are used to determine the applicability of a content transformer and also during the transformation process to provide context or parameter values.

This base class provides some common, optional contextual information about the source and target nodes and properties used by the transformation.

Since:
3.0.0
Author:
Roy Wetherall

Field Summary
static String
OPT_INCLUDE_EMBEDDED
static String
OPT_SOURCE_CONTENT_PROPERTY
static String
OPT_SOURCE_NODEREF
          Option map names to preserve backward compatibility
static String
OPT_TARGET_CONTENT_PROPERTY
static String
OPT_TARGET_NODEREF
static String
OPT_USE
relaxedBooleanTypeConverter
Constructor Summary
TransformationOptions()
          Default constructor
TransformationOptions(Map<String,Object> optionsMap)
          Constructor.
TransformationOptions(NodeRef sourceNodeRef, QName sourceContentProperty, NodeRef targetNodeRef, QName targetContentProperty)
          Constructor
TransformationOptions(TransformationOptions options)
          Deep clone constructor
Method Summary
void
addSourceOptions(TransformationSourceOptions sourceOptions)
          Adds the given sourceOptions to the sourceOptionsMap.
clone()
void
copyFrom(TransformationOptions otherOptions)
          Does the work of copying the given other TransformationOptions values to this one
deepCopy()
          Creates a clone of the TransformationOptions
boolean
equals(Object obj)
getIncludeEmbedded()
          If the source content includes embedded resources, should the transformer attempt to transform these as well? Not many transformers do support embedded resources, so this option will only affect those that can.
getLimits()
          Returns max and limit values for time, size and pages in a single operation.
int
getMaxPages()
          Get the maximum number of pages read before an exception is thrown.
long
getMaxSourceSizeKBytes()
          Gets the maximum source content size, to skip transformations where the source is just too large to expect it to perform.
int
getPageLimit()
          Get the page limit before returning EOF.
long
getReadLimitKBytes()
          Gets the limit in terms of the about of data read to limit transformations where only the start of the content is needed.
long
getReadLimitTimeMs()
          Gets the limit in terms of the amount of data read (by time) to limit transformations where only the start of the content is needed.
getSourceContentProperty()
          Get the source content property
getSourceNodeRef()
          Gets the source node reference
getSourceOptions(Class<T> clazz)
          Gets the appropriate source options for the given mimetype if available.
getSourceOptionsList()
          Gets the immutable list of source options further describing how the source should be transformed based on its mimetype.
getSourceOptionsMap()
          Gets the map of source options further describing how the source should be transformed based on its mimetype
getTargetContentProperty()
          Get the target content property
getTargetNodeRef()
          Get the target node reference
long
getTimeoutMs()
          Gets the timeout (ms) on the InputStream after which an IOExecption is thrown to terminate very slow transformations or a subprocess is terminated (killed).
getUse()
          The use to which the transform will be put.
int
hashCode()
void
set(Map<String,Object> optionsMap)
          Sets options from the supplied map.
void
setIncludeEmbedded(Boolean includeEmbedded)
          If the source content includes embedded resources, should the transformer attempt to transform these as well? Not many transformers do support embedded resources, so this option will only affect those that can.
void
setLimits(TransformationOptionLimits limits)
          Sets max and limit values for time, size and pages in a single operation.
void
setMaxPages(int maxPages)
          Set the number of pages read from the source before an exception is thrown.
void
setMaxSourceSizeKBytes(long maxSourceSizeKBytes)
          Sets a maximum source content size, to skip transformations where the source is just too large to expect it to perform.
void
setPageLimit(int pageLimit)
          Set the number of pages read from the source before returning EOF.
void
setReadLimitKBytes(long readLimitKBytes)
          Sets a limit in terms of the about of data read to limit transformations where only the start of the content is needed.
void
setReadLimitTimeMs(long readLimitTimeMs)
          Sets a limit in terms of the amount of data read (by time) to limit transformations where only the start of the content is needed.
void
setSourceContentProperty(QName sourceContentProperty)
          Set the source content property
void
setSourceNodeRef(NodeRef sourceNodeRef)
          Set the source node reference
void
setSourceOptionsList(Collection<TransformationSourceOptions> sourceOptionsList)
          Sets the list of source options further describing how the source should be transformed based on its mimetype.
void
setTargetContentProperty(QName targetContentProperty)
          Set the target content property
void
setTargetNodeRef(NodeRef targetNodeRef)
          Set the taget node reference
void
setTimeoutMs(long timeoutMs)
          Sets a timeout (ms) on the InputStream after which an IOExecption is thrown to terminate very slow transformations or to terminate (kill) a subprocess.
void
setUse(String use)
          The use to which the transform will be put.
toMap()
          Convert the transformation options into a map.
toString()
toString(boolean includeLimits)
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Field Detail
OPT_INCLUDE_EMBEDDED
public static final String OPT_INCLUDE_EMBEDDED
See Also:
Constant Field Values

OPT_SOURCE_CONTENT_PROPERTY
public static final String OPT_SOURCE_CONTENT_PROPERTY
See Also:
Constant Field Values

OPT_SOURCE_NODEREF
public static final String OPT_SOURCE_NODEREF
Option map names to preserve backward compatibility
See Also:
Constant Field Values

OPT_TARGET_CONTENT_PROPERTY
public static final String OPT_TARGET_CONTENT_PROPERTY
See Also:
Constant Field Values

OPT_TARGET_NODEREF
public static final String OPT_TARGET_NODEREF
See Also:
Constant Field Values

OPT_USE
public static final String OPT_USE
See Also:
Constant Field Values

relaxedBooleanTypeConverter
public static TypeConverter.Converter<String,Boolean> relaxedBooleanTypeConverter
Constructor Detail
TransformationOptions
public TransformationOptions()
Default constructor

TransformationOptions
public TransformationOptions(TransformationOptions options)
Deep clone constructor

TransformationOptions
public TransformationOptions(NodeRef sourceNodeRef,
                             QName sourceContentProperty,
                             NodeRef targetNodeRef,
                             QName targetContentProperty)
Constructor
Parameters:
sourceNodeRef - the source node reference
sourceContentProperty - the source content property
targetNodeRef - the target node reference
targetContentProperty - the target content property

TransformationOptions
public TransformationOptions(Map<String,Object> optionsMap)
Constructor. Creates a transformation options object from a map. Provided for back ward compatibility.
Parameters:
optionsMap - options map
Method Detail
clone
protected TransformationOptions clone()
                               throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

copyFrom
public void copyFrom(TransformationOptions otherOptions)
Does the work of copying the given other TransformationOptions values to this one
Parameters:
otherOptions - the options to copy

deepCopy
public TransformationOptions deepCopy()
Creates a clone of the TransformationOptions
Returns:
a copy of the options

set
public void set(Map<String,Object> optionsMap)
Sets options from the supplied map.
Parameters:
optionsMap - Map

setSourceNodeRef
public void setSourceNodeRef(NodeRef sourceNodeRef)
Set the source node reference
Parameters:
sourceNodeRef - the source node reference

getSourceNodeRef
public NodeRef getSourceNodeRef()
Gets the source node reference
Returns:
NodeRef the source node reference

setSourceContentProperty
public void setSourceContentProperty(QName sourceContentProperty)
Set the source content property
Parameters:
sourceContentProperty - the source content property

getSourceContentProperty
public QName getSourceContentProperty()
Get the source content property
Returns:
the source content property

setTargetNodeRef
public void setTargetNodeRef(NodeRef targetNodeRef)
Set the taget node reference
Parameters:
targetNodeRef - the target node reference

getTargetNodeRef
public NodeRef getTargetNodeRef()
Get the target node reference
Returns:
the target node reference

setTargetContentProperty
public void setTargetContentProperty(QName targetContentProperty)
Set the target content property
Parameters:
targetContentProperty - the target content property

getTargetContentProperty
public QName getTargetContentProperty()
Get the target content property
Returns:
the target property

setIncludeEmbedded
public void setIncludeEmbedded(Boolean includeEmbedded)
If the source content includes embedded resources, should the transformer attempt to transform these as well? Not many transformers do support embedded resources, so this option will only affect those that can.
Parameters:
includeEmbedded - the include embedded flag.

getIncludeEmbedded
public Boolean getIncludeEmbedded()
If the source content includes embedded resources, should the transformer attempt to transform these as well? Not many transformers do support embedded resources, so this option will only affect those that can.
Returns:
true, false, or null for the default for the transformer

setUse
public void setUse(String use)
The use to which the transform will be put. Initially used to select different transformation limits depending on the use: "Index", "Preview"...
Parameters:
use - to which the transform will be put.

getUse
public String getUse()
The use to which the transform will be put. Initially used to select different transformation limits depending on the use: "Index", "Preview"...
Returns:
the use - may be null

getTimeoutMs
public long getTimeoutMs()
Gets the timeout (ms) on the InputStream after which an IOExecption is thrown to terminate very slow transformations or a subprocess is terminated (killed).
Returns:
timeoutMs in milliseconds. If less than or equal to zero (the default) there is no timeout.

setTimeoutMs
public void setTimeoutMs(long timeoutMs)
Sets a timeout (ms) on the InputStream after which an IOExecption is thrown to terminate very slow transformations or to terminate (kill) a subprocess.
Parameters:
timeoutMs - in milliseconds. If less than or equal to zero (the default) there is no timeout. If greater than zero the readLimitTimeMs must not be set.

getReadLimitTimeMs
public long getReadLimitTimeMs()
Gets the limit in terms of the amount of data read (by time) to limit transformations where only the start of the content is needed. After this limit is reached the InputStream reports end of file.
Returns:
readLimitBytes if less than or equal to zero (the default) there is no limit.

setReadLimitTimeMs
public void setReadLimitTimeMs(long readLimitTimeMs)
Sets a limit in terms of the amount of data read (by time) to limit transformations where only the start of the content is needed. After this limit is reached the InputStream reports end of file.
Parameters:
readLimitTimeMs - if less than or equal to zero (the default) there is no limit. If greater than zero the timeoutMs must not be set.

getMaxSourceSizeKBytes
public long getMaxSourceSizeKBytes()
Gets the maximum source content size, to skip transformations where the source is just too large to expect it to perform. If the source is larger the transformer indicates it is not available.
Returns:
maxSourceSizeKBytes if less than or equal to zero (the default) there is no limit.

setMaxSourceSizeKBytes
public void setMaxSourceSizeKBytes(long maxSourceSizeKBytes)
Sets a maximum source content size, to skip transformations where the source is just too large to expect it to perform. If the source is larger the transformer indicates it is not available.
Parameters:
maxSourceSizeKBytes - if less than or equal to zero (the default) there is no limit. If greater than zero the readLimitKBytes must not be set.

getReadLimitKBytes
public long getReadLimitKBytes()
Gets the limit in terms of the about of data read to limit transformations where only the start of the content is needed. After this limit is reached the InputStream reports end of file.
Returns:
readLimitKBytes if less than or equal to zero (the default) no limit should be applied.

setReadLimitKBytes
public void setReadLimitKBytes(long readLimitKBytes)
Sets a limit in terms of the about of data read to limit transformations where only the start of the content is needed. After this limit is reached the InputStream reports end of file.
Parameters:
readLimitKBytes - if less than or equal to zero (the default) there is no limit. If greater than zero the maxSourceSizeKBytes must not be set.

getMaxPages
public int getMaxPages()
Get the maximum number of pages read before an exception is thrown.
Returns:
If less than or equal to zero (the default) no limit should be applied.

setMaxPages
public void setMaxPages(int maxPages)
Set the number of pages read from the source before an exception is thrown.
Parameters:
maxPages - the number of pages to be read from the source. If less than or equal to zero (the default) no limit is applied.

getPageLimit
public int getPageLimit()
Get the page limit before returning EOF.
Returns:
If less than or equal to zero (the default) no limit should be applied.

setPageLimit
public void setPageLimit(int pageLimit)
Set the number of pages read from the source before returning EOF.
Parameters:
pageLimit - the number of pages to be read from the source. If less than or equal to zero (the default) no limit is applied.

getLimits
public TransformationOptionLimits getLimits()
Returns max and limit values for time, size and pages in a single operation.

setLimits
public void setLimits(TransformationOptionLimits limits)
Sets max and limit values for time, size and pages in a single operation.

getSourceOptionsMap
protected Map<Class<? extends TransformationSourceOptions>,TransformationSourceOptionsgetSourceOptionsMap()
Gets the map of source options further describing how the source should be transformed based on its mimetype
Returns:
the source mimetype to source options map

getSourceOptionsList
public Collection<TransformationSourceOptionsgetSourceOptionsList()
Gets the immutable list of source options further describing how the source should be transformed based on its mimetype. Use addSourceOptions(TransformationSourceOptions) to add source options.
Returns:
the source options list

setSourceOptionsList
public void setSourceOptionsList(Collection<TransformationSourceOptions> sourceOptionsList)
Sets the list of source options further describing how the source should be transformed based on its mimetype.
Parameters:
sourceOptionsList - the source options list

addSourceOptions
public void addSourceOptions(TransformationSourceOptions sourceOptions)
Adds the given sourceOptions to the sourceOptionsMap.

Note that if source options of the same class already exists a new merged source options object is added.

Parameters:
sourceOptions - TransformationSourceOptions

getSourceOptions
public <T extends TransformationSourceOptions> T getSourceOptions(Class<T> clazz)
Gets the appropriate source options for the given mimetype if available.
Parameters:
clazz - Class
Returns:
the source options for the mimetype

toMap
public Map<String,ObjecttoMap()
Convert the transformation options into a map.

Basic options (optional) are:

Override this method to append option values to the map. Derived classes should call the base class before appending further values and returning the result.


toString
public String toString(boolean includeLimits)

toString
public String toString()
Overrides:
toString in class Object

hashCode
public int hashCode()
Overrides:
hashCode in class Object

equals
public boolean equals(Object obj)
Overrides:
equals in class Object

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.