use of org.olat.core.util.vfs.QuotaManager in project OpenOLAT by OpenOLAT.
the class BriefcaseWebDAVMergeSource method getLocalSecurityCallback.
@Override
public VFSSecurityCallback getLocalSecurityCallback() {
if (super.getLocalSecurityCallback() == null) {
// set quota for this merge source
QuotaManager qm = QuotaManager.getInstance();
Quota quota = qm.getCustomQuotaOrDefaultDependingOnRole(identity, PersonalFolderManager.getInstance().getRootPathFor(identity));
FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(quota);
setLocalSecurityCallback(secCallback);
}
return super.getLocalSecurityCallback();
}
use of org.olat.core.util.vfs.QuotaManager in project OpenOLAT by OpenOLAT.
the class GenericQuotaEditController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == quotaForm) {
if (event == Event.DONE_EVENT) {
QuotaManager qm = QuotaManager.getInstance();
currentQuota = QuotaManager.getInstance().createQuota(quotaForm.getPath(), new Long(quotaForm.getQuotaKB()), new Long(quotaForm.getULLimit()));
qm.setCustomQuotaKB(currentQuota);
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
}
use of org.olat.core.util.vfs.QuotaManager in project OpenOLAT by OpenOLAT.
the class QuotaTableModel method refresh.
/**
*/
public void refresh() {
QuotaManager qm = QuotaManager.getInstance();
quotaList = qm.listCustomQuotasKB();
}
use of org.olat.core.util.vfs.QuotaManager in project OpenOLAT by OpenOLAT.
the class TaskFolderCallback method initTaskFolderQuota.
private void initTaskFolderQuota(String relPath) {
QuotaManager qm = QuotaManager.getInstance();
folderQuota = qm.getCustomQuota(relPath);
if (folderQuota == null) {
Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_POWER);
folderQuota = QuotaManager.getInstance().createQuota(relPath, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
}
}
use of org.olat.core.util.vfs.QuotaManager in project OpenOLAT by OpenOLAT.
the class ModifyCourseEvent method copyCourse.
/**
* Copies a course. More specifically, the run and editor structures and the
* course folder will be copied to create a new course.
*
* @param sourceRes
* @param ureq
* @return copy of the course.
*/
public static OLATResourceable copyCourse(OLATResourceable sourceRes, OLATResource targetRes) {
PersistingCourseImpl sourceCourse = (PersistingCourseImpl) loadCourse(sourceRes);
PersistingCourseImpl targetCourse = new PersistingCourseImpl(targetRes);
File fTargetCourseBasePath = targetCourse.getCourseBaseContainer().getBasefile();
// close connection before file copy
DBFactory.getInstance().commitAndCloseSession();
synchronized (sourceCourse) {
// o_clusterNOK - cannot be solved with doInSync since could take too long (leads to error: "Lock wait timeout exceeded")
// copy configuration
CourseConfig courseConf = CourseConfigManagerImpl.getInstance().copyConfigOf(sourceCourse);
targetCourse.setCourseConfig(courseConf);
// save structures
targetCourse.setRunStructure((Structure) XStreamHelper.xstreamClone(sourceCourse.getRunStructure()));
targetCourse.saveRunStructure();
targetCourse.setEditorTreeModel((CourseEditorTreeModel) XStreamHelper.xstreamClone(sourceCourse.getEditorTreeModel()));
targetCourse.saveEditorTreeModel();
// copy course folder
File fSourceCourseFolder = sourceCourse.getIsolatedCourseBaseFolder();
if (fSourceCourseFolder.exists())
FileUtils.copyDirToDir(fSourceCourseFolder, fTargetCourseBasePath, false, "copy course folder");
// copy folder nodes directories
File fSourceFoldernodesFolder = new File(FolderConfig.getCanonicalRoot() + BCCourseNode.getFoldernodesPathRelToFolderBase(sourceCourse.getCourseEnvironment()));
if (fSourceFoldernodesFolder.exists())
FileUtils.copyDirToDir(fSourceFoldernodesFolder, fTargetCourseBasePath, false, "copy folder nodes directories");
// copy task folder directories
File fSourceTaskfoldernodesFolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFoldersPathRelToFolderRoot(sourceCourse.getCourseEnvironment()));
if (fSourceTaskfoldernodesFolder.exists())
FileUtils.copyDirToDir(fSourceTaskfoldernodesFolder, fTargetCourseBasePath, false, "copy task folder directories");
// update references
List<Reference> refs = referenceManager.getReferences(sourceCourse);
int count = 0;
for (Reference ref : refs) {
referenceManager.addReference(targetCourse, ref.getTarget(), ref.getUserdata());
if (count % 20 == 0) {
DBFactory.getInstance().intermediateCommit();
}
}
// set quotas
Quota sourceQuota = VFSManager.isTopLevelQuotaContainer(sourceCourse.getCourseFolderContainer());
Quota targetQuota = VFSManager.isTopLevelQuotaContainer(targetCourse.getCourseFolderContainer());
if (sourceQuota != null && targetQuota != null) {
QuotaManager qm = QuotaManager.getInstance();
if (sourceQuota.getQuotaKB() != qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE).getQuotaKB()) {
targetQuota = qm.createQuota(targetQuota.getPath(), sourceQuota.getQuotaKB(), sourceQuota.getUlLimitKB());
qm.setCustomQuotaKB(targetQuota);
}
}
}
return targetRes;
}
Aggregations