Search in sources :

Example 86 with OlatRootFolderImpl

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

the class DataStepForm method formOK.

@Override
protected void formOK(UserRequest ureq) {
    String val = dataEl.getValue();
    if (!StringHelper.containsNonWhitespace(val) && (returnFileEl != null ? !returnFileEl.isUploadSuccess() : true)) {
        // do not proceed when nothin in input field and no file uploaded
        setFormWarning("form.step2.error");
        return;
    }
    // reset error
    setFormWarning(null);
    BulkAssessmentDatas datas = (BulkAssessmentDatas) getFromRunContext("datas");
    if (datas == null) {
        datas = new BulkAssessmentDatas();
    }
    if (bulkAssessmentTmpDir == null) {
        OlatRootFolderImpl bulkAssessmentDir = new OlatRootFolderImpl("/bulkassessment/", null);
        bulkAssessmentTmpDir = bulkAssessmentDir.createChildContainer(UUID.randomUUID().toString());
    }
    backupInputDatas(val, datas, bulkAssessmentTmpDir);
    List<String[]> splittedRows = splitRawData(val);
    addToRunContext("splittedRows", splittedRows);
    List<BulkAssessmentRow> rows = new ArrayList<>(100);
    if (returnFileEl != null) {
        processReturnFiles(datas, rows, bulkAssessmentTmpDir);
    }
    datas.setRows(rows);
    addToRunContext("datas", datas);
    fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
}
Also used : BulkAssessmentDatas(org.olat.course.assessment.model.BulkAssessmentDatas) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) ArrayList(java.util.ArrayList) BulkAssessmentRow(org.olat.course.assessment.model.BulkAssessmentRow)

Example 87 with OlatRootFolderImpl

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

the class FileResourceManager method unzipContainerResource.

public OlatRootFolderImpl unzipContainerResource(final OLATResourceable res) {
    OlatRootFolderImpl container = getFileResourceRootImpl(res);
    File dir = container.getBasefile();
    File unzipDir = unzipFileResource(res, dir);
    if (unzipDir == null) {
        return null;
    }
    return (OlatRootFolderImpl) container.resolve(unzipDir.getName());
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) File(java.io.File)

Example 88 with OlatRootFolderImpl

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

the class GroupfoldersWebDAVMergeSource method getGroupContainer.

private VFSContainer getGroupContainer(String name, BusinessGroup group, boolean isOwner) {
    String folderPath = collaborationManager.getFolderRelPath(group);
    // create container and set quota
    OlatRootFolderImpl localImpl = new OlatRootFolderImpl(folderPath, this);
    // already done in OlatRootFolderImpl localImpl.getBasefile().mkdirs(); // lazy initialize dirs
    String containerName = RequestUtil.normalizeFilename(name);
    NamedContainerImpl grpContainer = new GroupNamedContainer(containerName, localImpl);
    boolean writeAccess;
    if (!isOwner) {
        // check if participants have read/write access
        int folderAccess = CollaborationTools.FOLDER_ACCESS_ALL;
        Long lFolderAccess = collaborationManager.lookupFolderAccess(group);
        if (lFolderAccess != null) {
            folderAccess = lFolderAccess.intValue();
        }
        writeAccess = (folderAccess == CollaborationTools.FOLDER_ACCESS_ALL);
    } else {
        writeAccess = true;
    }
    VFSSecurityCallback secCallback;
    if (writeAccess) {
        SubscriptionContext sc = new SubscriptionContext(group, "toolfolder");
        secCallback = new FullAccessWithLazyQuotaCallback(folderPath, QuotaConstants.IDENTIFIER_DEFAULT_GROUPS, sc);
    } else {
        secCallback = new ReadOnlyCallback();
    }
    grpContainer.setLocalSecurityCallback(secCallback);
    return grpContainer;
}
Also used : FullAccessWithLazyQuotaCallback(org.olat.core.util.vfs.callbacks.FullAccessWithLazyQuotaCallback) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) ReadOnlyCallback(org.olat.core.util.vfs.callbacks.ReadOnlyCallback) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) VFSSecurityCallback(org.olat.core.util.vfs.callbacks.VFSSecurityCallback) NamedContainerImpl(org.olat.core.util.vfs.NamedContainerImpl)

Example 89 with OlatRootFolderImpl

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

the class AssessmentTestSessionDAO method getSessionStorage.

/**
 * Create a folder for a session in bcroot.
 *
 * @param session
 * @return
 */
public File getSessionStorage(AssessmentTestSession session) {
    OlatRootFolderImpl rootContainer = getQtiSerializationPath();
    File directory = new File(rootContainer.getBasefile(), session.getStorage());
    if (!directory.exists()) {
        directory.mkdirs();
    }
    return directory;
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) File(java.io.File)

Example 90 with OlatRootFolderImpl

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

the class FolderManager method getFileInfos.

/**
 * @param bcBase
 * @param newerThan
 * @return a List of FileInfo
 */
public static List<FileInfo> getFileInfos(final String olatRelPath, Date newerThan) {
    final List<FileInfo> fileInfos = new ArrayList<>();
    final long newerThanLong = newerThan.getTime();
    OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(olatRelPath, null);
    getFileInfosRecursively(rootFolder, fileInfos, newerThanLong, olatRelPath.length());
    return fileInfos;
}
Also used : OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) ArrayList(java.util.ArrayList)

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