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;
}
Aggregations