Get rid of ReferenceUnions entirely

This is the third and final phase in the migration away from ReferenceUnions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=138778148
This commit is contained in:
mcilwain 2016-11-10 10:46:16 -08:00 committed by Ben McIlwain
parent 8d97fa5858
commit 780a5add78
14 changed files with 5 additions and 148 deletions

View file

@ -40,7 +40,6 @@ import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.IgnoreSave;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.OnSave;
import com.googlecode.objectify.condition.IfNull;
import google.registry.model.EppResource;
import google.registry.model.contact.ContactResource;
@ -77,10 +76,6 @@ public abstract class DomainBase extends EppResource {
String tld;
/** References to hosts that are the nameservers for the domain. */
@XmlTransient
//TODO(b/28713909): Delete this once migration away from ReferenceUnions is complete.
Set<ReferenceUnion<HostResource>> nameservers;
@Index
@XmlTransient
Set<Key<HostResource>> nsHosts;
@ -234,18 +229,6 @@ public abstract class DomainBase extends EppResource {
return tld;
}
@OnSave
void dualSaveReferenceUnions() {
for (DesignatedContact contact : nullToEmptyImmutableCopy(allContacts)) {
contact.contactId = ReferenceUnion.create(contact.contact);
}
ImmutableSet.Builder<ReferenceUnion<HostResource>> hosts = new ImmutableSet.Builder<>();
for (Key<HostResource> hostKey : nullToEmptyImmutableCopy(nsHosts)) {
hosts.add(ReferenceUnion.create(hostKey));
}
nameservers = hosts.build();
}
/** Predicate to determine if a given {@link DesignatedContact} is the registrant. */
private static final Predicate<DesignatedContact> IS_REGISTRANT =
new Predicate<DesignatedContact>() {