Search in sources :

Example 1 with KoofrMediaExport

use of org.datatransferproject.transfer.koofr.common.KoofrMediaExport in project data-transfer-project by google.

the class KoofrPhotosExporter method export.

@Override
public ExportResult<PhotosContainerResource> export(UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation) throws CopyExceptionWithFailureReason {
    Preconditions.checkNotNull(authData);
    KoofrClient koofrClient = koofrClientFactory.create(authData);
    KoofrMediaExport export = new KoofrMediaExport(koofrClient, monitor);
    try {
        export.export();
        List<PhotoAlbum> exportAlbums = export.getPhotoAlbums();
        List<PhotoModel> exportPhotos = export.getPhotos();
        PhotosContainerResource containerResource = new PhotosContainerResource(exportAlbums, exportPhotos);
        return new ExportResult<>(ExportResult.ResultType.END, containerResource, null);
    } catch (IOException e) {
        return new ExportResult<>(e);
    }
}
Also used : PhotosContainerResource(org.datatransferproject.types.common.models.photos.PhotosContainerResource) PhotoModel(org.datatransferproject.types.common.models.photos.PhotoModel) KoofrClient(org.datatransferproject.transfer.koofr.common.KoofrClient) PhotoAlbum(org.datatransferproject.types.common.models.photos.PhotoAlbum) IOException(java.io.IOException) KoofrMediaExport(org.datatransferproject.transfer.koofr.common.KoofrMediaExport) ExportResult(org.datatransferproject.spi.transfer.provider.ExportResult)

Example 2 with KoofrMediaExport

use of org.datatransferproject.transfer.koofr.common.KoofrMediaExport in project data-transfer-project by google.

the class KoofrVideosExporter method export.

@Override
public ExportResult<VideosContainerResource> export(UUID jobId, TokensAndUrlAuthData authData, Optional<ExportInformation> exportInformation) throws CopyExceptionWithFailureReason {
    Preconditions.checkNotNull(authData);
    KoofrClient koofrClient = koofrClientFactory.create(authData);
    KoofrMediaExport export = new KoofrMediaExport(koofrClient, monitor);
    try {
        export.export();
        List<VideoAlbum> exportAlbums = export.getVideoAlbums();
        List<VideoModel> exportVideos = export.getVideos();
        VideosContainerResource containerResource = new VideosContainerResource(exportAlbums, exportVideos);
        return new ExportResult<>(ExportResult.ResultType.END, containerResource, null);
    } catch (IOException e) {
        return new ExportResult<>(e);
    }
}
Also used : VideosContainerResource(org.datatransferproject.types.common.models.videos.VideosContainerResource) KoofrClient(org.datatransferproject.transfer.koofr.common.KoofrClient) IOException(java.io.IOException) VideoAlbum(org.datatransferproject.types.common.models.videos.VideoAlbum) VideoModel(org.datatransferproject.types.common.models.videos.VideoModel) KoofrMediaExport(org.datatransferproject.transfer.koofr.common.KoofrMediaExport) ExportResult(org.datatransferproject.spi.transfer.provider.ExportResult)

Aggregations

IOException (java.io.IOException)2 ExportResult (org.datatransferproject.spi.transfer.provider.ExportResult)2 KoofrClient (org.datatransferproject.transfer.koofr.common.KoofrClient)2 KoofrMediaExport (org.datatransferproject.transfer.koofr.common.KoofrMediaExport)2 PhotoAlbum (org.datatransferproject.types.common.models.photos.PhotoAlbum)1 PhotoModel (org.datatransferproject.types.common.models.photos.PhotoModel)1 PhotosContainerResource (org.datatransferproject.types.common.models.photos.PhotosContainerResource)1 VideoAlbum (org.datatransferproject.types.common.models.videos.VideoAlbum)1 VideoModel (org.datatransferproject.types.common.models.videos.VideoModel)1 VideosContainerResource (org.datatransferproject.types.common.models.videos.VideosContainerResource)1