From c2445c379728d2cecab502578cd4be1fd1282193 Mon Sep 17 00:00:00 2001 From: shicong Date: Thu, 7 Feb 2019 07:28:14 -0800 Subject: [PATCH] Rename loadByForeignKeys to loadByForeignKeysCached This is to remind the user that the function actually uses cache, and also for naming consistency with EppResourceUtils.loadByForeignKeyCached(). ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=232870846 --- .../registry/model/domain/DomainCommand.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/java/google/registry/model/domain/DomainCommand.java b/java/google/registry/model/domain/DomainCommand.java index dd9764196..d8c824b61 100644 --- a/java/google/registry/model/domain/DomainCommand.java +++ b/java/google/registry/model/domain/DomainCommand.java @@ -388,11 +388,12 @@ public class DomainCommand { /** Creates a copy of this {@link Change} with hard links to hosts and contacts. */ Change cloneAndLinkReferences(DateTime now) throws InvalidReferencesException { Change clone = clone(this); - clone.registrant = Strings.isNullOrEmpty(clone.registrantContactId) - ? null - : getOnlyElement( - loadByForeignKeys( - ImmutableSet.of(clone.registrantContactId), ContactResource.class, now) + clone.registrant = + Strings.isNullOrEmpty(clone.registrantContactId) + ? null + : getOnlyElement( + loadByForeignKeysCached( + ImmutableSet.of(clone.registrantContactId), ContactResource.class, now) .values()); return clone; } @@ -420,7 +421,7 @@ public class DomainCommand { return null; } return ImmutableSet.copyOf( - loadByForeignKeys(fullyQualifiedHostNames, HostResource.class, now).values()); + loadByForeignKeysCached(fullyQualifiedHostNames, HostResource.class, now).values()); } private static Set linkContacts( @@ -433,7 +434,7 @@ public class DomainCommand { foreignKeys.add(contact.contactId); } ImmutableMap> loadedContacts = - loadByForeignKeys(foreignKeys.build(), ContactResource.class, now); + loadByForeignKeysCached(foreignKeys.build(), ContactResource.class, now); ImmutableSet.Builder linkedContacts = new ImmutableSet.Builder<>(); for (ForeignKeyedDesignatedContact contact : contacts) { linkedContacts.add(DesignatedContact.create( @@ -442,8 +443,8 @@ public class DomainCommand { return linkedContacts.build(); } - /** Loads keys to EPP resources by their foreign keys. */ - private static ImmutableMap> loadByForeignKeys( + /** Loads keys to cached EPP resources by their foreign keys. */ + private static ImmutableMap> loadByForeignKeysCached( final Set foreignKeys, final Class clazz, final DateTime now) throws InvalidReferencesException { Map> fkis = ForeignKeyIndex.loadCached(clazz, foreignKeys, now);