Examples of Quota


Examples of org.jclouds.openstack.nova.v2_0.domain.Quota

   }

   public void testUpdateQuotasOfCurrentTenantThenReset() {
      if (apiOption.isPresent()) {
         QuotaApi api = apiOption.get();
         Quota before = api.getByTenant(tenant);
         assertQuotasIsValid(before);

         Quota modified = before.toBuilder()
               .cores(before.getCores() - 1)
               .instances(before.getInstances() - 1)
               .metadataItems(before.getMetadatas() - 1)
               .ram(before.getRam() - 1)
               .volumes(before.getVolumes() - 1)
View Full Code Here

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

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

        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

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

   */
  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

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

    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

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

  /**
   * @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

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

    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

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

    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

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

   */
  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

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

   *
   * @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
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.