use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class CheckboxManagerImpl method getFileContainer.
@Override
public VFSContainer getFileContainer(CourseEnvironment courseEnv, CheckListCourseNode cNode) {
String path = courseEnv.getCourseBaseContainer().getRelPath() + "/" + CheckListCourseNode.FOLDER_NAME + "/" + cNode.getIdent();
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(path, null);
return rootFolder;
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class ProjectDetailsDisplayController method doFileDelivery.
private void doFileDelivery(UserRequest ureq, final Project project, final CourseEnvironment courseEnv, final CourseNode cNode) {
// Create a mapper to deliver the auto-download of the file. We have to
// create a dedicated mapper here
// and can not reuse the standard briefcase way of file delivering, some
// very old fancy code
// Mapper is cleaned up automatically by basic controller
OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(projectBrokerManager.getAttamchmentRelativeRootPath(project, courseEnv, cNode), null);
VFSItem item = rootFolder.resolve(project.getAttachmentFileName());
if (item instanceof VFSLeaf) {
VFSLeaf attachment = (VFSLeaf) item;
MediaResource resource = new VFSMediaResource(attachment);
ureq.getDispatchResult().setResultingMediaResource(resource);
}
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class ProjectBrokerManagerImpl method deleteAllAttachmentFilesOfProject.
private void deleteAllAttachmentFilesOfProject(Project project, CourseEnvironment courseEnv, CourseNode cNode) {
VFSContainer attachmentDir = new OlatRootFolderImpl(getAttamchmentRelativeRootPath(project, courseEnv, cNode), null);
attachmentDir.delete();
logDebug("deleteAllAttachmentFilesOfProject path=" + attachmentDir);
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class ProjectBrokerManagerImpl method deleteAllDropboxFilesOfProject.
private void deleteAllDropboxFilesOfProject(Project project, CourseEnvironment courseEnv, CourseNode cNode) {
VFSContainer dropboxDir = new OlatRootFolderImpl(ProjectBrokerDropboxController.getDropboxBasePathForProject(project, courseEnv, cNode), null);
dropboxDir.delete();
logDebug("deleteAllDropboxFilesOfProject path=" + dropboxDir);
}
use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project openolat by klemens.
the class PFManager method getLastUpdated.
/**
* Gets the last updated file for each participant.
*
* @param courseEnv
* @param pfNode
* @param identity
* @return the last updated file as Date
*/
private Date getLastUpdated(CourseEnvironment courseEnv, PFCourseNode pfNode, Identity identity, String fileName) {
Date latest = null;
List<Long> lastUpdated = new ArrayList<>();
OlatRootFolderImpl baseContainer = courseEnv.getCourseBaseContainer();
Path path = Paths.get(baseContainer.getBasefile().toPath().toString(), FILENAME_PARTICIPANTFOLDER, pfNode.getIdent(), getIdFolderName(identity), fileName);
try {
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
lastUpdated.add(attrs.lastModifiedTime().toMillis());
return FileVisitResult.CONTINUE;
}
});
} catch (IOException e) {
log.error("Unknown IOE", e);
}
Collections.sort(lastUpdated);
if (lastUpdated.size() > 0) {
latest = new Date(lastUpdated.get(lastUpdated.size() - 1));
}
return latest;
}
Aggregations