The Content Repository in XperienCentral is used to store Images, downloads and Flash animations and custom media items. Access to these content items is exposed through the
MediaRepositoryManagementService contains methods for creating and deleting items in the Content Repository. It also contains methods for coupling the actual file to the item that has been created in the Content Repository.
To create an item for the Content Repository, use one of the three create methods. All of them take one argument: the name of the website for which the media item will be created. The following code example shows how to create an Image, or Download or Flash:
MediaItem image = myMediaRepositoryService.createImageMediaItem(mySession.getXperienCentralApplication().getWebsites()); MediaItem download = myMediaRepositoryService.createDownloadMediaItem(mySession.getXperienCentralApplication().getWebsites());
In the example above, a
MockMultipartFile is created to attach to the image media item. If the file to be attached is uploaded to XperienCentral by the editor, it will be available as
MultipartFile directly using Spring binding on a file input field. The procedure for attaching a file to a Download (
MediaItemDownloadVersion) or Flash (
MediaItemFlashVersion) media item is identical.