org.alfresco.repo.thumbnail
Class ThumbnailServiceImpl

java.lang.Object
  extended by org.alfresco.repo.thumbnail.ThumbnailServiceImpl
All Implemented Interfaces:
NodeServicePolicies.BeforeCreateNodePolicy, NodeServicePolicies.OnCreateNodePolicy, ClassPolicy, Policy, ThumbnailService

public class ThumbnailServiceImpl
extends java.lang.Object
implements ThumbnailService, NodeServicePolicies.BeforeCreateNodePolicy, NodeServicePolicies.OnCreateNodePolicy


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.alfresco.repo.policy.Policy
Policy.Arg
 
Field Summary
 
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodePolicy
QNAME
 
Fields inherited from interface org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy
QNAME
 
Fields inherited from interface org.alfresco.repo.policy.Policy
NAMESPACE
 
Constructor Summary
ThumbnailServiceImpl()
           
 
Method Summary
 void beforeCreateNode(org.alfresco.service.cmr.repository.NodeRef parentRef, org.alfresco.service.namespace.QName assocTypeQName, org.alfresco.service.namespace.QName assocQName, org.alfresco.service.namespace.QName nodeTypeQName)
          Called before a new node is created.
 org.alfresco.service.cmr.repository.NodeRef createThumbnail(org.alfresco.service.cmr.repository.NodeRef node, org.alfresco.service.namespace.QName contentProperty, java.lang.String mimetype, TransformationOptions transformationOptions, java.lang.String thumbnailName)
          Creates a new thumbnail for the given node and content property.
 org.alfresco.service.cmr.repository.NodeRef createThumbnail(org.alfresco.service.cmr.repository.NodeRef node, org.alfresco.service.namespace.QName contentProperty, java.lang.String mimetype, TransformationOptions transformationOptions, java.lang.String thumbnailName, ThumbnailParentAssociationDetails assocDetails)
           
 java.util.Map getFailedThumbnails(org.alfresco.service.cmr.repository.NodeRef sourceNode)
          This method returns a Map of failed thumbnails for the specified source node.
 org.alfresco.service.cmr.repository.NodeRef getThumbnailByName(org.alfresco.service.cmr.repository.NodeRef node, org.alfresco.service.namespace.QName contentProperty, java.lang.String thumbnailName)
          Gets the thumbnail for a given content property with a given name.
 org.alfresco.service.cmr.repository.NodeRef getThumbnailNode(org.alfresco.service.cmr.repository.ChildAssociationRef thumbnailRef)
          This method returns the NodeRef for the thumbnail, using the ChildAssociationRef that links the sourceNode to its associated Thumbnail node.
 ThumbnailRegistry getThumbnailRegistry()
          Gets the thumbnail registry
 java.util.List getThumbnails(org.alfresco.service.cmr.repository.NodeRef node, org.alfresco.service.namespace.QName contentProperty, java.lang.String mimetype, TransformationOptions options)
          Gets a list of thumbnail nodes for a given content property that match the provided mimetype and transformation options.
 void init()
          Registers to listen for events of interest.
 void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssoc)
          Called when a new node has been created.
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
          Set the node service
 void setPolicyComponent(PolicyComponent policyComponent)
          Set the policy component to listen for various events
 void setRenditionService(RenditionService renditionService)
          Set the rendition service.
 void setThumbnailRegistry(ThumbnailRegistry thumbnailRegistry)
          Set thumbnail registry
 void updateThumbnail(org.alfresco.service.cmr.repository.NodeRef thumbnail, TransformationOptions transformationOptions)
          Updates the content of a thumbnail.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThumbnailServiceImpl

public ThumbnailServiceImpl()
Method Detail

setRenditionService

public void setRenditionService(RenditionService renditionService)
Set the rendition service.

Parameters:
renditionService -

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Set the node service

Parameters:
nodeService - node service

setThumbnailRegistry

public void setThumbnailRegistry(ThumbnailRegistry thumbnailRegistry)
Set thumbnail registry

Parameters:
thumbnailRegistry - thumbnail registry

setPolicyComponent

public void setPolicyComponent(PolicyComponent policyComponent)
Set the policy component to listen for various events

Since:
3.5.0

init

public void init()
Registers to listen for events of interest.

Since:
3.5.0

beforeCreateNode

public void beforeCreateNode(org.alfresco.service.cmr.repository.NodeRef parentRef,
                             org.alfresco.service.namespace.QName assocTypeQName,
                             org.alfresco.service.namespace.QName assocQName,
                             org.alfresco.service.namespace.QName nodeTypeQName)
Description copied from interface: NodeServicePolicies.BeforeCreateNodePolicy
Called before a new node is created.

Specified by:
beforeCreateNode in interface NodeServicePolicies.BeforeCreateNodePolicy
Parameters:
parentRef - the parent node reference
assocTypeQName - the association type qualified name
assocQName - the association qualified name
nodeTypeQName - the node type qualified name

onCreateNode

public void onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef childAssoc)
Description copied from interface: NodeServicePolicies.OnCreateNodePolicy
Called when a new node has been created.

Specified by:
onCreateNode in interface NodeServicePolicies.OnCreateNodePolicy
Parameters:
childAssoc - the created child association reference

getThumbnailRegistry

public ThumbnailRegistry getThumbnailRegistry()
Description copied from interface: ThumbnailService
Gets the thumbnail registry

Specified by:
getThumbnailRegistry in interface ThumbnailService
Returns:
ThumbnailRegistry thumbnail registry
See Also:
ThumbnailService.getThumbnailRegistry()

createThumbnail

public org.alfresco.service.cmr.repository.NodeRef createThumbnail(org.alfresco.service.cmr.repository.NodeRef node,
                                                                   org.alfresco.service.namespace.QName contentProperty,
                                                                   java.lang.String mimetype,
                                                                   TransformationOptions transformationOptions,
                                                                   java.lang.String thumbnailName)
Description copied from interface: ThumbnailService
Creates a new thumbnail for the given node and content property. The mimetype and transformation options are used to determine the content transformer that will be best suited to create the thumbnail. The thumbnail name is optional, but is usually set to provide an easy way to identify a particular 'type' of thumbnail. Once created the source node will have the 'rn:renditioned' aspect applied and an association to the thumbnail node (of type 'rn:rendition') will be created. The returned node reference is to the 'rn:rendition' content node that contains the thumbnail content in the standard 'cm:content' property.

Specified by:
createThumbnail in interface ThumbnailService
Parameters:
node - the source content node
contentProperty - the content property
mimetype - the thumbnail mimetype
transformationOptions - the thumbnail transformation options
thumbnailName - the name of the thumbnail (optional, pass null for unnamed thumbnail)
Returns:
NodeRef node reference to the newly created thumbnail
See Also:
ThumbnailService.createThumbnail(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions, java.lang.String)

createThumbnail

public org.alfresco.service.cmr.repository.NodeRef createThumbnail(org.alfresco.service.cmr.repository.NodeRef node,
                                                                   org.alfresco.service.namespace.QName contentProperty,
                                                                   java.lang.String mimetype,
                                                                   TransformationOptions transformationOptions,
                                                                   java.lang.String thumbnailName,
                                                                   ThumbnailParentAssociationDetails assocDetails)
Specified by:
createThumbnail in interface ThumbnailService
Parameters:
node - the source content node
contentProperty - the content property
mimetype - the thumbnail mimetype
transformationOptions - the thumbnail transformation options
thumbnailName - the name of the thumbnail (optional, pass null for unnamed thumbnail)
assocDetails - the thumbnail parent association details
Returns:
NodeRef node reference to the newly created thumbnail
See Also:
ThumbnailService.createThumbnail(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions, java.lang.String, org.alfresco.service.cmr.thumbnail.ThumbnailParentAssociationDetails)

getThumbnailNode

public org.alfresco.service.cmr.repository.NodeRef getThumbnailNode(org.alfresco.service.cmr.repository.ChildAssociationRef thumbnailRef)
This method returns the NodeRef for the thumbnail, using the ChildAssociationRef that links the sourceNode to its associated Thumbnail node.

Parameters:
thumbnailRef - the ChildAssociationRef containing the child NodeRef.
Returns:
the NodeRef of the thumbnail itself.

updateThumbnail

public void updateThumbnail(org.alfresco.service.cmr.repository.NodeRef thumbnail,
                            TransformationOptions transformationOptions)
Description copied from interface: ThumbnailService
Updates the content of a thumbnail. The original thumbnail content is updated from the source content using the transformation options provided. The mimetype and name of the thumbnail remain unchanged. To change the name or mimetype of an updated thumbnail it should be deleted and recreated. An error is raised if the original content no longer exists.

Specified by:
updateThumbnail in interface ThumbnailService
Parameters:
thumbnail - the thumbnail node
transformationOptions - the transformation options used when updating the thumbnail
See Also:
ThumbnailService.updateThumbnail(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.TransformationOptions)

getThumbnailByName

public org.alfresco.service.cmr.repository.NodeRef getThumbnailByName(org.alfresco.service.cmr.repository.NodeRef node,
                                                                      org.alfresco.service.namespace.QName contentProperty,
                                                                      java.lang.String thumbnailName)
Description copied from interface: ThumbnailService
Gets the thumbnail for a given content property with a given name. Returns null if no thumbnail with that name for that content property is found.

Specified by:
getThumbnailByName in interface ThumbnailService
Parameters:
node - node reference
contentProperty - content property name
thumbnailName - thumbnail name
Returns:
NodeRef the thumbnail node reference, null if not found
See Also:
ThumbnailService.getThumbnailByName(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.lang.String)

getThumbnails

public java.util.List getThumbnails(org.alfresco.service.cmr.repository.NodeRef node,
                                    org.alfresco.service.namespace.QName contentProperty,
                                    java.lang.String mimetype,
                                    TransformationOptions options)
Description copied from interface: ThumbnailService
Gets a list of thumbnail nodes for a given content property that match the provided mimetype and transformation options. Both mimetype and transformation options are optional parameters. If only one or other is specified the only the other is considered during. If neither are provided all thumbnails for that content property are returned. If no matches are found then an empty list is returned.

Specified by:
getThumbnails in interface ThumbnailService
Parameters:
node - node reference
contentProperty - content property name
mimetype - mimetype
options - transformation options
Returns:
List list of matching thumbnail node references, empty if no matches found
See Also:
ThumbnailService.getThumbnails(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions)

getFailedThumbnails

public java.util.Map getFailedThumbnails(org.alfresco.service.cmr.repository.NodeRef sourceNode)
Description copied from interface: ThumbnailService
This method returns a Map of failed thumbnails for the specified source node. The map is keyed by thumbnail definition name and the values are the failed thumbnails.

Specified by:
getFailedThumbnails in interface ThumbnailService
Parameters:
sourceNode - the node whose thumbnails are to be checked.
Returns:
a Map of failed thumbnails, if any. If there are no such failures, an empty Map will be returned.


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.