JAMES-2344 rename Quota max field to limit

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/ece93d03
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/ece93d03
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/ece93d03

Branch: refs/heads/master
Commit: ece93d03d13d3ed184db2daa24c940cdc85a66c1
Parents: b90ce47
Author: Matthieu Baechler <matth...@apache.org>
Authored: Thu Mar 8 10:22:22 2018 +0100
Committer: Matthieu Baechler <matth...@apache.org>
Committed: Tue Mar 13 16:10:28 2018 +0100

----------------------------------------------------------------------
 .../org/apache/james/mailbox/model/Quota.java   | 24 ++++++++++----------
 .../store/mail/model/SerializableQuota.java     |  2 +-
 .../james/mailbox/store/quota/QuotaChecker.java |  4 ++--
 .../james/imap/encode/QuotaResponseEncoder.java |  4 ++--
 .../imap/message/response/QuotaResponse.java    |  2 +-
 .../james/imap/processor/GetQuotaProcessor.java |  4 ++--
 .../imap/processor/GetQuotaRootProcessor.java   |  4 ++--
 .../apache/james/jmap/model/MailboxFactory.java |  2 +-
 8 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
----------------------------------------------------------------------
diff --git 
a/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java 
b/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
index c1dc033..b4579f6 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/model/Quota.java
@@ -25,21 +25,21 @@ import com.google.common.base.Preconditions;
 
 public class Quota<T extends QuotaValue<T>> {
 
-    public static <T extends QuotaValue<T>> Quota<T> quota(T used, T max) {
+    public static <T extends QuotaValue<T>> Quota<T> quota(T used, T limit) {
         Preconditions.checkNotNull(used);
-        return new Quota<>(used, max);
+        return new Quota<>(used, limit);
     }
 
-    private final T max;
+    private final T limit;
     private final T used;
 
-    private Quota(T used, T max) {
+    private Quota(T used, T limit) {
         this.used = used;
-        this.max = max;
+        this.limit = limit;
     }
 
-    public T getMax() {
-        return max;
+    public T getLimit() {
+        return limit;
     }
 
     public T getUsed() {
@@ -47,7 +47,7 @@ public class Quota<T extends QuotaValue<T>> {
     }
 
     public Quota<T> addValueToQuota(T value) {
-        return new Quota<>(used.add(value), max);
+        return new Quota<>(used.add(value), limit);
     }
 
     /**
@@ -61,12 +61,12 @@ public class Quota<T extends QuotaValue<T>> {
 
     public boolean isOverQuotaWithAdditionalValue(long additionalValue) {
         Preconditions.checkArgument(additionalValue >= 0);
-        return max.isLimited() && used.add(additionalValue).isGreaterThan(max);
+        return limit.isLimited() && 
used.add(additionalValue).isGreaterThan(limit);
     }
 
     @Override
     public String toString() {
-        return used + "/" + max;
+        return used + "/" + limit;
     }
 
     @Override
@@ -76,12 +76,12 @@ public class Quota<T extends QuotaValue<T>> {
         }
         Quota<?> other = (Quota<?>) o;
         return Objects.equal(used, other.getUsed())
-            && Objects.equal(max,other.getMax());
+            && Objects.equal(limit,other.getLimit());
     }
 
     @Override
     public int hashCode() {
-        return Objects.hashCode(used, max);
+        return Objects.hashCode(used, limit);
     }
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
----------------------------------------------------------------------
diff --git 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
index d5a6c24..bbd5bbd 100644
--- 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
+++ 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/SerializableQuota.java
@@ -34,7 +34,7 @@ public class SerializableQuota<T extends QuotaValue<T>> 
implements Serializable
     public static final long UNLIMITED = -1;
 
     public static <U extends QuotaValue<U>> SerializableQuota<U> 
newInstance(Quota<U> quota) {
-        return newInstance(quota.getUsed(), quota.getMax());
+        return newInstance(quota.getUsed(), quota.getLimit());
     }
 
     public static <U extends QuotaValue<U>> SerializableQuota<U> newInstance(U 
used, U max) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaChecker.java
----------------------------------------------------------------------
diff --git 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaChecker.java
 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaChecker.java
index 3c1d17e..156f92a 100644
--- 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaChecker.java
+++ 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaChecker.java
@@ -57,7 +57,7 @@ public class QuotaChecker {
         if (afterAdditionQuotaSize.isOverQuota()) {
             throw new OverQuotaException(
                 "You use too much space in " + quotaRoot.getValue(),
-                afterAdditionQuotaSize.getMax(),
+                afterAdditionQuotaSize.getLimit(),
                 afterAdditionQuotaSize.getUsed());
         }
     }
@@ -67,7 +67,7 @@ public class QuotaChecker {
         if (afterAdditionQuotaCount.isOverQuota()) {
             throw new OverQuotaException(
                 "You have too many messages in " + quotaRoot.getValue(),
-                messageQuota.getMax(),
+                messageQuota.getLimit(),
                 messageQuota.getUsed());
         }
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/protocols/imap/src/main/java/org/apache/james/imap/encode/QuotaResponseEncoder.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/encode/QuotaResponseEncoder.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/encode/QuotaResponseEncoder.java
index 6a2d111..8f9e515 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/encode/QuotaResponseEncoder.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/encode/QuotaResponseEncoder.java
@@ -67,12 +67,12 @@ public class QuotaResponseEncoder extends 
AbstractChainedImapEncoder {
 
     private void writeMessagesSize(ImapResponseComposer composer, Quota<?> 
quota) throws IOException {
         composer.message(quota.getUsed().asLong() / 1024);
-        composer.message(quota.getMax().asLong() / 1024);
+        composer.message(quota.getLimit().asLong() / 1024);
     }
 
     private void writeMessagesCount(ImapResponseComposer composer, Quota<?> 
quota) throws IOException {
         composer.message(quota.getUsed().asLong());
-        composer.message(quota.getMax().asLong());
+        composer.message(quota.getLimit().asLong());
     }
 
     /*

http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/protocols/imap/src/main/java/org/apache/james/imap/message/response/QuotaResponse.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/message/response/QuotaResponse.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/message/response/QuotaResponse.java
index 84d586e..5a2e239 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/message/response/QuotaResponse.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/message/response/QuotaResponse.java
@@ -79,7 +79,7 @@ public class QuotaResponse implements ImapResponseMessage {
                 .append(' ')
                 .append(quota.getUsed())
                 .append(' ')
-                .append(quota.getMax())
+                .append(quota.getLimit())
                 .append(')');
         return result.toString();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
index 701272c..3f4d63f 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
@@ -81,10 +81,10 @@ public class GetQuotaProcessor extends 
AbstractMailboxProcessor<GetQuotaRequest>
                 QuotaRoot quotaRoot = 
QuotaRoot.quotaRoot(message.getQuotaRoot());
                 Quota<QuotaCount> messageQuota = 
quotaManager.getMessageQuota(quotaRoot);
                 Quota<QuotaSize> storageQuota = 
quotaManager.getStorageQuota(quotaRoot);
-                if (messageQuota.getMax().isLimited()) {
+                if (messageQuota.getLimit().isLimited()) {
                     responder.respond(new 
QuotaResponse(ImapConstants.MESSAGE_QUOTA_RESOURCE, quotaRoot.getValue(), 
messageQuota));
                 }
-                if (storageQuota.getMax().isLimited()) {
+                if (storageQuota.getLimit().isLimited()) {
                     responder.respond(new 
QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), 
storageQuota));
                 }
                 okComplete(command, tag, responder);

http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
----------------------------------------------------------------------
diff --git 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
index 2740865..a1e5185 100644
--- 
a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
+++ 
b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
@@ -83,10 +83,10 @@ public class GetQuotaRootProcessor extends 
AbstractMailboxProcessor<GetQuotaRoot
                 Quota<QuotaCount> messageQuota = 
quotaManager.getMessageQuota(quotaRoot);
                 Quota<QuotaSize> storageQuota = 
quotaManager.getStorageQuota(quotaRoot);
                 responder.respond(new 
QuotaRootResponse(message.getMailboxName(), quotaRoot.getValue()));
-                if (messageQuota.getMax().isLimited()) {
+                if (messageQuota.getLimit().isLimited()) {
                     responder.respond(new 
QuotaResponse(ImapConstants.MESSAGE_QUOTA_RESOURCE, quotaRoot.getValue(), 
messageQuota));
                 }
-                if (storageQuota.getMax().isLimited()) {
+                if (storageQuota.getLimit().isLimited()) {
                     responder.respond(new 
QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), 
storageQuota));
                 }
                 okComplete(command, tag, responder);

http://git-wip-us.apache.org/repos/asf/james-project/blob/ece93d03/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MailboxFactory.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MailboxFactory.java
 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MailboxFactory.java
index 42a80ab..22bcd41 100644
--- 
a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MailboxFactory.java
+++ 
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/MailboxFactory.java
@@ -153,7 +153,7 @@ public class MailboxFactory {
     private <T extends QuotaValue<T>> Quotas.Value<T> quotaToValue(Quota<T> 
quota) {
         return new Quotas.Value<>(
                 quotaValueToNumber(quota.getUsed()),
-                quotaValueToOptionalNumber(quota.getMax()));
+                quotaValueToOptionalNumber(quota.getLimit()));
     }
 
     private Number quotaValueToNumber(QuotaValue<?> value) {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to