mirror of
https://github.com/google/nomulus.git
synced 2025-05-19 18:59:35 +02:00
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:
parent
675ec8f086
commit
363c812d10
7 changed files with 11 additions and 34 deletions
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
package com.google.domain.registry.model;
|
package com.google.domain.registry.model;
|
||||||
|
|
||||||
import com.google.domain.registry.model.EppResource.SharedFields;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
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.
|
* 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
|
* <p>Note that this is distinct from the EPP-specified {@link EppResource#lastEppUpdateTime}, in
|
||||||
* {@link EppResource} objects, in that it is updated on every save, rather than just in response
|
* that this is updated on every save, rather than only in response to an {@code <update>} command
|
||||||
* to an {@code <update>} command.
|
|
||||||
*/
|
*/
|
||||||
@XmlTransient
|
@XmlTransient
|
||||||
UpdateAutoTimestamp updateTimestamp = UpdateAutoTimestamp.create(null);
|
UpdateAutoTimestamp updateTimestamp = UpdateAutoTimestamp.create(null);
|
||||||
|
|
|
@ -35,7 +35,6 @@ import com.googlecode.objectify.annotation.Embed;
|
||||||
import com.googlecode.objectify.annotation.Id;
|
import com.googlecode.objectify.annotation.Id;
|
||||||
import com.googlecode.objectify.annotation.IgnoreSave;
|
import com.googlecode.objectify.annotation.IgnoreSave;
|
||||||
import com.googlecode.objectify.annotation.Index;
|
import com.googlecode.objectify.annotation.Index;
|
||||||
import com.googlecode.objectify.annotation.OnLoad;
|
|
||||||
import com.googlecode.objectify.condition.IfNull;
|
import com.googlecode.objectify.condition.IfNull;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
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
|
// 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.
|
// we don't need to reload old commit logs.
|
||||||
@XmlTransient
|
@XmlTransient
|
||||||
|
@Deprecated
|
||||||
SharedFields sharedFields = new SharedFields();
|
SharedFields sharedFields = new SharedFields();
|
||||||
|
|
||||||
/** The ID of the registrar that is currently sponsoring this resource. */
|
/** 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;
|
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. */
|
/** Abstract builder for {@link EppResource} types. */
|
||||||
public abstract static class Builder<T extends EppResource, B extends Builder<?, ?>>
|
public abstract static class Builder<T extends EppResource, B extends Builder<?, ?>>
|
||||||
extends GenericBuilder<T, B> {
|
extends GenericBuilder<T, B> {
|
||||||
|
|
|
@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.domain.registry.config.RegistryEnvironment;
|
import com.google.domain.registry.config.RegistryEnvironment;
|
||||||
import com.google.domain.registry.model.EppResource.Builder;
|
import com.google.domain.registry.model.EppResource.Builder;
|
||||||
import com.google.domain.registry.model.EppResource.ForeignKeyedEppResource;
|
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.contact.ContactResource;
|
||||||
import com.google.domain.registry.model.domain.DomainBase;
|
import com.google.domain.registry.model.domain.DomainBase;
|
||||||
import com.google.domain.registry.model.domain.ReferenceUnion;
|
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".
|
* not before "now".
|
||||||
*
|
*
|
||||||
* <p>This is an eventually consistent query.
|
* <p>This is an eventually consistent query.
|
||||||
|
@ -194,7 +193,7 @@ public final class EppResourceUtils {
|
||||||
return transform(
|
return transform(
|
||||||
ofy().load().type(clazz)
|
ofy().load().type(clazz)
|
||||||
.filter(filterDefinition, filterValue)
|
.filter(filterDefinition, filterValue)
|
||||||
.filter("sharedFields.deletionTime >", now.toDate()),
|
.filter("deletionTime >", now.toDate()),
|
||||||
EppResourceUtils.<T>transformAtTime(now));
|
EppResourceUtils.<T>transformAtTime(now));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +378,7 @@ public final class EppResourceUtils {
|
||||||
? "allContacts.contactId.linked"
|
? "allContacts.contactId.linked"
|
||||||
: "nameservers.linked",
|
: "nameservers.linked",
|
||||||
ref)
|
ref)
|
||||||
.filter("sharedFields.deletionTime >", now)
|
.filter("deletionTime >", now)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.keys()
|
.keys()
|
||||||
.list();
|
.list();
|
||||||
|
|
|
@ -172,7 +172,7 @@ public abstract class RdapActionBase implements Runnable {
|
||||||
.type(clazz)
|
.type(clazz)
|
||||||
.filter(filterField + " >=", partialStringQuery.getInitialString())
|
.filter(filterField + " >=", partialStringQuery.getInitialString())
|
||||||
.filter(filterField + " <", partialStringQuery.getNextInitialString())
|
.filter(filterField + " <", partialStringQuery.getNextInitialString())
|
||||||
.filter("sharedFields.deletionTime", END_OF_TIME)
|
.filter("deletionTime", END_OF_TIME)
|
||||||
.limit(resultSetMaxSize);
|
.limit(resultSetMaxSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
|
||||||
.load()
|
.load()
|
||||||
.type(HostResource.class)
|
.type(HostResource.class)
|
||||||
.filter("inetAddresses", inetAddress.getHostAddress())
|
.filter("inetAddresses", inetAddress.getHostAddress())
|
||||||
.filter("sharedFields.deletionTime", END_OF_TIME)
|
.filter("deletionTime", END_OF_TIME)
|
||||||
.limit(1000)
|
.limit(1000)
|
||||||
.keys();
|
.keys();
|
||||||
ImmutableList.Builder<Ref<HostResource>> builder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<Ref<HostResource>> builder = new ImmutableList.Builder<>();
|
||||||
|
@ -258,7 +258,7 @@ public class RdapDomainSearchAction extends RdapActionBase {
|
||||||
Query<DomainResource> query = ofy().load()
|
Query<DomainResource> query = ofy().load()
|
||||||
.type(DomainResource.class)
|
.type(DomainResource.class)
|
||||||
.filter("nameservers.linked in", chunk)
|
.filter("nameservers.linked in", chunk)
|
||||||
.filter("sharedFields.deletionTime >", now)
|
.filter("deletionTime >", now)
|
||||||
.limit(1000);
|
.limit(1000);
|
||||||
for (DomainResource domainResource : query) {
|
for (DomainResource domainResource : query) {
|
||||||
builder.add(
|
builder.add(
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class RdapEntitySearchAction extends RdapActionBase {
|
||||||
.filterKey(">=", Key.create(ContactResource.class, partialStringQuery.getInitialString()))
|
.filterKey(">=", Key.create(ContactResource.class, partialStringQuery.getInitialString()))
|
||||||
.filterKey(
|
.filterKey(
|
||||||
"<", Key.create(ContactResource.class, partialStringQuery.getNextInitialString()))
|
"<", Key.create(ContactResource.class, partialStringQuery.getNextInitialString()))
|
||||||
.filter("sharedFields.deletionTime", END_OF_TIME)
|
.filter("deletionTime", END_OF_TIME)
|
||||||
.limit(rdapResultSetMaxSize);
|
.limit(rdapResultSetMaxSize);
|
||||||
for (ContactResource contactResource : query) {
|
for (ContactResource contactResource : query) {
|
||||||
builder.add(RdapJsonFormatter.makeRdapJsonForContact(
|
builder.add(RdapJsonFormatter.makeRdapJsonForContact(
|
||||||
|
|
|
@ -169,7 +169,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
|
||||||
.load()
|
.load()
|
||||||
.type(HostResource.class)
|
.type(HostResource.class)
|
||||||
.filter("inetAddresses", inetAddress.getHostAddress())
|
.filter("inetAddresses", inetAddress.getHostAddress())
|
||||||
.filter("sharedFields.deletionTime", END_OF_TIME)
|
.filter("deletionTime", END_OF_TIME)
|
||||||
.limit(rdapResultSetMaxSize);
|
.limit(rdapResultSetMaxSize);
|
||||||
ImmutableList.Builder<ImmutableMap<String, Object>> builder = new ImmutableList.Builder<>();
|
ImmutableList.Builder<ImmutableMap<String, Object>> builder = new ImmutableList.Builder<>();
|
||||||
for (HostResource hostResource : query) {
|
for (HostResource hostResource : query) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue