magoffin.matt.ma2.biz
Interface MediaBiz

All Known Implementing Classes:
MediaBizImpl

public interface MediaBiz

API for media item actions.

Version:
$Revision: 43 $ $Date: 2007-10-21 11:10:01 +1300 (Sun, 21 Oct 2007) $
Author:
matt.magoffin

Method Summary
 int addMediaItemsToAlbum(Album album, java.lang.Long[] mediaItemIds, BizContext context)
          Add a set of media items to an album.
 Album deleteAlbum(java.lang.Long albumId, BizContext context)
          Delete an album, and any nested albums.
 java.util.List<MediaItem> deleteCollectionAndItems(java.lang.Long collectionId, BizContext context)
          Delete a Collection and physically delete the media items in the collection.
 int deleteMediaItems(java.lang.Long[] itemIds, BizContext context)
          Physically delete media items.
 Album getAlbum(java.lang.Long albumId, BizContext context)
          Get an Album.
 Album getAlbumParent(java.lang.Long childAlbumId, BizContext context)
          Get the parent of an album, if one exists.
 java.util.List<KeyNameType> getAlbumSortTypes(BizContext context)
          Get the list of support album sort types.
 Album getAlbumWithItems(java.lang.Long albumId, BizContext context)
          Get an Album along with the MediaItems of that album.
 Collection getCollectionWithItems(java.lang.Long collectionId, BizContext context)
          Get a Collection along with the MediaItems of that collection.
 Geometry getGeometry(MediaSize size)
          Get a geometry for a given size.
 MediaHandler getMediaHandler(java.io.File file)
          Get a MediaHandler instance for a given file.
 MediaHandler getMediaHandler(java.lang.String mime)
          Get a MediaHandler instance for a given MIME type.
 Collection getMediaItemCollection(MediaItem item)
          Get the Collection for a given MediaItem.
 org.springframework.core.io.Resource getMediaItemResource(MediaItem item)
          Get a Resource for a given MediaItem.
 java.util.List<MediaItem> getMediaItemsForAlbum(Album album, BizContext context)
          Get all MediaItems that belong to a given Album.
 java.util.List<MediaItem> getMediaItemsForCollection(Collection collection, BizContext context)
          Get all MediaItems that belong to a given Collection.
 MediaItem getMediaItemWithInfo(java.lang.Long itemId, BizContext context)
          Get a MediaItem along with the meta data and other info populated.
 float getQualityValue(MediaQuality quality)
          Get a quality value, where the value ranges from 0.0 to 1.0 and 1.0 represents the hightest quality possible.
 Geometry getScaledGeometry(MediaItem item, MediaRequest request)
          Creates a Geometry scaled to the desired MediaSize set on the request.
 Album getSharedAlbum(java.lang.String key, BizContext context)
          Get a shared album.
 int incrementMediaItemHits(java.lang.Long itemId)
          Increment the hits value for a particular MediaItem object and return the incremented value.
 boolean isFileSupported(java.io.File file)
          Return true if a file is supported by some configured MediaHandler.
 void moveMediaItems(MoveItemsCommand command, BizContext context)
          Move a set of media items from the collection they currently are in to a different collection.
 int removeMediaItemsFromAlbum(java.lang.Long albumId, java.lang.Long[] itemIds, BizContext context)
          Remove a list of item IDs from an Album.
 java.lang.String shareAlbum(ShareAlbumCommand command, BizContext context)
          Share an album.
 void sortAlbumItems(Album album)
          Sort the media items within an album based on the Albums' sort mode.
 java.lang.Long storeAlbum(Album album, BizContext context)
          Store an Album.
 void storeAlbumOrdering(SortAlbumsCommand command, BizContext context)
          Set the ording for the child albums of an album.
 void storeAlbumParent(java.lang.Long childAlbumId, java.lang.Long parentAlbumId, BizContext context)
          Make an album a child of another album.
 void storeMediaItemInfo(MediaInfoCommand command, BizContext context)
          Store info for media items.
 void storeMediaItemOrdering(SortMediaItemsCommand command, BizContext context)
          Set the ording for the media items of an album.
 void storeMediaItemPoster(java.lang.Long itemId, java.lang.Long albumId, BizContext context)
          Store the poster item for an album.
 void storeMediaItemRating(java.lang.Long[] itemIds, short rating, BizContext context)
          Set the rating for a media item.
 void storeMediaItemUserComment(UserCommentCommand command, BizContext context)
          Add a new UserComment to a MediaItem.
 void unShareAlbum(java.lang.Long albumId, BizContext context)
          Unshare an album.
 

Method Detail

isFileSupported

boolean isFileSupported(java.io.File file)
Return true if a file is supported by some configured MediaHandler.

Parameters:
file - the file
Returns:
boolean

getMediaHandler

MediaHandler getMediaHandler(java.io.File file)
Get a MediaHandler instance for a given file.

Parameters:
file - the file
Returns:
MediaHandler instance
Throws:
java.lang.IllegalArgumentException - if the file is not supported

getMediaHandler

MediaHandler getMediaHandler(java.lang.String mime)
Get a MediaHandler instance for a given MIME type.

Parameters:
mime - the MIME type
Returns:
MediaHandler instance
Throws:
java.lang.IllegalArgumentException - if the file is not supported

getMediaItemCollection

Collection getMediaItemCollection(MediaItem item)
Get the Collection for a given MediaItem.

Parameters:
item - the item
Returns:
the Collection

getMediaItemsForCollection

java.util.List<MediaItem> getMediaItemsForCollection(Collection collection,
                                                     BizContext context)
Get all MediaItems that belong to a given Collection.

Parameters:
collection - the Collection
context - the current context
Returns:
the list of items

getCollectionWithItems

Collection getCollectionWithItems(java.lang.Long collectionId,
                                  BizContext context)
Get a Collection along with the MediaItems of that collection.

Parameters:
collectionId - the ID of the Collection to get
context - the current context
Returns:
the Collection

getAlbumWithItems

Album getAlbumWithItems(java.lang.Long albumId,
                        BizContext context)
Get an Album along with the MediaItems of that album.

Parameters:
albumId - the ID of the Album to get
context - the current context
Returns:
the Album

getMediaItemWithInfo

MediaItem getMediaItemWithInfo(java.lang.Long itemId,
                               BizContext context)
Get a MediaItem along with the meta data and other info populated.

Parameters:
itemId - the ID of the item to get
context - the current context
Returns:
the MediaItem

storeMediaItemRating

void storeMediaItemRating(java.lang.Long[] itemIds,
                          short rating,
                          BizContext context)
Set the rating for a media item.

Parameters:
itemIds - the IDs of the items to set the rating for
rating - the rating to set
context - the current context

storeMediaItemInfo

void storeMediaItemInfo(MediaInfoCommand command,
                        BizContext context)
Store info for media items.

Parameters:
command - the command data
context - the current context

storeMediaItemPoster

void storeMediaItemPoster(java.lang.Long itemId,
                          java.lang.Long albumId,
                          BizContext context)
Store the poster item for an album.

Parameters:
itemId - the ID of the item to use as the poster
albumId - the ID of the album to set the poster for
context - the current context

deleteCollectionAndItems

java.util.List<MediaItem> deleteCollectionAndItems(java.lang.Long collectionId,
                                                   BizContext context)
Delete a Collection and physically delete the media items in the collection.

Parameters:
collectionId - the ID of the collection to delete
context - the current context
Returns:
the media items deleted

moveMediaItems

void moveMediaItems(MoveItemsCommand command,
                    BizContext context)
Move a set of media items from the collection they currently are in to a different collection.

Parameters:
command - the command object
context - the current context

deleteAlbum

Album deleteAlbum(java.lang.Long albumId,
                  BizContext context)
Delete an album, and any nested albums.

Parameters:
albumId - the ID of the album to delete
context - the current context
Returns:
the deleted album, or null if the album was not found

removeMediaItemsFromAlbum

int removeMediaItemsFromAlbum(java.lang.Long albumId,
                              java.lang.Long[] itemIds,
                              BizContext context)
Remove a list of item IDs from an Album.

Parameters:
albumId - the ID of the album to remove the items from
itemIds - the IDs of the items to remove
context - the current context
Returns:
the number of items removed

deleteMediaItems

int deleteMediaItems(java.lang.Long[] itemIds,
                     BizContext context)
Physically delete media items.

Parameters:
itemIds - the media item IDs to delete
context - the current context
Returns:
the number of items deleted

getMediaItemsForAlbum

java.util.List<MediaItem> getMediaItemsForAlbum(Album album,
                                                BizContext context)
Get all MediaItems that belong to a given Album.

Parameters:
album - the Album
context - the current context
Returns:
the list of items

getMediaItemResource

org.springframework.core.io.Resource getMediaItemResource(MediaItem item)
Get a Resource for a given MediaItem.

Parameters:
item - the item
Returns:
the Resource

getGeometry

Geometry getGeometry(MediaSize size)
Get a geometry for a given size.

Parameters:
size - the size
Returns:
the geometry

getQualityValue

float getQualityValue(MediaQuality quality)
Get a quality value, where the value ranges from 0.0 to 1.0 and 1.0 represents the hightest quality possible.

Parameters:
quality - the quality
Returns:
the quality value

getScaledGeometry

Geometry getScaledGeometry(MediaItem item,
                           MediaRequest request)
Creates a Geometry scaled to the desired MediaSize set on the request.

Parameters:
item - the media item for the current request
request - the current request
Returns:
the scaled Geometry

addMediaItemsToAlbum

int addMediaItemsToAlbum(Album album,
                         java.lang.Long[] mediaItemIds,
                         BizContext context)
Add a set of media items to an album.

Parameters:
album - the album
mediaItemIds - the IDs of the media items to add
context - the context
Returns:
the number of items added to the album

sortAlbumItems

void sortAlbumItems(Album album)
Sort the media items within an album based on the Albums' sort mode.

Parameters:
album - the album to sort

shareAlbum

java.lang.String shareAlbum(ShareAlbumCommand command,
                            BizContext context)
Share an album.

Parameters:
command - the share album command
context - the context
Returns:
the anonymous key used to view the shared album

unShareAlbum

void unShareAlbum(java.lang.Long albumId,
                  BizContext context)
Unshare an album.

Parameters:
albumId - the ID of the album to unshare
context - the context

getSharedAlbum

Album getSharedAlbum(java.lang.String key,
                     BizContext context)
Get a shared album.

Parameters:
key - the anonymous key of the album
context - the context
Returns:
the album

getAlbum

Album getAlbum(java.lang.Long albumId,
               BizContext context)
Get an Album.

The Album may not have any MediaItem instances populated in it. Use the getAlbumWithItems(Long, BizContext) method to get an Album with its items at the same time.

Parameters:
albumId - the ID of the Album to get
context - the context
Returns:
the Album

getAlbumParent

Album getAlbumParent(java.lang.Long childAlbumId,
                     BizContext context)
Get the parent of an album, if one exists.

Parameters:
childAlbumId - the ID of the child album to get the parent of
context - the context
Returns:
the parent album, or null if album has no parent

storeAlbum

java.lang.Long storeAlbum(Album album,
                          BizContext context)
Store an Album.

This method will accept new albums as well as updates to existing albums.

Parameters:
album - the Album to store
context - the context
Returns:
the ID of the saved album

storeAlbumParent

void storeAlbumParent(java.lang.Long childAlbumId,
                      java.lang.Long parentAlbumId,
                      BizContext context)
Make an album a child of another album.

If parentAlbumId is null then the album for childAlbumId should be made a top-level album.

Parameters:
childAlbumId - the ID of the child album
parentAlbumId - the ID of the parent album
context - the context

storeAlbumOrdering

void storeAlbumOrdering(SortAlbumsCommand command,
                        BizContext context)
Set the ording for the child albums of an album.

Parameters:
command - the sort command
context - the context

storeMediaItemOrdering

void storeMediaItemOrdering(SortMediaItemsCommand command,
                            BizContext context)
Set the ording for the media items of an album.

Parameters:
command - the sort command
context - the context

storeMediaItemUserComment

void storeMediaItemUserComment(UserCommentCommand command,
                               BizContext context)
Add a new UserComment to a MediaItem.

Parameters:
command - user comment command
context - the context

incrementMediaItemHits

int incrementMediaItemHits(java.lang.Long itemId)
Increment the hits value for a particular MediaItem object and return the incremented value.

Parameters:
itemId - the ID of the item to increment
Returns:
the incremented value

getAlbumSortTypes

java.util.List<KeyNameType> getAlbumSortTypes(BizContext context)
Get the list of support album sort types.

This is to allow the available sort types to be displayed on the front-end.

Parameters:
context - the context
Returns:
list of sort types (never null)