Changeset 7155


Ignore:
Timestamp:
May 23, 2016, 12:47:45 PM (5 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #2008: It is not possible to change quota values

Location:
trunk/src/core/net/sf/basedb/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Quota.java

    r7016 r7155  
    406406    else
    407407    {
    408       qi.setMaxBytes(bytes);
    409       getData().getQuotaValues().add(qi);
     408      QuotaIndex existing = qi.find(getData().getQuotaValues());
     409      if (existing != null)
     410      {
     411        existing.setMaxBytes(bytes);
     412      }
     413      else
     414      {
     415        qi.setMaxBytes(bytes);
     416        getData().getQuotaValues().add(qi);
     417      }
    410418    }
    411419  }
  • trunk/src/core/net/sf/basedb/core/data/QuotaIndex.java

    r6870 r7155  
    108108  public Long findMaxBytes(Set<QuotaIndex> quota)
    109109  {
     110    QuotaIndex qi = find(quota);
     111    return qi == null ? null : qi.getMaxBytes();
     112  }
     113 
     114  /**
     115    Find the quota entry in the given set that correpsonds to
     116    the same quota type and location as this index.
     117    @since 3.9
     118  */
     119  public QuotaIndex find(Set<QuotaIndex> quota)
     120  {
    110121    if (quota == null) return null;
    111122    for (QuotaIndex qi : quota)
     
    113124      if (this.equals(qi))
    114125      {
    115         return qi.getMaxBytes();
     126        return qi;
    116127      }
    117128    }
Note: See TracChangeset for help on using the changeset viewer.