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
This commit is contained in:
mcilwain 2016-03-04 08:27:27 -08:00 committed by Justine Tunney
parent 675ec8f086
commit 363c812d10
7 changed files with 11 additions and 34 deletions

View file

@ -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.
*
* <p>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 <update>} command.
* <p>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 <update>} command
*/
@XmlTransient
UpdateAutoTimestamp updateTimestamp = UpdateAutoTimestamp.create(null);

View file

@ -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<T extends EppResource, B extends Builder<?, ?>>
extends GenericBuilder<T, B> {

View file

@ -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".
*
* <p>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.<T>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();

View file

@ -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);
}
}

View file

@ -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<Ref<HostResource>> builder = new ImmutableList.Builder<>();
@ -258,7 +258,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
Query<DomainResource> 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(

View file

@ -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(

View file

@ -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<ImmutableMap<String, Object>> builder = new ImmutableList.Builder<>();
for (HostResource hostResource : query) {