Package org.olat.core.util.vfs

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


    // it doesn't show up as a OlatRootFolderImpl to prevent it from editing its MetaData
    OlatNamedContainerImpl vfsNamedPrivate = new OlatNamedContainerImpl("private", vfsPrivate);
   
    // set quota for this merge source
    QuotaManager qm = QuotaManager.getInstance();
    Quota quota = qm.getCustomQuotaOrDefaultDependingOnRole(identity, getRootPathFor(identity));
    FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(quota);

    homeMergeSource.setLocalSecurityCallback(secCallback);
    homeMergeSource.addContainer(vfsNamedPublic);
    homeMergeSource.addContainer(vfsNamedPrivate);
View Full Code Here


        folderContainer.contextPut("editQuota", Boolean.FALSE);
        return;
      }
    }

    Quota q = VFSManager.isTopLevelQuotaContainer(folderComponent.getCurrentContainer());
    folderContainer.contextPut("editQuota", (q == null)? Boolean.FALSE : Boolean.TRUE);
  }
View Full Code Here

   */
  public void event(UserRequest ureq, Controller source, Event event) {
    if (source == quotaEditController) {
      if (event == Event.CHANGED_EVENT) {
        // update quota
        Quota newQuota = QuotaManager.getInstance().getCustomQuota(currentSecCallback.getQuota().getPath());
        if (newQuota != null) currentSecCallback.setQuota(newQuota);
      } else if (event == Event.CANCELLED_EVENT) {
        // do nothing
      }
      fireEvent(ureq, FOLDERCOMMAND_FINISHED);
View Full Code Here

    File fCourseFolder = isolatedCourseFolder.getBasefile();
    if (!fCourseFolder.exists() && !fCourseFolder.mkdirs()) throw new OLATRuntimeException(this.getClass(),
        "could not create course's coursefolder path:" + fCourseFolder.getAbsolutePath(), null);
   
    QuotaManager qm = QuotaManager.getInstance();
    Quota q = qm.getCustomQuota(isolatedCourseFolder.getRelPath());
    if (q == null){
      Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE);
      q = QuotaManager.getInstance().createQuota(isolatedCourseFolder.getRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
    }
    FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(q);
    isolatedCourseFolder.setLocalSecurityCallback(secCallback);
    return isolatedCourseFolder;
  }
View Full Code Here

  /**
   * @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
   */
  public Object getValueAt(int row, int col) {
    Quota q = (Quota) quotaList.get(row);
    switch (col) {
      case 0:
        return q.getPath();
      case 1:
        return q.getQuotaKB();
      case 2:
        return q.getUlLimitKB();
      case 3:
        return "Choose";
      default:
        return "error";
    }
View Full Code Here

    Tracing.logInfo("Successfully initialized Quota Manager", QuotaManagerImpl.class);
  }

  private void initDefaultQuotas() {
    defaultQuotas = new HashMap<String,Quota>();
    Quota defaultQuotaUsers = initDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_USERS);
    defaultQuotas.put(QuotaConstants.IDENTIFIER_DEFAULT_USERS, defaultQuotaUsers);
    Quota defaultQuotaPowerusers = initDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_POWER);
    defaultQuotas.put(QuotaConstants.IDENTIFIER_DEFAULT_POWER, defaultQuotaPowerusers);
    Quota defaultQuotaGroups = initDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS);
    defaultQuotas.put(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS, defaultQuotaGroups);
    Quota defaultQuotaRepository = initDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_REPO);
    defaultQuotas.put(QuotaConstants.IDENTIFIER_DEFAULT_REPO, defaultQuotaRepository);
    Quota defaultQuotaCourseFolder = initDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE);
    defaultQuotas.put(QuotaConstants.IDENTIFIER_DEFAULT_COURSE, defaultQuotaCourseFolder);
    Quota defaultQuotaNodeFolder = initDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES);
    defaultQuotas.put(QuotaConstants.IDENTIFIER_DEFAULT_NODES, defaultQuotaNodeFolder);
  }
View Full Code Here

    Quota defaultQuotaNodeFolder = initDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES);
    defaultQuotas.put(QuotaConstants.IDENTIFIER_DEFAULT_NODES, defaultQuotaNodeFolder);
  }

  private Quota initDefaultQuota(String quotaIdentifier) {
    Quota q = null;
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findProperty(null, null, quotaResource, QUOTA_CATEGORY, quotaIdentifier);
    if (p != null) q = parseQuota(p);
    if (q != null) return q;
    // initialize default quota
View Full Code Here

   */
  private Quota parseQuota(Property p) {
    String s = p.getStringValue();
    int delim = s.indexOf(':');
    if (delim == -1) return null;
    Quota q = null;
    try {
      Long quotaKB = new Long(s.substring(0, delim));
      Long ulLimitKB = new Long(s.substring(delim + 1));
      q = createQuota(p.getName(), quotaKB, ulLimitKB);
    } catch (NumberFormatException e) {
View Full Code Here

   *
   * @param identity
   * @return custom quota or quota depending on role
   */
  public Quota getCustomQuotaOrDefaultDependingOnRole(Identity identity, String relPath) {
    Quota quota = getCustomQuota(relPath);
    if (quota == null) { // no custom quota
      if (ManagerFactory.getManager().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR)) { return createQuota(relPath, getDefaultQuotaPowerUsers().getQuotaKB(), getDefaultQuotaPowerUsers().getUlLimitKB());
      }
      if (ManagerFactory.getManager().isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_ADMIN)) { return createQuota(relPath, getDefaultQuotaPowerUsers().getQuotaKB(), getDefaultQuotaPowerUsers().getUlLimitKB());
      }
View Full Code Here

      main.setContent(myContent);
    }

    if (source == tableCtr && event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent)event;
        Quota q = quotaTableModel.getRowData(te.getRowId());
        if (te.getActionId().equals("qf.edit")) {
          // clean up old controller first
          if (quotaEditCtr != null) removeAsListenerAndDispose(quotaEditCtr);
          // start edit workflow in dedicated quota edit controller
          quotaEditCtr = new GenericQuotaEditController(ureq, getWindowControl(), q);
          listenTo(quotaEditCtr);
          main.setContent(quotaEditCtr.getInitialComponent());

        } else if (te.getActionId().equals("qf.del")) {
          // try to delete quota
          boolean deleted = QuotaManager.getInstance().deleteCustomQuota(q);
          if (deleted) {
            quotaTableModel.refresh();
            tableCtr.setTableDataModel(quotaTableModel);
            showInfo("qf.deleted", q.getPath());
          } else {
            // default quotas can not be qf.cannot.del.default")deleted
            showError("qf.cannot.del.default");
          }
        }
View Full Code Here

TOP

Related Classes of org.olat.core.util.vfs.Quota

Copyright © 2018 www.massapicom. 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.