Remove unused and misused methods from EppResourceUtils and DomainBase.

The methods in DomainBase were the only callers for the methods in
EppResourceUtils, so I first inlined them. Then I realized that there
were no callers for loadReferencedContacts() anywhere. For loadNameservers(),
all but one invocation actually wanted to load the foreign keys, and was
repeating that work, so I replaced it with loadNameserverFullyQualifiedHostNames().
The last invocation, in the Rdap code, was incorrectly assuming this was an async
load when in fact it blocks, so I replaced it with a real async load.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122433897
This commit is contained in:
Corey Goldfeder 2016-05-16 10:38:26 -07:00 committed by Justine Tunney
parent 9a2afc7a9b
commit d9875ea302
8 changed files with 31 additions and 60 deletions

View file

@ -397,7 +397,8 @@ public class RdapJsonFormatter {
@Nullable String linkBase,
@Nullable String whoisServer) {
// Kick off the database loads of the nameservers that we will need.
ImmutableSet<HostResource> loadedHosts = domainResource.loadNameservers();
Map<Key<HostResource>, HostResource> loadedHosts =
ofy().load().refs(domainResource.getNameservers());
// And the registrant and other contacts.
List<DesignatedContact> allContacts = new ArrayList<>();
if (domainResource.getRegistrant() != null) {
@ -427,7 +428,8 @@ public class RdapJsonFormatter {
}
// Nameservers
ImmutableList.Builder<Object> nsBuilder = new ImmutableList.Builder<>();
for (HostResource hostResource : HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts)) {
for (HostResource hostResource
: HOST_RESOURCE_ORDERING.immutableSortedCopy(loadedHosts.values())) {
nsBuilder.add(makeRdapJsonForHost(hostResource, false, linkBase, null));
}
ImmutableList<Object> ns = nsBuilder.build();