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