Conform to RDAP Technical Implementation Guide

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=251864499
This commit is contained in:
guyben 2019-06-06 09:18:07 -07:00 committed by jianglai
parent 55dc735ba0
commit ca1d525e28
65 changed files with 869 additions and 709 deletions

View file

@ -14,6 +14,7 @@
package google.registry.rdap;
import com.google.common.base.Ascii;
import com.google.common.collect.Streams;
import google.registry.model.registrar.Registrar;
import java.util.Objects;
@ -30,4 +31,17 @@ public final class RdapUtils {
.filter(registrar -> Objects.equals(ianaIdentifier, registrar.getIanaIdentifier()))
.findFirst();
}
/**
* Looks up a registrar by its name.
*
* <p>Used for RDAP Technical Implementation Guide 2.4.2 - search of registrar by the fn element.
*
* <p>For convenience, we use case insensitive search.
*/
static Optional<Registrar> getRegistrarByName(String registrarName) {
return Streams.stream(Registrar.loadAllCached())
.filter(registrar -> Ascii.equalsIgnoreCase(registrarName, registrar.getRegistrarName()))
.findFirst();
}
}