mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 00:47:11 +02:00
Remove nearly all uses of ReferenceUnion
ReferenceUnion is a hack to work around the mismatch between how we store references (by roid) and how they are represented in EPP (by foreign key). If it ever needed to exist (not entirely clear...) it should have remained tightly scoped within the domain commands and resources. Instead it has leaked everywhere in the project, causing lots of boilerplate. This CL hides all of that behind standard Refs, and should be followed by work to remove ReferenceUnion completely. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=122424416
This commit is contained in:
parent
56c8bb0f2a
commit
9a2afc7a9b
59 changed files with 448 additions and 454 deletions
|
@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.Iterables;
|
||||
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Ref;
|
||||
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.flows.EppException;
|
||||
|
@ -30,7 +31,6 @@ import google.registry.flows.async.AsyncFlowUtils;
|
|||
import google.registry.flows.async.DeleteEppResourceAction;
|
||||
import google.registry.flows.async.DeleteHostResourceAction;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.ReferenceUnion;
|
||||
import google.registry.model.host.HostCommand.Delete;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.host.HostResource.Builder;
|
||||
|
@ -50,7 +50,7 @@ public class HostDeleteFlow extends ResourceAsyncDeleteFlow<HostResource, Builde
|
|||
private static final int FAILFAST_CHECK_COUNT = 5;
|
||||
|
||||
@Override
|
||||
protected boolean isLinkedForFailfast(final ReferenceUnion<HostResource> ref) {
|
||||
protected boolean isLinkedForFailfast(final Ref<HostResource> ref) {
|
||||
// Query for the first few linked domains, and if found, actually load them. The query is
|
||||
// eventually consistent and so might be very stale, but the direct load will not be stale,
|
||||
// just non-transactional. If we find at least one actual reference then we can reliably
|
||||
|
@ -58,7 +58,7 @@ public class HostDeleteFlow extends ResourceAsyncDeleteFlow<HostResource, Builde
|
|||
return Iterables.any(
|
||||
ofy().load().keys(
|
||||
queryDomainsUsingResource(
|
||||
HostResource.class, ref.getLinked(), now, FAILFAST_CHECK_COUNT)).values(),
|
||||
HostResource.class, ref, now, FAILFAST_CHECK_COUNT)).values(),
|
||||
new Predicate<DomainBase>() {
|
||||
@Override
|
||||
public boolean apply(DomainBase domain) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue