mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-16201 TransformationOptions Should Be More Easily Extended
- protected clone() method added. - public deepCopy() method added. - ThumbnailRegistry now calls deepCopy(). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42450 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -263,7 +263,7 @@ public class ThumbnailRegistry implements ApplicationContextAware, ApplicationLi
|
||||
public boolean isThumbnailDefinitionAvailable(String sourceUrl, String sourceMimetype, long sourceSize, NodeRef sourceNodeRef, ThumbnailDefinition thumbnailDefinition)
|
||||
{
|
||||
// Copy the thumbnail's TransformationOptions and set the sourceNodeRef, for use by transformers and debug.
|
||||
TransformationOptions options = new TransformationOptions(thumbnailDefinition.getTransformationOptions());
|
||||
TransformationOptions options = thumbnailDefinition.getTransformationOptions().deepCopy();
|
||||
options.setSourceNodeRef(sourceNodeRef);
|
||||
|
||||
// Log the following getTransform() as trace so we can see the wood for the trees
|
||||
|
@@ -35,7 +35,7 @@ import org.alfresco.service.namespace.QName;
|
||||
* @author Roy Wetherall
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public class TransformationOptions
|
||||
public class TransformationOptions implements Cloneable
|
||||
{
|
||||
/** Option map names to preserve backward compatibility */
|
||||
public static final String OPT_SOURCE_NODEREF = "contentReaderNodeRef";
|
||||
@@ -106,6 +106,28 @@ public class TransformationOptions
|
||||
set(optionsMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TransformationOptions clone() throws CloneNotSupportedException
|
||||
{
|
||||
TransformationOptions clone = (TransformationOptions) super.clone();
|
||||
clone.limits = new TransformationOptionLimits();
|
||||
clone.set(toMap());
|
||||
return clone;
|
||||
}
|
||||
|
||||
public TransformationOptions deepCopy()
|
||||
{
|
||||
try
|
||||
{
|
||||
return clone();
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
// Not thrown
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets options from the supplied map.
|
||||
* @param optionsMap
|
||||
|
Reference in New Issue
Block a user