From 363c812d10e3249e4e8efb6cbc09053d94812509 Mon Sep 17 00:00:00 2001 From: mcilwain Date: Fri, 4 Mar 2016 08:27:27 -0800 Subject: [PATCH] Change all uses of legacy sharedFields to use EppResource fields This is the penultimate step of migrating away from sharedFields. The next step is to remove them entirely. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=116364048 --- .../registry/model/BackupGroupRoot.java | 7 ++----- .../domain/registry/model/EppResource.java | 21 +------------------ .../registry/model/EppResourceUtils.java | 7 +++---- .../domain/registry/rdap/RdapActionBase.java | 2 +- .../registry/rdap/RdapDomainSearchAction.java | 4 ++-- .../registry/rdap/RdapEntitySearchAction.java | 2 +- .../rdap/RdapNameserverSearchAction.java | 2 +- 7 files changed, 11 insertions(+), 34 deletions(-) diff --git a/java/com/google/domain/registry/model/BackupGroupRoot.java b/java/com/google/domain/registry/model/BackupGroupRoot.java index bd84b4dcb..b96979436 100644 --- a/java/com/google/domain/registry/model/BackupGroupRoot.java +++ b/java/com/google/domain/registry/model/BackupGroupRoot.java @@ -14,8 +14,6 @@ package com.google.domain.registry.model; -import com.google.domain.registry.model.EppResource.SharedFields; - import javax.xml.bind.annotation.XmlTransient; /** @@ -30,9 +28,8 @@ public abstract class BackupGroupRoot extends ImmutableObject { /** * An automatically managed timestamp of when this object was last written to datastore. * - *

Note that this is distinct from the EPP-specified {@link SharedFields#lastUpdateTime} on - * {@link EppResource} objects, in that it is updated on every save, rather than just in response - * to an {@code } command. + *

Note that this is distinct from the EPP-specified {@link EppResource#lastEppUpdateTime}, in + * that this is updated on every save, rather than only in response to an {@code } command */ @XmlTransient UpdateAutoTimestamp updateTimestamp = UpdateAutoTimestamp.create(null); diff --git a/java/com/google/domain/registry/model/EppResource.java b/java/com/google/domain/registry/model/EppResource.java index 8b375cef2..60aca3d58 100644 --- a/java/com/google/domain/registry/model/EppResource.java +++ b/java/com/google/domain/registry/model/EppResource.java @@ -35,7 +35,6 @@ import com.googlecode.objectify.annotation.Embed; import com.googlecode.objectify.annotation.Id; import com.googlecode.objectify.annotation.IgnoreSave; import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.OnLoad; import com.googlecode.objectify.condition.IfNull; import org.joda.time.DateTime; @@ -62,6 +61,7 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable, // TODO(b/19035583): Remove this after touching all resources and waiting long enough to be sure // we don't need to reload old commit logs. @XmlTransient + @Deprecated SharedFields sharedFields = new SharedFields(); /** The ID of the registrar that is currently sponsoring this resource. */ @@ -272,25 +272,6 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable, TransferData transferData; } - /** Read sharedFields values into their new locations. */ - // TODO(b/25442343,b/19035583): Remove this. - @OnLoad - public void loadLegacySharedFields() { - currentSponsorClientId = sharedFields.currentSponsorClientId; - creationClientId = sharedFields.creationRegistryClientId; - lastEppUpdateClientId = sharedFields.lastUpdateRegistryClientId; - creationTime = sharedFields.creationTime; - deletionTime = sharedFields.deletionTime; - lastEppUpdateTime = sharedFields.lastUpdateTime; - lastTransferTime = sharedFields.lastTransferTime; - status = sharedFields.statusValues == null - ? null - : FluentIterable.from(sharedFields.statusValues) - .transform(StatusValue.LEGACY_CONVERTER.reverse()) - .toSet(); - transferData = sharedFields.transferData; - } - /** Abstract builder for {@link EppResource} types. */ public abstract static class Builder> extends GenericBuilder { diff --git a/java/com/google/domain/registry/model/EppResourceUtils.java b/java/com/google/domain/registry/model/EppResourceUtils.java index a2d9fb38a..a0d990aa6 100644 --- a/java/com/google/domain/registry/model/EppResourceUtils.java +++ b/java/com/google/domain/registry/model/EppResourceUtils.java @@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableSet; import com.google.domain.registry.config.RegistryEnvironment; import com.google.domain.registry.model.EppResource.Builder; import com.google.domain.registry.model.EppResource.ForeignKeyedEppResource; -import com.google.domain.registry.model.EppResource.SharedFields; import com.google.domain.registry.model.contact.ContactResource; import com.google.domain.registry.model.domain.DomainBase; import com.google.domain.registry.model.domain.ReferenceUnion; @@ -179,7 +178,7 @@ public final class EppResourceUtils { } /** - * Loads resources that match some filter and that have {@link SharedFields#deletionTime} that is + * Loads resources that match some filter and that have {@link EppResource#deletionTime} that is * not before "now". * *

This is an eventually consistent query. @@ -194,7 +193,7 @@ public final class EppResourceUtils { return transform( ofy().load().type(clazz) .filter(filterDefinition, filterValue) - .filter("sharedFields.deletionTime >", now.toDate()), + .filter("deletionTime >", now.toDate()), EppResourceUtils.transformAtTime(now)); } @@ -379,7 +378,7 @@ public final class EppResourceUtils { ? "allContacts.contactId.linked" : "nameservers.linked", ref) - .filter("sharedFields.deletionTime >", now) + .filter("deletionTime >", now) .limit(limit) .keys() .list(); diff --git a/java/com/google/domain/registry/rdap/RdapActionBase.java b/java/com/google/domain/registry/rdap/RdapActionBase.java index 1f3eb7c91..bc67ced41 100644 --- a/java/com/google/domain/registry/rdap/RdapActionBase.java +++ b/java/com/google/domain/registry/rdap/RdapActionBase.java @@ -172,7 +172,7 @@ public abstract class RdapActionBase implements Runnable { .type(clazz) .filter(filterField + " >=", partialStringQuery.getInitialString()) .filter(filterField + " <", partialStringQuery.getNextInitialString()) - .filter("sharedFields.deletionTime", END_OF_TIME) + .filter("deletionTime", END_OF_TIME) .limit(resultSetMaxSize); } } diff --git a/java/com/google/domain/registry/rdap/RdapDomainSearchAction.java b/java/com/google/domain/registry/rdap/RdapDomainSearchAction.java index 23aa7b31e..f67c19300 100644 --- a/java/com/google/domain/registry/rdap/RdapDomainSearchAction.java +++ b/java/com/google/domain/registry/rdap/RdapDomainSearchAction.java @@ -230,7 +230,7 @@ public class RdapDomainSearchAction extends RdapActionBase { .load() .type(HostResource.class) .filter("inetAddresses", inetAddress.getHostAddress()) - .filter("sharedFields.deletionTime", END_OF_TIME) + .filter("deletionTime", END_OF_TIME) .limit(1000) .keys(); ImmutableList.Builder> builder = new ImmutableList.Builder<>(); @@ -258,7 +258,7 @@ public class RdapDomainSearchAction extends RdapActionBase { Query query = ofy().load() .type(DomainResource.class) .filter("nameservers.linked in", chunk) - .filter("sharedFields.deletionTime >", now) + .filter("deletionTime >", now) .limit(1000); for (DomainResource domainResource : query) { builder.add( diff --git a/java/com/google/domain/registry/rdap/RdapEntitySearchAction.java b/java/com/google/domain/registry/rdap/RdapEntitySearchAction.java index 4a117297f..d67c03a94 100644 --- a/java/com/google/domain/registry/rdap/RdapEntitySearchAction.java +++ b/java/com/google/domain/registry/rdap/RdapEntitySearchAction.java @@ -134,7 +134,7 @@ public class RdapEntitySearchAction extends RdapActionBase { .filterKey(">=", Key.create(ContactResource.class, partialStringQuery.getInitialString())) .filterKey( "<", Key.create(ContactResource.class, partialStringQuery.getNextInitialString())) - .filter("sharedFields.deletionTime", END_OF_TIME) + .filter("deletionTime", END_OF_TIME) .limit(rdapResultSetMaxSize); for (ContactResource contactResource : query) { builder.add(RdapJsonFormatter.makeRdapJsonForContact( diff --git a/java/com/google/domain/registry/rdap/RdapNameserverSearchAction.java b/java/com/google/domain/registry/rdap/RdapNameserverSearchAction.java index bcc58e6ac..b1f511217 100644 --- a/java/com/google/domain/registry/rdap/RdapNameserverSearchAction.java +++ b/java/com/google/domain/registry/rdap/RdapNameserverSearchAction.java @@ -169,7 +169,7 @@ public class RdapNameserverSearchAction extends RdapActionBase { .load() .type(HostResource.class) .filter("inetAddresses", inetAddress.getHostAddress()) - .filter("sharedFields.deletionTime", END_OF_TIME) + .filter("deletionTime", END_OF_TIME) .limit(rdapResultSetMaxSize); ImmutableList.Builder> builder = new ImmutableList.Builder<>(); for (HostResource hostResource : query) {