magoffin.matt.ma2.biz
Interface IOBiz

All Known Implementing Classes:
IOBizImpl

public interface IOBiz

API for importing and exporting media.

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

Nested Class Summary
static interface IOBiz.TwoPhaseExportRequest
          Extension of WorkBiz.WorkRequest to allow for two-phase export media reqeust handling.
 
Field Summary
static java.lang.String IMPORT_MEDIA_XML_METADATA_NAME
          The name of the XML metadata file within a zip archive used by importMedia(AddMediaCommand, BizContext).
 
Method Summary
 int clearCacheFiles(User user, java.util.Set<MediaSize> ofSize)
          Clear all cache files for a particular user, optionally of a particular size only.
 int deleteMedia(java.util.List<MediaItem> itemsToDelete)
          Delete media item files.
 WorkBiz.WorkInfo exportItems(ExportItemsCommand command, MediaRequest request, MediaResponse response, BizContext context)
          Export a set of media items as a Zip archive.
 WorkBiz.WorkInfo exportMedia(MediaRequest request, MediaResponse response, BizContext context)
          Export media from the application.
 WorkBiz.WorkInfo importMedia(AddMediaCommand command, BizContext context)
          Import media into the application.
 int moveMedia(java.util.List<MediaItem> itemsToMove, Collection toCollection)
          Move media item files to a new directory.
 

Field Detail

IMPORT_MEDIA_XML_METADATA_NAME

static final java.lang.String IMPORT_MEDIA_XML_METADATA_NAME
The name of the XML metadata file within a zip archive used by importMedia(AddMediaCommand, BizContext).

See Also:
Constant Field Values
Method Detail

importMedia

WorkBiz.WorkInfo importMedia(AddMediaCommand command,
                             BizContext context)
Import media into the application.

This method is designed to allow for imports that take some time to run, and thus should happen asynchronously. Thus a WorkInfo object is returned, which will give details of the status of the import job. The WorkBiz.getInfo(long) method can be used to query the status of the job at a later point, using the ticket returned by WorkBiz.WorkInfo.getTicket().

Parameters:
command - the media to import
context - the biz context
Returns:
a WorkInfo with status of the import job

exportMedia

WorkBiz.WorkInfo exportMedia(MediaRequest request,
                             MediaResponse response,
                             BizContext context)
Export media from the application.

Parameters:
request - the request
response - the response
context - the biz context
Returns:
a WorkInfo with status of the export job

exportItems

WorkBiz.WorkInfo exportItems(ExportItemsCommand command,
                             MediaRequest request,
                             MediaResponse response,
                             BizContext context)
Export a set of media items as a Zip archive.

If ExportItemsCommand.getAlbumId() or ExportItemsCommand.getAlbumKey() is non-null, then this will export all the items of that album into a zip archive. Otherwise it will export all the items specified by ExportItemsCommand.getItemIds(). The quality and size parameters are not used, it will instead rely on the setting in the MediaRequest.

This method should support two-phase procesing if the MediaResponse is null. The method should return a WorkInfo as normal but the WorkRequest returned by WorkBiz.WorkInfo.getWorkRequest() must implement IOBiz.TwoPhaseExportRequest. The work to export the items should not begin until a later time when IOBiz.TwoPhaseExportRequest.setMediaResponse(MediaResponse) is called. The implementation must wait only for a finite amount of time for setMediaResponse to be called, after which time the job can be discarded.

This is to allow for flexibility with the calling applicaiton GUI where the work ticket is needed before the actual OutputStream is ready for the exported items.

Parameters:
command - the export command
request - the request (for all media in the album)
response - the response
context - the context
Returns:
a WorkInfo with status of the export job

deleteMedia

int deleteMedia(java.util.List<MediaItem> itemsToDelete)
Delete media item files.

This method deletes the files associated with the MediaItem instances, but does not delete the MediaItem instances from the backend database. It should also clean up any cache files for the associated items.

Parameters:
itemsToDelete - the items to delete
Returns:
number of items successfully deleted

moveMedia

int moveMedia(java.util.List<MediaItem> itemsToMove,
              Collection toCollection)
Move media item files to a new directory.

Parameters:
itemsToMove - the items to move
toCollection - the Collection to move them to
Returns:
the number of files moved

clearCacheFiles

int clearCacheFiles(User user,
                    java.util.Set<MediaSize> ofSize)
Clear all cache files for a particular user, optionally of a particular size only.

Parameters:
user - the user to clear cache files for
ofSize - if specified, a set of sizes to clear
Returns:
the number of files deleted