From cb7f5d13e55c90215b375249e9b13b33213c99c8 Mon Sep 17 00:00:00 2001 From: sarahcaseybot Date: Thu, 2 Sep 2021 13:21:45 -0400 Subject: [PATCH] Remove Datastore references in BaseDomainLabelList (#1304) --- .../model/tld/label/BaseDomainLabelList.java | 22 +++---------------- .../model/tld/label/ReservedListTest.java | 1 - 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/core/src/main/java/google/registry/model/tld/label/BaseDomainLabelList.java b/core/src/main/java/google/registry/model/tld/label/BaseDomainLabelList.java index 27ac2e957..9a5580570 100644 --- a/core/src/main/java/google/registry/model/tld/label/BaseDomainLabelList.java +++ b/core/src/main/java/google/registry/model/tld/label/BaseDomainLabelList.java @@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Strings.isNullOrEmpty; import static com.google.common.collect.ImmutableSet.toImmutableSet; -import static google.registry.model.common.EntityGroupRoot.getCrossTldKey; import static google.registry.model.tld.Registries.getTlds; import com.google.common.cache.CacheLoader.InvalidCacheLoadException; @@ -29,14 +28,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multiset; import com.google.common.util.concurrent.UncheckedExecutionException; -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Parent; import google.registry.model.Buildable; import google.registry.model.ImmutableObject; -import google.registry.model.annotations.InCrossTld; -import google.registry.model.common.EntityGroupRoot; import google.registry.model.tld.Registry; import java.util.HashMap; import java.util.List; @@ -47,37 +40,28 @@ import javax.annotation.Nullable; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; +import javax.persistence.Id; import javax.persistence.MappedSuperclass; -import javax.persistence.Transient; import org.joda.time.DateTime; /** - * Base class for {@link ReservedList} and {@link PremiumList} objects stored in Datastore. + * Base class for {@link ReservedList} and {@link PremiumList} objects. * * @param The type of the root value being listed, e.g. {@link ReservationType}. * @param The type of domain label entry being listed, e.g. {@link * ReservedList.ReservedListEntry} (note, must subclass {@link DomainLabelEntry}. */ @MappedSuperclass -@InCrossTld public abstract class BaseDomainLabelList, R extends DomainLabelEntry> extends ImmutableObject implements Buildable { - @Ignore - @javax.persistence.Id + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long revisionId; - @Id @Column(nullable = false) String name; - @Parent @Transient Key parent = getCrossTldKey(); - - // The list in Cloud SQL is immutable, we only have a creation_timestamp field and it should be - // set to the timestamp when the list is created. In Datastore, we have two fields and the - // lastUpdateTime is set to the current timestamp when creating and updating a list. So, we use - // lastUpdateTime as the creation_timestamp column during the dual-write phase for compatibility. @Column(name = "creation_timestamp") DateTime creationTimestamp; diff --git a/core/src/test/java/google/registry/model/tld/label/ReservedListTest.java b/core/src/test/java/google/registry/model/tld/label/ReservedListTest.java index 1e6cfb715..8a3f53362 100644 --- a/core/src/test/java/google/registry/model/tld/label/ReservedListTest.java +++ b/core/src/test/java/google/registry/model/tld/label/ReservedListTest.java @@ -286,7 +286,6 @@ class ReservedListTest { ReservedList clone = original.asBuilder().build(); assertThat(clone.getName()).isEqualTo("tld-reserved-cloning"); assertThat(clone.creationTimestamp).isEqualTo(original.creationTimestamp); - assertThat(clone.parent).isEqualTo(original.parent); assertThat(original.getReservedListEntries()).isEqualTo(clone.getReservedListEntries()); }