public Map<EntryKey, Rfc4314Rights> ofPositiveNameType(NameType nameType) { return this.entries.entrySet().stream() .filter(entry -> !entry.getKey().isNegative()) .filter(entry -> entry.getKey().getNameType().equals(nameType)) .collect(Guavate.entriesToMap()); } }
@VisibleForTesting void assertSharesBelongsToUserDomain(String user, Map<EntryKey, Rfc4314Rights> entries) throws DifferentDomainException { if (entries.keySet().stream() .filter(entry -> !entry.getNameType().equals(NameType.special)) .map(EntryKey::getName) .anyMatch(name -> areDomainsDifferent(name, user))) { throw new DifferentDomainException(); } }
public boolean equals(Object o) { if (o instanceof EntryKey) { EntryKey other = (EntryKey) o; return Objects.equals(this.name, other.getName()) && Objects.equals(this.nameType, other.getNameType()) && Objects.equals(this.negative, other.isNegative()); } return false; }
final NameType aclKeyNameType = aclKey.getNameType(); if (SpecialName.anybody.name().equals(aclKeyName)) { } else if (queryKey != null) { String queryUserOrGroupName = queryKey.getName(); switch (queryKey.getNameType()) { case user: throw new IllegalStateException("Unexpected " + NameType.class.getName() + "." + queryKey.getNameType());
private static boolean isSupported(EntryKey key) { if (key.isNegative()) { LOGGER.info("Negative keys are not supported"); return false; } if (key.equals(MailboxACL.OWNER_KEY)) { return false; } if (key.getNameType() != MailboxACL.NameType.user) { LOGGER.info("{} is not supported. Only 'user' is.", key.getNameType()); return false; } return true; }
private boolean hasPositiveUserKey(MailboxACL.Entry entry) { return !entry.getKey().isNegative() && entry.getKey().getNameType().equals(MailboxACL.NameType.user); } }