private boolean hasPositiveUserKey(MailboxACL.Entry entry) { return !entry.getKey().isNegative() && entry.getKey().getNameType().equals(MailboxACL.NameType.user); } }
/** * Creates a filter matching messages whose Address header contains the * given address. The address header of the message MUST get canonicalized * before try to match it. * * @param type * @param address * @return <code>Criterion</code> */ public static Criterion address(AddressType type, String address) { return new HeaderCriterion(type.name(), new AddressOperator(address)); }
/** * Return a read-only {@link Iterator} which contains all uid which fall in the specified range. */ @Override public Iterator<MessageUid> iterator() { return new RangeIterator(getUidFrom(), getUidTo()); }
@Override public long size() throws MailboxException { return result.getHeaders().size(); }
public static <U extends QuotaValue<U>> SerializableQuota<U> newInstance(U used, U max) { return new SerializableQuota<>( new SerializableQuotaValue<>(used), new SerializableQuotaValue<>(max) ); }
@Override public Optional<Cid> apply(CidValidator cidValidator, String value) { cidValidator.validate(value); if (isWrappedWithAngleBrackets(value)) { return unwrap(value, cidValidator); } return toCid(cidValidator, value); }
/** * Creates a filter for message size less than the given value * * @param value * messages with size less than this value will be selected by * the returned criterion * @return <code>Criterion</code>, not null */ public static Criterion sizeLessThan(long value) { return new SizeCriterion(new NumericOperator(value, NumericComparator.LESS_THAN)); }
/** * Creates a filter for message mod-sequence greater than the given value * * @param value * messages with mod-sequence greater than this value will be * selected by the returned criterion * @return <code>Criterion</code>, not null */ public static Criterion modSeqGreaterThan(long value) { return new ModSeqCriterion(new NumericOperator(value, NumericComparator.GREATER_THAN)); }
/** * Creates a filter on the given flag selecting messages where the given * flag is not selected. * * @param flag * <code>Flag</code>, not null * @return <code>Criterion</code>, not null */ public static Criterion flagIsUnSet(String flag) { return new CustomFlagCriterion(flag, BooleanOperator.unset()); }
/** * Creates a filter on the given flag selecting messages where the given * flag is selected. * * @param flag * <code>Flag</code>, not null * @return <code>Criterion</code>, not null */ public static Criterion flagIsSet(Flag flag) { return new FlagCriterion(flag, BooleanOperator.set()); }
/** * Creates a filter on the given flag selecting messages where the given * flag is selected. * * @param flag * <code>Flag</code>, not null * @return <code>Criterion</code>, not null */ public static Criterion flagIsSet(String flag) { return new CustomFlagCriterion(flag, BooleanOperator.set()); }
/** * Creates a filter on the given flag selecting messages where the given * flag is not selected. * * @param flag * <code>Flag</code>, not null * @return <code>Criterion</code>, not null */ public static Criterion flagIsUnSet(Flag flag) { return new FlagCriterion(flag, BooleanOperator.unset()); }
/** * Creates a filter matching messages with a header matching the given name. * * All to-compared Strings MUST BE converted to uppercase before doing so * (this also include the search value) * * @param headerName * name of the header whose value will be compared, not null * @return <code>Criterion</code>, not null */ public static Criterion headerExists(String headerName) { return new HeaderCriterion(headerName, ExistsOperator.exists()); }
/** * Creates a filter for message size greater than the given value * * @param value * messages with size greater than this value will be selected by * the returned criterion * @return <code>Criterion</code>, not null */ public static Criterion sizeGreaterThan(long value) { return new SizeCriterion(new NumericOperator(value, NumericComparator.GREATER_THAN)); }
/** * Creates a filter for message mod-sequence less than the given value * * @param value * messages with mod-sequence less than this value will be * selected by the returned criterion * @return <code>Criterion</code>, not null */ public static Criterion modSeqLessThan(long value) { return new ModSeqCriterion(new NumericOperator(value, NumericComparator.LESS_THAN)); }
/** * Creates a filter for message size equal to the given value * * @param value * messages with size equal to this value will be selected by the * returned criterion * @return <code>Criterion</code>, not null */ public static Criterion sizeEquals(long value) { return new SizeCriterion(new NumericOperator(value, NumericComparator.EQUALS)); }
/** * Creates a filter for message mod-sequence equal to the given value * * @param value * messages with mod-sequence equal to this value will be * selected by the returned criterion * @return <code>Criterion</code>, not null */ public static Criterion modSeqEquals(long value) { return new ModSeqCriterion(new NumericOperator(value, NumericComparator.EQUALS)); }