Search in sources :

Example 1 with StreamedMediaResource

use of org.olat.core.gui.media.StreamedMediaResource in project OpenOLAT by OpenOLAT.

the class PortfolioHandler method getAsMediaResource.

/**
 * Transform the map in a XML file and zip it (Repository export want a zip)
 * @see org.olat.repository.handlers.RepositoryHandler#getAsMediaResource(org.olat.core.id.OLATResourceable)
 */
@Override
public MediaResource getAsMediaResource(OLATResourceable res, boolean backwardsCompatible) {
    MediaResource mr = null;
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    PortfolioStructure structure = ePFMgr.loadPortfolioStructure(res);
    try {
        InputStream inOut = EPXStreamHandler.toStream(structure);
        mr = new StreamedMediaResource(inOut, null, null, null);
    } catch (IOException e) {
        log.error("Cannot export this map: " + structure, e);
    }
    return mr;
}
Also used : InputStream(java.io.InputStream) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) MediaResource(org.olat.core.gui.media.MediaResource) StreamedMediaResource(org.olat.core.gui.media.StreamedMediaResource) IOException(java.io.IOException) StreamedMediaResource(org.olat.core.gui.media.StreamedMediaResource) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager)

Example 2 with StreamedMediaResource

use of org.olat.core.gui.media.StreamedMediaResource in project openolat by klemens.

the class PortfolioHandler method getAsMediaResource.

/**
 * Transform the map in a XML file and zip it (Repository export want a zip)
 * @see org.olat.repository.handlers.RepositoryHandler#getAsMediaResource(org.olat.core.id.OLATResourceable)
 */
@Override
public MediaResource getAsMediaResource(OLATResourceable res, boolean backwardsCompatible) {
    MediaResource mr = null;
    EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
    PortfolioStructure structure = ePFMgr.loadPortfolioStructure(res);
    try {
        InputStream inOut = EPXStreamHandler.toStream(structure);
        mr = new StreamedMediaResource(inOut, null, null, null);
    } catch (IOException e) {
        log.error("Cannot export this map: " + structure, e);
    }
    return mr;
}
Also used : InputStream(java.io.InputStream) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) MediaResource(org.olat.core.gui.media.MediaResource) StreamedMediaResource(org.olat.core.gui.media.StreamedMediaResource) IOException(java.io.IOException) StreamedMediaResource(org.olat.core.gui.media.StreamedMediaResource) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager)

Aggregations

IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 MediaResource (org.olat.core.gui.media.MediaResource)2 StreamedMediaResource (org.olat.core.gui.media.StreamedMediaResource)2 EPFrontendManager (org.olat.portfolio.manager.EPFrontendManager)2 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)2