nl.gx.webmanager.services.contentapi
Interface MediaRepositoryManagementService


public interface MediaRepositoryManagementService

This class offers APIs for operations with media items.

Author:
ivol

Method Summary
 MediaItem copyMediaItem(MediaItem mediaItem)
          Copies the given media item.
 MediaItem copyMediaItem(Website website, MediaItem mediaItem)
          Copies the given media item to the target website.
 MediaTermClassification createClassification(java.lang.String classification)
          Creates a new term classification and returns it.
 MediaItem createDownloadMediaItem(Website website)
          Creates a new download media item (also referred to as a download stored in the ObjectManager) and returns it.
 MediaItem createFlashMediaItem(Website website)
          Creates a new flash media item (also referred to as a download stored in the ObjectManager) and returns it.
 MediaItem createImageMediaItem(Website website)
          Creates a new image media item (also referred to as an image stored in the ObjectManager) and returns it.
 MediaItem createMediaItem(Website website, java.lang.String type)
          Creates a new media item of the specified type and returns it.
 MediaItemVersion createMediaItemVersion(MediaItemVersion original)
          Creates a new MediaItemVersion based on the original version.
 MediaTerm createMediaTerm(Website website, java.lang.String termName)
          Creates a new media term with the specified term name.
 MediaItem createPageMediaItem(Website website, Page page)
          Creates a new page media item; a page that is stored in the media repository.
 MediaItem createPageModelMediaItem(Website website, PageModel pageModel)
          Create a new media item based on a page model.
 void deleteClassification(MediaTermClassification classification)
          Persistently deletes the given MediaTermClassification object from the MediaRepository.
 boolean deleteMediaItem(MediaItem mediaItem)
          Deletes the given media item.
 boolean deleteMediaItemVersion(MediaItemVersion mediaItemVersion)
          Deletes the given media item version.
 void deleteMediaTerm(MediaTerm mediaTerm)
          Deletes a media term.
 MediaItem[] getAllMediaItems(java.lang.String mediaType)
          NB: THIS METHOD UNCONDITIONALLY RETRIEVES ALL MEDIAITEMS OF A PARTICULAR TYPE.
 MediaItemFilter getMediaItemFilterInstance()
          Creates and returns an instance of a MediaItemFilter with default values.
 MediaSearchResult getMediaItems(Website website, MediaItemFilter filter, MediaItemSortOptions sortOptions)
          Performs the search of media items based on filter search criteria.
 MediaItemSortOptions getMediaItemSortOptionsInstance()
          Creates an instance of MediaItemSortOptions.
 void performPostUpdateActions(MediaItemVersion mediaItemVersion)
          Tells WebManager a media item version has been updated.
 void performWorkflowAction(MediaItemVersion mediaItemVersion, WorkflowAction workflowAction)
          Performs the given workflowAction to progress this mediaItemVersion to the next state.
 boolean reorderElements(MediaItemArticleVersion mediaItemArticleVersion, Element[] elements)
          Reorders all the elements of a media item article version.
 

Method Detail

createDownloadMediaItem

MediaItem createDownloadMediaItem(Website website)
Creates a new download media item (also referred to as a download stored in the ObjectManager) and returns it.

Parameters:
website - Website for which to create the download media item
Returns:
The download media item that was created, or null if an error occurred

createImageMediaItem

MediaItem createImageMediaItem(Website website)
Creates a new image media item (also referred to as an image stored in the ObjectManager) and returns it.

Parameters:
website - Website for which to create the image media item
Returns:
The image media item that was created, or null if an error occurred

createFlashMediaItem

MediaItem createFlashMediaItem(Website website)
Creates a new flash media item (also referred to as a download stored in the ObjectManager) and returns it.

Parameters:
website - Website for which to create the flash media item
Returns:
The flash media item that was created, or null if an error occurred

createPageMediaItem

MediaItem createPageMediaItem(Website website,
                              Page page)
Creates a new page media item; a page that is stored in the media repository.

Parameters:
website - Website for which to create the page media item
page - Page that should be assigned to the new media item
Returns:
The page media item that was created, or null if an error occurred

createPageModelMediaItem

MediaItem createPageModelMediaItem(Website website,
                                   PageModel pageModel)
Create a new media item based on a page model.

Parameters:
website - Website for which to create the media item.
pageModel - The page model to base the media item on.
Returns:
The newly created media item, or null if an error occurred

createMediaItem

MediaItem createMediaItem(Website website,
                          java.lang.String type)
Creates a new media item of the specified type and returns it.

Parameters:
website - Website for which to create the flash media item
type - String identifying the type of media item (see nl.gx.webmanager.cms.mediarepository.MediaItem for static definitions of all available types) NB: Cannot be used for media items of type page or page model.
Returns:
The media item that was created, or null if an error occurred

createMediaTerm

MediaTerm createMediaTerm(Website website,
                          java.lang.String termName)
Creates a new media term with the specified term name. If a term with the given name already exists then that MediaTerm is returned.

Parameters:
website - The website for which to create the media term.
termName - The name of the term to create.
Returns:
The created media term.

createClassification

MediaTermClassification createClassification(java.lang.String classification)
Creates a new term classification and returns it. If the classification is null or empty, the method will log a warning and return null. If the classification already exists, that classification is returned and no new classification will be created. If the classification does not yet exist, it will be created and returned. In case of an exception, null will be returned.

Parameters:
classification - The name of the classification to create
Returns:
The created classification or the classification that already existed with this name

deleteClassification

void deleteClassification(MediaTermClassification classification)
Persistently deletes the given MediaTermClassification object from the MediaRepository.

Parameters:
classification - The MediaTermClassification which should be deleted.

copyMediaItem

MediaItem copyMediaItem(MediaItem mediaItem)
                        throws NoAuthorizationException
Copies the given media item. The copied media item will belong to the same web site as the source media item.

Regarding authorization an user needs to have CREATE permission on the media repository. If and only if the media item contains elements each element requires CREATE permission for the user, and the user needs UPDATE permission on the media repository.

Steps performed:

Note: currently only supports article, page model and media items of a custom content type, and NOT page, multimedia, image, download, flash, announcement, regulation and document types.

Parameters:
mediaItem - Media item to copy.
Returns:
The copied media item.
Throws:
NoAuthorizationException - If user has no rights to copy the media item.
See Also:
ElementManagementService#copyElement(Element, MediaItemArticleVersion)}

createMediaItemVersion

MediaItemVersion createMediaItemVersion(MediaItemVersion original)
                                        throws NoAuthorizationException
Creates a new MediaItemVersion based on the original version.

Parameters:
original - the original MediaItemVersion to base the new version on
Returns:
the new version
Throws:
NoAuthorizationException - if there is no authorization

copyMediaItem

MediaItem copyMediaItem(Website website,
                        MediaItem mediaItem)
                        throws NoAuthorizationException
Copies the given media item to the target website. If no website is specified than the copied media item is created for the same website as the source media item.

For a detailed description see copyMediaItem(MediaItem).

Parameters:
website - Website which will be the owner of the copy.
mediaItem - Media item to copy.
Returns:
The copied media item.
Throws:
NoAuthorizationException - If user has no rights to copy the media item.
See Also:
ElementManagementService#copyElement(Element, MediaItemArticleVersion)}

deleteMediaItem

boolean deleteMediaItem(MediaItem mediaItem)
Deletes the given media item.

Parameters:
mediaItem - Media item to delete
Returns:
true if deleting the media item succeeded, false otherwise

deleteMediaItemVersion

boolean deleteMediaItemVersion(MediaItemVersion mediaItemVersion)
Deletes the given media item version.

Parameters:
mediaItemVersion - Media item version to delete
Returns:
true if deleting the media item version succeeded, false otherwise

deleteMediaTerm

void deleteMediaTerm(MediaTerm mediaTerm)
Deletes a media term.

Parameters:
mediaTerm - Media term to delete.

getAllMediaItems

MediaItem[] getAllMediaItems(java.lang.String mediaType)
NB: THIS METHOD UNCONDITIONALLY RETRIEVES ALL MEDIAITEMS OF A PARTICULAR TYPE. ONLY USE IT IN CASE IT IS FOR SURE THAT USING IT WILL NOT CAUSE PERFORMANCE ISSUES. This method retrieves all media items of a particular type.

Parameters:
mediaType - Media type to retrieve the media items from
Returns:
Array of all media items of the specified type

reorderElements

boolean reorderElements(MediaItemArticleVersion mediaItemArticleVersion,
                        Element[] elements)
Reorders all the elements of a media item article version. The given elements defines the new ordering of elements. Note that there is no authorization required to reorder elements.

Parameters:
mediaItemArticleVersion - The media item article version which elements should be reordered.
elements - Elements that defines the new ordering of the media item article version's elements.
Returns:
Returns true if reorder succeeded, false otherwise.

getMediaItemFilterInstance

MediaItemFilter getMediaItemFilterInstance()
Creates and returns an instance of a MediaItemFilter with default values.

The default values of the created instance are :

Returns:
new MediaItemFilter instance

getMediaItemSortOptionsInstance

MediaItemSortOptions getMediaItemSortOptionsInstance()
Creates an instance of MediaItemSortOptions.

Returns:
new MediaItemSortOptions

getMediaItems

MediaSearchResult getMediaItems(Website website,
                                MediaItemFilter filter,
                                MediaItemSortOptions sortOptions)
Performs the search of media items based on filter search criteria.

Parameters:
website - Source web site from which the media repository is accessed.
filter - the search criteria
sortOptions - the sort options
Returns:
the search result containing selected media items

performWorkflowAction

void performWorkflowAction(MediaItemVersion mediaItemVersion,
                           WorkflowAction workflowAction)
                           throws UnExecutableWorkflowActionException
Performs the given workflowAction to progress this mediaItemVersion to the next state.

Parameters:
mediaItemVersion - the mediaItemVersion
workflowAction - the workflowAction
Throws:
UnExecutableWorkflowActionException - If the given workflow action is invalid.

performPostUpdateActions

void performPostUpdateActions(MediaItemVersion mediaItemVersion)
Tells WebManager a media item version has been updated. Must be used after setting some properties of the media item version to ensure that dependent components do their job.

Currently the SEO service (Search Engine Optimization) is instructed to update the media item version's friendly URL if necessary.

Parameters:
mediaItemVersion - The media item version that has been updated.


Copyright © 2007-2011 GX Software BV. All Rights Reserved.