本文整理了Java中org.apache.james.mailbox.model.Quota.getLimit
方法的一些代码示例,展示了Quota.getLimit
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota.getLimit
方法的具体详情如下:
包路径:org.apache.james.mailbox.model.Quota
类名称:Quota
方法名:getLimit
暂无
代码示例来源:origin: apache/james-project
@Override
public boolean equals(Object o) {
if (o == null || ! (o instanceof Quota)) {
return false;
}
Quota<?> other = (Quota<?>) o;
return Objects.equal(used, other.getUsed())
&& Objects.equal(limit,other.getLimit());
}
代码示例来源:origin: org.apache.james.protocols/protocols-imap
@Override
public String toString() {
StringBuilder result = new StringBuilder()
.append(ImapConstants.QUOTA_RESPONSE_NAME)
.append(' ')
.append(quotaRoot)
.append(' ')
.append('(')
.append(resourceName)
.append(' ')
.append(quota.getUsed())
.append(' ')
.append(quota.getLimit())
.append(')');
return result.toString();
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-quota-mailing
private HashMap<String, Object> computeScopes() {
HashMap<String, Object> scopes = new HashMap<>();
scopes.put("hasExceededSizeThreshold", sizeThreshold.isPresent());
scopes.put("hasExceededCountThreshold", countThreshold.isPresent());
sizeThreshold.ifPresent(value -> scopes.put("sizeThreshold", value.getQuotaOccupationRatioAsPercent()));
countThreshold.ifPresent(value -> scopes.put("countThreshold", value.getQuotaOccupationRatioAsPercent()));
scopes.put("usedSize", SizeFormat.format(sizeQuota.getUsed().asLong()));
scopes.put("hasSizeLimit", sizeQuota.getLimit().isLimited());
if (sizeQuota.getLimit().isLimited()) {
scopes.put("limitSize", SizeFormat.format(sizeQuota.getLimit().asLong()));
}
scopes.put("usedCount", countQuota.getUsed().asLong());
scopes.put("hasCountLimit", countQuota.getLimit().isLimited());
if (countQuota.getLimit().isLimited()) {
scopes.put("limitCount", sizeQuota.getLimit().asLong());
}
return scopes;
}
代码示例来源:origin: apache/james-project
public static <U extends QuotaValue<U>> SerializableQuota<U> newInstance(Quota<U> quota) {
return newInstance(quota.getUsed(), quota.getLimit());
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-quota-mailing
public boolean isExceeded(Quota<?> quota) {
if (quota.getLimit().isUnlimited()) {
return false;
}
double used = toDouble(quota.getUsed().asLong());
double limit = toDouble(quota.getLimit().asLong());
double ratio = (used / limit);
return ratio > quotaOccupationRatio;
}
代码示例来源:origin: org.apache.james/james-server-jmap
private <T extends QuotaValue<T>> Quotas.Value<T> quotaToValue(Quota<T> quota) {
return new Quotas.Value<>(
quotaValueToNumber(quota.getUsed()),
quotaValueToOptionalNumber(quota.getLimit()));
}
代码示例来源:origin: org.apache.james.protocols/protocols-imap
private void writeMessagesCount(ImapResponseComposer composer, Quota<?> quota) throws IOException {
composer.message(quota.getUsed().asLong());
composer.message(quota.getLimit().asLong());
}
代码示例来源:origin: org.apache.james.protocols/protocols-imap
private void writeMessagesSize(ImapResponseComposer composer, Quota<?> quota) throws IOException {
composer.message(quota.getUsed().asLong() / 1024);
composer.message(quota.getLimit().asLong() / 1024);
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-store
private void trySizeAddition(long size) throws OverQuotaException {
Quota<QuotaSize> afterAdditionQuotaSize = sizeQuota.addValueToQuota(QuotaSize.size(size));
if (afterAdditionQuotaSize.isOverQuota()) {
throw new OverQuotaException(
"You use too much space in " + quotaRoot.getValue(),
afterAdditionQuotaSize.getLimit(),
afterAdditionQuotaSize.getUsed());
}
}
代码示例来源:origin: org.apache.james/apache-james-mailbox-store
private void tryCountAddition(long count) throws OverQuotaException {
Quota<QuotaCount> afterAdditionQuotaCount = messageQuota.addValueToQuota(QuotaCount.count(count));
if (afterAdditionQuotaCount.isOverQuota()) {
throw new OverQuotaException(
"You have too many messages in " + quotaRoot.getValue(),
messageQuota.getLimit(),
messageQuota.getUsed());
}
}
代码示例来源:origin: org.apache.james.protocols/protocols-imap
@Override
protected void doProcess(GetQuotaRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) {
try {
QuotaRoot quotaRoot = quotaRootResolver.fromString(message.getQuotaRoot());
if (hasRight(quotaRoot, session)) {
Quota<QuotaCount> messageQuota = quotaManager.getMessageQuota(quotaRoot);
Quota<QuotaSize> storageQuota = quotaManager.getStorageQuota(quotaRoot);
if (messageQuota.getLimit().isLimited()) {
responder.respond(new QuotaResponse(ImapConstants.MESSAGE_QUOTA_RESOURCE, quotaRoot.getValue(), messageQuota));
}
if (storageQuota.getLimit().isLimited()) {
responder.respond(new QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), storageQuota));
}
okComplete(command, tag, responder);
} else {
Object[] params = new Object[]{
MailboxACL.Right.Read.toString(),
command.getName(),
"Any mailbox of this user USER"
};
HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
no(command, tag, responder, humanReadableText);
}
} catch (MailboxException me) {
taggedBad(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
}
}
代码示例来源:origin: org.apache.james.protocols/protocols-imap
Quota<QuotaSize> storageQuota = quotaManager.getStorageQuota(quotaRoot);
responder.respond(new QuotaRootResponse(message.getMailboxName(), quotaRoot.getValue()));
if (messageQuota.getLimit().isLimited()) {
responder.respond(new QuotaResponse(ImapConstants.MESSAGE_QUOTA_RESOURCE, quotaRoot.getValue(), messageQuota));
if (storageQuota.getLimit().isLimited()) {
responder.respond(new QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), storageQuota));
内容来源于网络,如有侵权,请联系作者删除!