Draft example using API template

From AlfrescoWiki

Jump to: navigation, search

Example of using the API template with the 3.0 Thumbnail Service.


Link to the template for API References.

Contents

[edit] Introduction

The Alfresco Thumbnail Service API provides developers with programmatic access to thumbnail images for the home pages of web sites.

The Alfresco Thumbnail Service API allows script writers to develop enhanced web sites, search results, web directories, blog entries, and other web real estate with thumbnail images.

Using the API, script writers can:

  • Improve the user experience by allowing end users to preview sites before clicking on the thumbnail's associated link.
  • another business example

Provide other references (external and internal)...

These interfaces and classes make up the fundamental Thumbnail Service API.

[edit] Package: com.alfresco.cmr.thumbnail

Interface: ThumbnailService

Description: Thumbnail service API to create, update and retrieve thumbnails.

[edit] Methods Summary

Interface MethodsDescription
createThumbnail(NodeRef node, QName contentProperty, CreateOptions createOptions)Creates a new thumbnail for the given node and content property.
updateThumbnail(NodeRef thumbnail)Updates the content of a thumbnail.
getThumbnailByName(NodeRef node, QName contentProperty, String thumbnailName)Gets the thumbnail for a given content property with a given name.
getThumbnails(NodeRef node, QName contentProperty, String mimetype, TransformationOptions options)Gets a list of thumbnail nodes for a given content property that match the provided mimetype and transformation options.

[edit] createThumbnail(NodeRef node, QName contentProperty, CreateOptions createOptions)

Low-level description. The passed create options specify the details of the thumbnail, including the mime type, size, and location of the thumbnail. Once created, the source node will have the tn:thumbnailed aspect applied and an association to the thumbnail node (or type tn:thumbnail) will be created.

The returned node reference is to the tn:thumbnail content node that contains the thumnail content in the standard cm:content property.

[edit] Parameters

node
The source content node.
contentProperty
The content property.
createOptions
The create options.

[edit] Return values

Return value
List all possible return values and meaning.
NodeRef
node reference to the newly created thumbnail

[edit] Exceptions

Exception
List all exceptions thrown.

[edit] Comments

Comment
Additional information.

[edit] See also

Other methods
List of related methods.

[edit] updateThumbnail(NodeRef thumbnail)

Low-level description. The original creation options are used when updating the thumbnail. The content of the associated thumbnailed node is used to update. An error is raised if the original content no longer exists.

[edit] Parameters

thumbnail
The thumbnail node.

[edit] Return values

There are no return values.

[edit] Exceptions

Exception
List all exceptions thrown.

[edit] Comments

Comment
Additional information.

[edit] See also

Other methods
List of related methods.

[edit] getThumbnailByName(NodeRef node, QName contentProperty, String thumbnailName)

Low-level description. 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.

[edit] Parameters

thumbnail
The node reference.
contentProperty
The content property name.
thumbnailName
The thumbnail name.

[edit] Return values

Return value
List all possible return values and meaning.
NodeRef:the thumbnail node reference, null if not found

[edit] Exceptions

Exception
List all exceptions thrown.

[edit] Comments

Comment
Additional information.

[edit] See also

Other methods
List of related methods.

[edit] getThumbnails(NodeRef node, QName contentProperty, String mimetype, TransformationOptions options)

Low-level description. 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.

[edit] Parameters

node
node reference
contentProperty
content property name
mimetype
mimetype
options
transformation options

[edit] Return values

Return value
List all possible return values and meaning.
List<NodeRef>
list of matching thumbnail node references, empty if no matches found

[edit] Exceptions

Exception
List all exceptions thrown.

[edit] Comments

Comment
Additional information.

[edit] See also

Other methods
List of related methods.

[edit] Package: com.alfresco.cmr.thumbnail

Type: CreateOptions

Description: Provides the thumbnail create options to the thumbnail service

[edit] Methods Summary

Interface MethodsDescription
createThumbnail(NodeRef node, QName contentProperty, CreateOptions createOptions)Creates a new thumbnail for the given node and content property.
updateThumbnail(NodeRef thumbnail)Updates the content of a thumbnail.
getThumbnailByName(NodeRef node, QName contentProperty, String thumbnailName)Gets the thumbnail for a given content property with a given name.
getThumbnails(NodeRef node, QName contentProperty, String mimetype, TransformationOptions options)Gets a list of thumbnail nodes for a given content property that match the provided mimetype and transformation options.