Search in sources :

Example 36 with SystemItemFilter

use of org.olat.core.util.vfs.filters.SystemItemFilter in project openolat by klemens.

the class ForumMediaHandler method createMedia.

@Override
public Media createMedia(AbstractArtefact artefact) {
    VFSContainer artefactFolder = oldPortfolioManager.getArtefactContainer(artefact);
    String businessPath = artefact.getBusinessPath();
    if (businessPath == null) {
        businessPath = "[PortfolioV2:0][MediaCenter:0]";
    }
    Media media = mediaDao.createMedia(artefact.getTitle(), artefact.getDescription(), null, FORUM_HANDLER, businessPath, artefact.getKey().toString(), artefact.getSignature(), artefact.getAuthor());
    ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_MEDIA_ADDED, getClass(), LoggingResourceable.wrap(media));
    List<VFSItem> items = artefactFolder.getItems(new SystemItemFilter());
    if (items.size() > 0) {
        File mediaDir = fileStorage.generateMediaSubDirectory(media);
        String storagePath = fileStorage.getRelativePath(mediaDir);
        mediaDao.updateStoragePath(media, storagePath, null);
        VFSContainer mediaContainer = fileStorage.getMediaContainer(media);
        VFSManager.copyContent(artefactFolder, mediaContainer);
    }
    return media;
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) Media(org.olat.modules.portfolio.Media) VFSItem(org.olat.core.util.vfs.VFSItem) SystemItemFilter(org.olat.core.util.vfs.filters.SystemItemFilter) File(java.io.File)

Aggregations

SystemItemFilter (org.olat.core.util.vfs.filters.SystemItemFilter)36 VFSItem (org.olat.core.util.vfs.VFSItem)34 VFSContainer (org.olat.core.util.vfs.VFSContainer)30 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)24 Date (java.util.Date)10 OutputStream (java.io.OutputStream)8 PathSegment (javax.ws.rs.core.PathSegment)8 UriBuilder (javax.ws.rs.core.UriBuilder)8 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)8 ByteArrayInputStream (java.io.ByteArrayInputStream)6 InputStream (java.io.InputStream)6 ArrayList (java.util.ArrayList)6 Response (javax.ws.rs.core.Response)6 Test (org.junit.Test)6 RepositoryEntry (org.olat.repository.RepositoryEntry)4 FileVO (org.olat.restapi.support.vo.FileVO)4 LinkVO (org.olat.restapi.support.vo.LinkVO)4 File (java.io.File)2 Collator (java.text.Collator)2 HashSet (java.util.HashSet)2