Examples of QuotaManager


Examples of org.olat.core.util.vfs.QuotaManager

  public VFSContainer getContainer(Identity identity) {
    MergeSource cfRoot = new MergeSource(null, null);
    // collect buddy groups
    BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
    QuotaManager qm = QuotaManager.getInstance();
    List<BusinessGroup> groups = bgm.findBusinessGroupsAttendedBy(null, identity, null);
    groups.addAll(bgm.findBusinessGroupsOwnedBy(null, identity, null));

    List<Long> addedGroupKeys = new ArrayList<Long>();
    List<String> addedGroupNames = new ArrayList<String>();
    for (BusinessGroup group : groups) {
      if (addedGroupKeys.contains(group.getKey())) continue; // check for duplicate groups
      CollaborationTools tools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
      if (tools.isToolEnabled(CollaborationTools.TOOL_FOLDER)) {
        String name = group.getName();
        if (addedGroupNames.contains(name)) {
          // attach a serial to the group name to avoid duplicate mount points...
          int serial = 1;
          int serialMax = 100;
          while (addedGroupNames.contains(name + serial) && serial < serialMax) {
            serial++;
          }
          if (serial == serialMax) continue; // continue without adding mount point
          name = name + serial;
        }
       
        // create container and set quota
        OlatRootFolderImpl localImpl = new OlatRootFolderImpl(tools.getFolderRelPath(), cfRoot);
        localImpl.getBasefile().mkdirs(); // lazy initialize dirs
        NamedContainerImpl grpContainer = new NamedContainerImpl(Formatter.makeStringFilesystemSave(name), localImpl);
        Quota q = qm.getCustomQuota(tools.getFolderRelPath());
        if (q == null) {
          Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS);
          q = QuotaManager.getInstance().createQuota(tools.getFolderRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
        }
        FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(q);
        grpContainer.setLocalSecurityCallback(secCallback);
       
View Full Code Here

Examples of org.olat.core.util.vfs.QuotaManager

    this.folderLocked = folderLocked;
    initFolderQuota(relPath);
  }

  private void initFolderQuota(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());
    }
  }
View Full Code Here

Examples of org.olat.core.util.vfs.QuotaManager

      this.subsContext = subsContext;
      initFolderQuota(relPath);
    }

    private void initFolderQuota(String relPath) {
      QuotaManager qm = QuotaManager.getInstance();
      folderQuota = qm.getCustomQuota(relPath);
      if (folderQuota == null) {
        Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS);
        folderQuota = QuotaManager.getInstance().createQuota(relPath, defQuota.getQuotaKB(), defQuota.getUlLimitKB());
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.