Search in sources :

Example 41 with OlatRootFolderImpl

use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.

the class EPArtefactManager method getArtefactsTempContainer.

protected VFSContainer getArtefactsTempContainer(Identity ident) {
    VFSContainer artRoot = new OlatRootFolderImpl(File.separator + "tmp", null);
    VFSItem tmpI = artRoot.resolve("portfolio");
    if (tmpI == null) {
        tmpI = artRoot.createChildContainer("portfolio");
    }
    VFSItem userTmp = tmpI.resolve(ident.getName());
    if (userTmp == null) {
        userTmp = ((VFSContainer) tmpI).createChildContainer(ident.getName());
    }
    String idFolder = UUID.randomUUID().toString();
    VFSContainer thisTmp = ((VFSContainer) userTmp).createChildContainer(idFolder);
    return thisTmp;
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem)

Example 42 with OlatRootFolderImpl

use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.

the class UserInfoMainController method doOpenFolder.

private FolderRunController doOpenFolder(UserRequest ureq) {
    removeAsListenerAndDispose(folderRunController);
    String chosenUserFolderRelPath = FolderConfig.getUserHome(chosenIdentity.getName()) + "/public";
    OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(chosenUserFolderRelPath, null);
    OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(firstLastName, rootFolder);
    // decided in plenum to have read only view in the personal visiting card, even for admin
    VFSSecurityCallback secCallback = new ReadOnlyCallback();
    namedFolder.setLocalSecurityCallback(secCallback);
    OLATResourceable ores = OresHelper.createOLATResourceableType("userfolder");
    WindowControl bwControl = addToHistory(ureq, ores, null);
    folderRunController = new FolderRunController(namedFolder, false, true, false, ureq, bwControl);
    folderRunController.setResourceURL("[Identity:" + chosenIdentity.getKey() + "][userfolder:0]");
    listenTo(folderRunController);
    return folderRunController;
}
Also used : OlatNamedContainerImpl(org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) ReadOnlyCallback(org.olat.core.util.vfs.callbacks.ReadOnlyCallback) OLATResourceable(org.olat.core.id.OLATResourceable) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) WindowControl(org.olat.core.gui.control.WindowControl) VFSSecurityCallback(org.olat.core.util.vfs.callbacks.VFSSecurityCallback)

Example 43 with OlatRootFolderImpl

use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.

the class PersonalFolderManager method deleteUserData.

/**
 * Delete personal-folder homes/<username> (private & public) of an user.
 */
@Override
public void deleteUserData(Identity identity, String newDeletedUserName, File archivePath) {
    new OlatRootFolderImpl(getRootPathFor(identity), null).deleteSilently();
    log.debug("Personal-folder deleted for identity=" + identity);
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)

Example 44 with OlatRootFolderImpl

use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.

the class BCCourseNode method getNodeFolderContainer.

/**
 * Get a named container of a node with the node title as its name.
 * @param node
 * @param courseEnv
 * @return
 */
public static OlatNamedContainerImpl getNodeFolderContainer(BCCourseNode node, CourseEnvironment courseEnv) {
    String path = getFoldernodePathRelToFolderBase(courseEnv, node);
    OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(path, null);
    OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(node.getShortTitle(), rootFolder);
    return namedFolder;
}
Also used : OlatNamedContainerImpl(org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)

Example 45 with OlatRootFolderImpl

use of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl in project OpenOLAT by OpenOLAT.

the class CourseHandler method getMediaContainer.

@Override
public VFSContainer getMediaContainer(RepositoryEntry repoEntry) {
    OLATResource resource = repoEntry.getOlatResource();
    String relPath = File.separator + PersistingCourseImpl.COURSE_ROOT_DIR_NAME + File.separator + resource.getResourceableId();
    VFSContainer rootFolder = new OlatRootFolderImpl(relPath, null);
    VFSItem item = rootFolder.resolve("media");
    VFSContainer mediaContainer;
    if (item == null) {
        mediaContainer = rootFolder.createChildContainer("media");
    } else if (item instanceof VFSContainer) {
        mediaContainer = (VFSContainer) item;
    } else {
        log.error("media folder is not a container", null);
        mediaContainer = null;
    }
    return mediaContainer;
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) VFSContainer(org.olat.core.util.vfs.VFSContainer) OLATResource(org.olat.resource.OLATResource) VFSItem(org.olat.core.util.vfs.VFSItem)

Aggregations

OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)214 VFSContainer (org.olat.core.util.vfs.VFSContainer)86 VFSItem (org.olat.core.util.vfs.VFSItem)68 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)58 Identity (org.olat.core.id.Identity)50 Test (org.junit.Test)48 File (java.io.File)36 InputStream (java.io.InputStream)30 OlatNamedContainerImpl (org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl)28 OutputStream (java.io.OutputStream)26 VFSSecurityCallback (org.olat.core.util.vfs.callbacks.VFSSecurityCallback)24 URI (java.net.URI)22 RepositoryEntry (org.olat.repository.RepositoryEntry)22 ByteArrayInputStream (java.io.ByteArrayInputStream)20 Path (java.nio.file.Path)20 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)18 IOException (java.io.IOException)16 HttpResponse (org.apache.http.HttpResponse)14 CollaborationTools (org.olat.collaboration.CollaborationTools)14 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)14