|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.ma2.biz.impl.MediaBizImpl
public class MediaBizImpl
Default implementation of MediaBiz.
The configurable properties of this class are:
MediaHandler
that should be used for files with matching extensions.MediaHandler
that should be used for media items with matching MIME types.MediaItemSorter
class will be
used by default. For each sort key defined (either via this map
or via the MediaItemSorter.SortMode
keys) two message
properties will be looked up during a call to the
getAlbumSortTypes(BizContext)
method. The first will be
like album.sortmode.<KEY>.name
, where
<KEY>
is the sort key. This will be used for
the display name of this sort mode. The second message will be like
album.sortmode.<KEY>.caption
and will be
used as the optional caption for the sort mode.
Constructor Summary | |
---|---|
MediaBizImpl()
|
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. |
void |
finish()
Call to clean up resources as necessary. |
Album |
getAlbum(java.lang.Long albumId,
BizContext context)
Get an Album. |
AlbumDao |
getAlbumDao()
|
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. |
CollectionDao |
getCollectionDao()
|
Collection |
getCollectionWithItems(java.lang.Long collectionId,
BizContext context)
Get a Collection along with the MediaItems of that collection. |
DomainObjectFactory |
getDomainObjectFactory()
|
Geometry |
getGeometry(MediaSize size)
Get a geometry for a given size. |
java.util.EnumMap<MediaSize,Geometry> |
getGeometryMap()
|
IOBiz |
getIoBiz()
|
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. |
java.util.Map<java.lang.String,MediaHandler> |
getMediaHandlerFileExtensionMap()
|
java.util.Map<java.lang.String,MediaHandler> |
getMediaHandlerMimeMap()
|
Collection |
getMediaItemCollection(MediaItem item)
Get the Collection for a given MediaItem. |
MediaItemDao |
getMediaItemDao()
|
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. |
org.springframework.context.MessageSource |
getMessages()
|
java.util.EnumMap<MediaQuality,java.lang.Float> |
getQualityMap()
|
float |
getQualityValue(MediaQuality quality)
Get a quality value, where the value ranges from 0.0 to |
byte[] |
getSalt()
|
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. |
SystemBiz |
getSystemBiz()
|
UserBiz |
getUserBiz()
|
int |
incrementMediaItemHits(java.lang.Long itemId)
Increment the hits value for a particular MediaItem object and return the incremented value. |
void |
init()
Call to initialize after peroprties have been set. |
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. |
void |
setAlbumDao(AlbumDao albumDao)
|
void |
setCollectionDao(CollectionDao collectionDao)
|
void |
setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
|
void |
setGeometryMap(java.util.EnumMap<MediaSize,Geometry> geometryMap)
|
void |
setIoBiz(IOBiz ioBiz)
|
void |
setMediaHandlerFileExtensionMap(java.util.Map<java.lang.String,MediaHandler> fileExtensionMap)
|
void |
setMediaHandlerMimeMap(java.util.Map<java.lang.String,MediaHandler> mediaHandlerMimeMap)
|
void |
setMediaItemDao(MediaItemDao mediaItemDao)
|
void |
setMessages(org.springframework.context.MessageSource messages)
|
void |
setQualityMap(java.util.EnumMap<MediaQuality,java.lang.Float> qualityMap)
|
void |
setSalt(byte[] salt)
|
void |
setSystemBiz(SystemBiz systemBiz)
|
void |
setUserBiz(UserBiz userBiz)
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MediaBizImpl()
Method Detail |
---|
public void init()
public void finish()
public boolean isFileSupported(java.io.File file)
MediaBiz
MediaHandler
.
isFileSupported
in interface MediaBiz
file
- the file
public MediaHandler getMediaHandler(java.io.File file)
MediaBiz
getMediaHandler
in interface MediaBiz
file
- the file
public MediaHandler getMediaHandler(java.lang.String mime)
MediaBiz
getMediaHandler
in interface MediaBiz
mime
- the MIME type
public Geometry getGeometry(MediaSize size)
MediaBiz
getGeometry
in interface MediaBiz
size
- the size
public float getQualityValue(MediaQuality quality)
MediaBiz
getQualityValue
in interface MediaBiz
quality
- the quality
public void storeMediaItemRating(java.lang.Long[] itemIds, short rating, BizContext context)
MediaBiz
storeMediaItemRating
in interface MediaBiz
itemIds
- the IDs of the items to set the rating forrating
- the rating to setcontext
- the current contextpublic void storeMediaItemPoster(java.lang.Long itemId, java.lang.Long albumId, BizContext context)
MediaBiz
storeMediaItemPoster
in interface MediaBiz
itemId
- the ID of the item to use as the posteralbumId
- the ID of the album to set the poster forcontext
- the current contextpublic org.springframework.core.io.Resource getMediaItemResource(MediaItem item)
MediaBiz
getMediaItemResource
in interface MediaBiz
item
- the item
public Collection getMediaItemCollection(MediaItem item)
MediaBiz
getMediaItemCollection
in interface MediaBiz
item
- the item
public java.util.List<MediaItem> getMediaItemsForCollection(Collection collection, BizContext context)
MediaBiz
getMediaItemsForCollection
in interface MediaBiz
collection
- the Collectioncontext
- the current context
public java.util.List<MediaItem> getMediaItemsForAlbum(Album album, BizContext context)
MediaBiz
getMediaItemsForAlbum
in interface MediaBiz
album
- the Albumcontext
- the current context
public void sortAlbumItems(Album album)
MediaBiz
sortAlbumItems
in interface MediaBiz
album
- the album to sortpublic void storeMediaItemOrdering(SortMediaItemsCommand command, BizContext context)
MediaBiz
storeMediaItemOrdering
in interface MediaBiz
command
- the sort commandcontext
- the contextpublic int addMediaItemsToAlbum(Album album, java.lang.Long[] mediaItemIds, BizContext context)
MediaBiz
addMediaItemsToAlbum
in interface MediaBiz
album
- the albummediaItemIds
- the IDs of the media items to addcontext
- the context
public java.util.List<MediaItem> deleteCollectionAndItems(java.lang.Long collectionId, BizContext context)
MediaBiz
deleteCollectionAndItems
in interface MediaBiz
collectionId
- the ID of the collection to deletecontext
- the current context
public Geometry getScaledGeometry(MediaItem item, MediaRequest request)
MediaBiz
MediaSize
set on the request.
getScaledGeometry
in interface MediaBiz
item
- the media item for the current requestrequest
- the current request
public Album getAlbumWithItems(java.lang.Long albumId, BizContext context)
MediaBiz
getAlbumWithItems
in interface MediaBiz
albumId
- the ID of the Album to getcontext
- the current context
public Album getAlbum(java.lang.Long albumId, BizContext context)
MediaBiz
The Album may not have any MediaItem instances populated
in it. Use the MediaBiz.getAlbumWithItems(Long, BizContext)
method to get an Album with its items at the same time.
getAlbum
in interface MediaBiz
albumId
- the ID of the Album to getcontext
- the context
public MediaItem getMediaItemWithInfo(java.lang.Long itemId, BizContext context)
MediaBiz
getMediaItemWithInfo
in interface MediaBiz
itemId
- the ID of the item to getcontext
- the current context
public Collection getCollectionWithItems(java.lang.Long collectionId, BizContext context)
MediaBiz
getCollectionWithItems
in interface MediaBiz
collectionId
- the ID of the Collection to getcontext
- the current context
public int removeMediaItemsFromAlbum(java.lang.Long albumId, java.lang.Long[] itemIds, BizContext context)
MediaBiz
removeMediaItemsFromAlbum
in interface MediaBiz
albumId
- the ID of the album to remove the items fromitemIds
- the IDs of the items to removecontext
- the current context
public int deleteMediaItems(java.lang.Long[] itemIds, BizContext context)
MediaBiz
deleteMediaItems
in interface MediaBiz
itemIds
- the media item IDs to deletecontext
- the current context
public java.lang.String shareAlbum(ShareAlbumCommand command, BizContext context)
MediaBiz
shareAlbum
in interface MediaBiz
command
- the share album commandcontext
- the context
public Album getSharedAlbum(java.lang.String key, BizContext context)
MediaBiz
getSharedAlbum
in interface MediaBiz
key
- the anonymous key of the albumcontext
- the context
public void unShareAlbum(java.lang.Long albumId, BizContext context)
MediaBiz
unShareAlbum
in interface MediaBiz
albumId
- the ID of the album to unsharecontext
- the contextpublic int incrementMediaItemHits(java.lang.Long itemId)
MediaBiz
incrementMediaItemHits
in interface MediaBiz
itemId
- the ID of the item to increment
public Album getAlbumParent(java.lang.Long childAlbumId, BizContext context)
MediaBiz
getAlbumParent
in interface MediaBiz
childAlbumId
- the ID of the child album to get the parent ofcontext
- the context
public void storeAlbumParent(java.lang.Long childAlbumId, java.lang.Long parentAlbumId, BizContext context)
MediaBiz
If parentAlbumId
is null then the album
for childAlbumId
should be made a top-level album.
storeAlbumParent
in interface MediaBiz
childAlbumId
- the ID of the child albumparentAlbumId
- the ID of the parent albumcontext
- the contextpublic Album deleteAlbum(java.lang.Long albumId, BizContext context)
MediaBiz
deleteAlbum
in interface MediaBiz
albumId
- the ID of the album to deletecontext
- the current context
public void storeMediaItemInfo(MediaInfoCommand command, BizContext context)
MediaBiz
storeMediaItemInfo
in interface MediaBiz
command
- the command datacontext
- the current contextpublic java.lang.Long storeAlbum(Album album, BizContext context)
MediaBiz
This method will accept new albums as well as updates to existing albums.
storeAlbum
in interface MediaBiz
album
- the Album to storecontext
- the context
public java.util.List<KeyNameType> getAlbumSortTypes(BizContext context)
MediaBiz
This is to allow the available sort types to be displayed on the front-end.
getAlbumSortTypes
in interface MediaBiz
context
- the context
public void storeAlbumOrdering(SortAlbumsCommand command, BizContext context)
MediaBiz
storeAlbumOrdering
in interface MediaBiz
command
- the sort commandcontext
- the contextpublic void moveMediaItems(MoveItemsCommand command, BizContext context)
MediaBiz
moveMediaItems
in interface MediaBiz
command
- the command objectcontext
- the current contextpublic void storeMediaItemUserComment(UserCommentCommand command, BizContext context)
MediaBiz
UserComment
to a MediaItem.
storeMediaItemUserComment
in interface MediaBiz
command
- user comment commandcontext
- the contextpublic java.util.Map<java.lang.String,MediaHandler> getMediaHandlerFileExtensionMap()
public void setMediaHandlerFileExtensionMap(java.util.Map<java.lang.String,MediaHandler> fileExtensionMap)
fileExtensionMap
- The fileExtensionMap to set.public java.util.Map<java.lang.String,MediaHandler> getMediaHandlerMimeMap()
public void setMediaHandlerMimeMap(java.util.Map<java.lang.String,MediaHandler> mediaHandlerMimeMap)
mediaHandlerMimeMap
- The mediaHandlerMimeMap to set.public java.util.EnumMap<MediaSize,Geometry> getGeometryMap()
public void setGeometryMap(java.util.EnumMap<MediaSize,Geometry> geometryMap)
geometryMap
- The geometryMap to set.public java.util.EnumMap<MediaQuality,java.lang.Float> getQualityMap()
public void setQualityMap(java.util.EnumMap<MediaQuality,java.lang.Float> qualityMap)
qualityMap
- The qualityMap to set.public CollectionDao getCollectionDao()
public void setCollectionDao(CollectionDao collectionDao)
collectionDao
- The collectionDao to set.public UserBiz getUserBiz()
public void setUserBiz(UserBiz userBiz)
userBiz
- The userBiz to set.public MediaItemDao getMediaItemDao()
public void setMediaItemDao(MediaItemDao mediaItemDao)
mediaItemDao
- The mediaItemDao to set.public AlbumDao getAlbumDao()
public void setAlbumDao(AlbumDao albumDao)
albumDao
- The albumDao to set.public IOBiz getIoBiz()
public void setIoBiz(IOBiz ioBiz)
ioBiz
- the ioBiz to setpublic DomainObjectFactory getDomainObjectFactory()
public void setDomainObjectFactory(DomainObjectFactory domainObjectFactory)
domainObjectFactory
- the domainObjectFactory to setpublic byte[] getSalt()
public void setSalt(byte[] salt)
salt
- The salt to set.public SystemBiz getSystemBiz()
public void setSystemBiz(SystemBiz systemBiz)
systemBiz
- the systemBiz to setpublic org.springframework.context.MessageSource getMessages()
public void setMessages(org.springframework.context.MessageSource messages)
messages
- the messages to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |