mirror of
https://github.com/google/nomulus.git
synced 2025-07-27 04:58:37 +02:00
Rename DomainContent -> DomainBase (#1729)
* Rename DomainContent -> DomainBase This is a follow-up to PR #1725 which renamed DomainBase to Domain. Now, the class naming hierarchy has the same structure as ContactBase/HostBase.
This commit is contained in:
parent
35530616d6
commit
f6d2a7ff91
20 changed files with 131 additions and 138 deletions
|
@ -195,7 +195,7 @@ public class RdePipeline implements Serializable {
|
|||
private static final ImmutableMap<Class<? extends HistoryEntry>, String> EPP_RESOURCE_FIELD_NAME =
|
||||
ImmutableMap.of(
|
||||
DomainHistory.class,
|
||||
"domainContent",
|
||||
"domainBase",
|
||||
ContactHistory.class,
|
||||
"contactBase",
|
||||
HostHistory.class,
|
||||
|
|
|
@ -24,6 +24,7 @@ import google.registry.beam.common.RegistryJpaIO.Read;
|
|||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
|
||||
import google.registry.persistence.transaction.CriteriaQueryBuilder;
|
||||
|
@ -111,7 +112,7 @@ public class ResaveAllEppResourcesPipeline implements Serializable {
|
|||
* transfers, grace periods).
|
||||
*
|
||||
* <p>The logic of what might have changed is paraphrased from {@link
|
||||
* google.registry.model.domain.DomainContent#cloneProjectedAtTime(DateTime)}.
|
||||
* DomainBase#cloneProjectedAtTime(DateTime)}.
|
||||
*/
|
||||
private void fastResaveDomains(Pipeline pipeline) {
|
||||
Read<Domain, Domain> read =
|
||||
|
|
|
@ -40,7 +40,7 @@ import google.registry.model.EppResource.ForeignKeyedEppResource;
|
|||
import google.registry.model.EppResource.ResourceWithTransferData;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
|
@ -236,7 +236,7 @@ public final class ResourceFlowUtils {
|
|||
* @param domain is the domain already projected at approvalTime
|
||||
*/
|
||||
public static DateTime computeExDateForApprovalTime(
|
||||
DomainContent domain, DateTime approvalTime, Period period) {
|
||||
DomainBase domain, DateTime approvalTime, Period period) {
|
||||
boolean inAutoRenew = domain.getGracePeriodStatuses().contains(GracePeriodStatus.AUTO_RENEW);
|
||||
// inAutoRenew is set to false if the period is zero because a zero-period transfer should not
|
||||
// subsume an autorenew.
|
||||
|
|
|
@ -20,7 +20,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.GracePeriod.GracePeriodHistory;
|
||||
|
@ -87,11 +87,11 @@ public class BulkQueryEntities {
|
|||
ImmutableSet<DomainTransactionRecord> transactionRecords) {
|
||||
DomainHistory.Builder builder = new DomainHistory.Builder();
|
||||
builder.copyFrom(domainHistoryLite);
|
||||
DomainContent rawDomainContent = domainHistoryLite.domainContent;
|
||||
if (rawDomainContent != null) {
|
||||
DomainContent newDomainContent =
|
||||
DomainBase rawDomainBase = domainHistoryLite.domainBase;
|
||||
if (rawDomainBase != null) {
|
||||
DomainBase newDomainBase =
|
||||
domainHistoryLite
|
||||
.domainContent
|
||||
.domainBase
|
||||
.asBuilder()
|
||||
.setNameservers(domainHistoryHosts)
|
||||
.setGracePeriods(
|
||||
|
@ -104,9 +104,9 @@ public class BulkQueryEntities {
|
|||
.collect(toImmutableSet()))
|
||||
// Restore the original update timestamp (this gets cleared when we set nameservers or
|
||||
// DS data).
|
||||
.setUpdateTimestamp(domainHistoryLite.domainContent.getUpdateTimestamp())
|
||||
.setUpdateTimestamp(domainHistoryLite.domainBase.getUpdateTimestamp())
|
||||
.build();
|
||||
builder.setDomain(newDomainContent);
|
||||
builder.setDomain(newDomainBase);
|
||||
}
|
||||
return builder.buildAndAssemble(
|
||||
dsDataHistories, domainHistoryHosts, gracePeriodHistories, transactionRecords);
|
||||
|
|
|
@ -16,7 +16,7 @@ package google.registry.model.bulkquery;
|
|||
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
||||
import google.registry.model.domain.Period;
|
||||
|
@ -49,9 +49,9 @@ import javax.persistence.PostLoad;
|
|||
@IdClass(DomainHistoryId.class)
|
||||
public class DomainHistoryLite extends HistoryEntry {
|
||||
|
||||
// Store DomainContent instead of Domain so we don't pick up its @Id
|
||||
// Store DomainBase instead of Domain so we don't pick up its @Id
|
||||
// Nullable for the sake of pre-Registry-3.0 history objects
|
||||
@Nullable DomainContent domainContent;
|
||||
@Nullable DomainBase domainBase;
|
||||
|
||||
@Id
|
||||
@Access(AccessType.PROPERTY)
|
||||
|
@ -112,14 +112,14 @@ public class DomainHistoryLite extends HistoryEntry {
|
|||
|
||||
@PostLoad
|
||||
void postLoad() {
|
||||
if (domainContent == null) {
|
||||
if (domainBase == null) {
|
||||
return;
|
||||
}
|
||||
// See inline comments in DomainHistory.postLoad for reasons for the following lines.
|
||||
if (domainContent.getDomainName() == null) {
|
||||
domainContent = null;
|
||||
} else if (domainContent.getRepoId() == null) {
|
||||
domainContent.setRepoId(parent.getName());
|
||||
if (domainBase.getDomainName() == null) {
|
||||
domainBase = null;
|
||||
} else if (domainBase.getRepoId() == null) {
|
||||
domainBase.setRepoId(parent.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
package google.registry.model.bulkquery;
|
||||
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.persistence.WithStringVKey;
|
||||
import javax.persistence.Access;
|
||||
|
@ -33,7 +33,7 @@ import javax.persistence.Entity;
|
|||
@Entity(name = "Domain")
|
||||
@WithStringVKey
|
||||
@Access(AccessType.FIELD)
|
||||
public class DomainLite extends DomainContent {
|
||||
public class DomainLite extends DomainBase {
|
||||
|
||||
@Override
|
||||
@javax.persistence.Id
|
||||
|
|
|
@ -69,7 +69,7 @@ import org.joda.time.DateTime;
|
|||
@WithStringVKey
|
||||
@ExternalMessagingName("domain")
|
||||
@Access(AccessType.FIELD)
|
||||
public class Domain extends DomainContent implements ForeignKeyedEppResource {
|
||||
public class Domain extends DomainBase implements ForeignKeyedEppResource {
|
||||
|
||||
@Override
|
||||
@javax.persistence.Id
|
||||
|
@ -173,7 +173,7 @@ public class Domain extends DomainContent implements ForeignKeyedEppResource {
|
|||
}
|
||||
|
||||
/** A builder for constructing {@link Domain}, since it is immutable. */
|
||||
public static class Builder extends DomainContent.Builder<Domain, Builder> {
|
||||
public static class Builder extends DomainBase.Builder<Domain, Builder> {
|
||||
|
||||
public Builder() {}
|
||||
|
||||
|
@ -181,38 +181,36 @@ public class Domain extends DomainContent implements ForeignKeyedEppResource {
|
|||
super(instance);
|
||||
}
|
||||
|
||||
public Builder copyFrom(DomainContent domainContent) {
|
||||
this.getInstance().copyUpdateTimestamp(domainContent);
|
||||
return this.setAuthInfo(domainContent.getAuthInfo())
|
||||
public Builder copyFrom(DomainBase domainBase) {
|
||||
this.getInstance().copyUpdateTimestamp(domainBase);
|
||||
return this.setAuthInfo(domainBase.getAuthInfo())
|
||||
.setAutorenewPollMessage(
|
||||
domainContent.getAutorenewPollMessage(),
|
||||
domainContent.getAutorenewPollMessageHistoryId())
|
||||
.setAutorenewBillingEvent(domainContent.getAutorenewBillingEvent())
|
||||
.setAutorenewEndTime(domainContent.getAutorenewEndTime())
|
||||
.setContacts(domainContent.getContacts())
|
||||
.setCreationRegistrarId(domainContent.getCreationRegistrarId())
|
||||
.setCreationTime(domainContent.getCreationTime())
|
||||
.setDomainName(domainContent.getDomainName())
|
||||
.setDeletePollMessage(domainContent.getDeletePollMessage())
|
||||
.setDsData(domainContent.getDsData())
|
||||
.setDeletionTime(domainContent.getDeletionTime())
|
||||
.setGracePeriods(domainContent.getGracePeriods())
|
||||
.setIdnTableName(domainContent.getIdnTableName())
|
||||
.setLastTransferTime(domainContent.getLastTransferTime())
|
||||
.setLaunchNotice(domainContent.getLaunchNotice())
|
||||
.setLastEppUpdateRegistrarId(domainContent.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(domainContent.getLastEppUpdateTime())
|
||||
.setNameservers(domainContent.getNameservers())
|
||||
.setPersistedCurrentSponsorRegistrarId(
|
||||
domainContent.getPersistedCurrentSponsorRegistrarId())
|
||||
.setRegistrant(domainContent.getRegistrant())
|
||||
.setRegistrationExpirationTime(domainContent.getRegistrationExpirationTime())
|
||||
.setRepoId(domainContent.getRepoId())
|
||||
.setSmdId(domainContent.getSmdId())
|
||||
.setSubordinateHosts(domainContent.getSubordinateHosts())
|
||||
.setStatusValues(domainContent.getStatusValues())
|
||||
.setTransferData(domainContent.getTransferData())
|
||||
.setDnsRefreshRequestTime(domainContent.getDnsRefreshRequestTime());
|
||||
domainBase.getAutorenewPollMessage(), domainBase.getAutorenewPollMessageHistoryId())
|
||||
.setAutorenewBillingEvent(domainBase.getAutorenewBillingEvent())
|
||||
.setAutorenewEndTime(domainBase.getAutorenewEndTime())
|
||||
.setContacts(domainBase.getContacts())
|
||||
.setCreationRegistrarId(domainBase.getCreationRegistrarId())
|
||||
.setCreationTime(domainBase.getCreationTime())
|
||||
.setDomainName(domainBase.getDomainName())
|
||||
.setDeletePollMessage(domainBase.getDeletePollMessage())
|
||||
.setDsData(domainBase.getDsData())
|
||||
.setDeletionTime(domainBase.getDeletionTime())
|
||||
.setGracePeriods(domainBase.getGracePeriods())
|
||||
.setIdnTableName(domainBase.getIdnTableName())
|
||||
.setLastTransferTime(domainBase.getLastTransferTime())
|
||||
.setLaunchNotice(domainBase.getLaunchNotice())
|
||||
.setLastEppUpdateRegistrarId(domainBase.getLastEppUpdateRegistrarId())
|
||||
.setLastEppUpdateTime(domainBase.getLastEppUpdateTime())
|
||||
.setNameservers(domainBase.getNameservers())
|
||||
.setPersistedCurrentSponsorRegistrarId(domainBase.getPersistedCurrentSponsorRegistrarId())
|
||||
.setRegistrant(domainBase.getRegistrant())
|
||||
.setRegistrationExpirationTime(domainBase.getRegistrationExpirationTime())
|
||||
.setRepoId(domainBase.getRepoId())
|
||||
.setSmdId(domainBase.getSmdId())
|
||||
.setSubordinateHosts(domainBase.getSubordinateHosts())
|
||||
.setStatusValues(domainBase.getStatusValues())
|
||||
.setTransferData(domainBase.getTransferData())
|
||||
.setDnsRefreshRequestTime(domainBase.getDnsRefreshRequestTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ import org.joda.time.Interval;
|
|||
@MappedSuperclass
|
||||
@Embeddable
|
||||
@Access(AccessType.FIELD)
|
||||
public class DomainContent extends EppResource
|
||||
public class DomainBase extends EppResource
|
||||
implements ResourceWithTransferData<DomainTransferData> {
|
||||
|
||||
/** The max number of years that a domain can be registered for, as set by ICANN policy. */
|
||||
|
@ -454,7 +454,7 @@ public class DomainContent extends EppResource
|
|||
}
|
||||
|
||||
@Override
|
||||
public DomainContent cloneProjectedAtTime(final DateTime now) {
|
||||
public DomainBase cloneProjectedAtTime(final DateTime now) {
|
||||
return cloneDomainProjectedAtTime(this, now);
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ public class DomainContent extends EppResource
|
|||
* parallels the logic in {@code DomainTransferApproveFlow} which handles explicit client
|
||||
* approvals.
|
||||
*/
|
||||
static <T extends DomainContent> T cloneDomainProjectedAtTime(T domain, DateTime now) {
|
||||
static <T extends DomainBase> T cloneDomainProjectedAtTime(T domain, DateTime now) {
|
||||
DomainTransferData transferData = domain.getTransferData();
|
||||
DateTime transferExpirationTime = transferData.getPendingTransferExpirationTime();
|
||||
|
||||
|
@ -704,8 +704,7 @@ public class DomainContent extends EppResource
|
|||
@Override
|
||||
public VKey<Domain> createVKey() {
|
||||
throw new UnsupportedOperationException(
|
||||
"DomainContent is not an actual persisted entity you can create a key to;"
|
||||
+ " use Domain instead");
|
||||
"DomainBase is not an actual persisted entity you can create a key to; use Domain instead");
|
||||
}
|
||||
|
||||
/** Predicate to determine if a given {@link DesignatedContact} is the registrant. */
|
||||
|
@ -714,12 +713,12 @@ public class DomainContent extends EppResource
|
|||
|
||||
/** An override of {@link EppResource#asBuilder} with tighter typing. */
|
||||
@Override
|
||||
public Builder<? extends DomainContent, ?> asBuilder() {
|
||||
public Builder<? extends DomainBase, ?> asBuilder() {
|
||||
return new Builder<>(clone(this));
|
||||
}
|
||||
|
||||
/** A builder for constructing {@link Domain}, since it is immutable. */
|
||||
public static class Builder<T extends DomainContent, B extends Builder<T, B>>
|
||||
public static class Builder<T extends DomainBase, B extends Builder<T, B>>
|
||||
extends EppResource.Builder<T, B> implements BuilderWithTransferData<DomainTransferData, B> {
|
||||
|
||||
public Builder() {}
|
|
@ -59,8 +59,8 @@ import org.hibernate.Hibernate;
|
|||
* A persisted history entry representing an EPP modification to a domain.
|
||||
*
|
||||
* <p>In addition to the general history fields (e.g. action time, registrar ID) we also persist a
|
||||
* copy of the domain entity at this point in time. We persist a raw {@link DomainContent} so that
|
||||
* the foreign-keyed fields in that class can refer to this object.
|
||||
* copy of the domain entity at this point in time. We persist a raw {@link DomainBase} so that the
|
||||
* foreign-keyed fields in that class can refer to this object.
|
||||
*
|
||||
* <p>This class is only marked as a Datastore entity subclass and registered with Objectify so that
|
||||
* when building it its ID can be auto-populated by Objectify. It is converted to its superclass
|
||||
|
@ -80,9 +80,9 @@ import org.hibernate.Hibernate;
|
|||
@IdClass(DomainHistoryId.class)
|
||||
public class DomainHistory extends HistoryEntry {
|
||||
|
||||
// Store DomainContent instead of Domain so we don't pick up its @Id
|
||||
// Store DomainBase instead of Domain so we don't pick up its @Id
|
||||
// Nullable for the sake of pre-Registry-3.0 history objects
|
||||
@DoNotCompare @Nullable DomainContent domainContent;
|
||||
@DoNotCompare @Nullable DomainBase domainBase;
|
||||
|
||||
@Id
|
||||
@Access(AccessType.PROPERTY)
|
||||
|
@ -98,9 +98,9 @@ public class DomainHistory extends HistoryEntry {
|
|||
parent = Key.create(Domain.class, domainRepoId);
|
||||
}
|
||||
|
||||
// We could have reused domainContent.nsHosts here, but Hibernate throws a weird exception after
|
||||
// We could have reused domainBase.nsHosts here, but Hibernate throws a weird exception after
|
||||
// we change to use a composite primary key.
|
||||
// TODO(b/166776754): Investigate if we can reuse domainContent.nsHosts for storing host keys.
|
||||
// TODO(b/166776754): Investigate if we can reuse domainBase.nsHosts for storing host keys.
|
||||
@DoNotCompare
|
||||
@ElementCollection
|
||||
@JoinTable(
|
||||
|
@ -232,13 +232,13 @@ public class DomainHistory extends HistoryEntry {
|
|||
}
|
||||
|
||||
/**
|
||||
* The values of all the fields on the {@link DomainContent} object after the action represented
|
||||
* by this history object was executed.
|
||||
* The values of all the fields on the {@link DomainBase} object after the action represented by
|
||||
* this history object was executed.
|
||||
*
|
||||
* <p>Will be absent for objects created prior to the Registry 3.0 SQL migration.
|
||||
*/
|
||||
public Optional<DomainContent> getDomainContent() {
|
||||
return Optional.ofNullable(domainContent);
|
||||
public Optional<DomainBase> getDomainBase() {
|
||||
return Optional.ofNullable(domainBase);
|
||||
}
|
||||
|
||||
/** The key to the {@link Domain} this is based off of. */
|
||||
|
@ -259,8 +259,7 @@ public class DomainHistory extends HistoryEntry {
|
|||
|
||||
@Override
|
||||
public Optional<? extends EppResource> getResourceAtPointInTime() {
|
||||
return getDomainContent()
|
||||
.map(domainContent -> new Domain.Builder().copyFrom(domainContent).build());
|
||||
return getDomainBase().map(domainBase -> new Domain.Builder().copyFrom(domainBase).build());
|
||||
}
|
||||
|
||||
@PostLoad
|
||||
|
@ -271,39 +270,39 @@ public class DomainHistory extends HistoryEntry {
|
|||
Hibernate.initialize(dsDataHistories);
|
||||
Hibernate.initialize(gracePeriodHistories);
|
||||
|
||||
if (domainContent != null) {
|
||||
domainContent.nsHosts = nullToEmptyImmutableCopy(nsHosts);
|
||||
domainContent.gracePeriods =
|
||||
if (domainBase != null) {
|
||||
domainBase.nsHosts = nullToEmptyImmutableCopy(nsHosts);
|
||||
domainBase.gracePeriods =
|
||||
gracePeriodHistories.stream()
|
||||
.map(GracePeriod::createFromHistory)
|
||||
.collect(toImmutableSet());
|
||||
domainContent.dsData =
|
||||
domainBase.dsData =
|
||||
dsDataHistories.stream().map(DelegationSignerData::create).collect(toImmutableSet());
|
||||
// Normally Hibernate would see that the domain fields are all null and would fill
|
||||
// domainContent with a null object. Unfortunately, the updateTimestamp is never null in SQL.
|
||||
if (domainContent.getDomainName() == null) {
|
||||
domainContent = null;
|
||||
// domainBase with a null object. Unfortunately, the updateTimestamp is never null in SQL.
|
||||
if (domainBase.getDomainName() == null) {
|
||||
domainBase = null;
|
||||
} else {
|
||||
if (domainContent.getRepoId() == null) {
|
||||
// domainContent still hasn't been fully constructed yet, so it's ok to go in and mutate
|
||||
if (domainBase.getRepoId() == null) {
|
||||
// domainBase still hasn't been fully constructed yet, so it's ok to go in and mutate
|
||||
// it. In fact, we have to because going through the builder causes the hash codes of
|
||||
// contained objects to be calculated prematurely.
|
||||
domainContent.setRepoId(parent.getName());
|
||||
domainBase.setRepoId(parent.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void fillAuxiliaryFieldsFromDomain(DomainHistory domainHistory) {
|
||||
if (domainHistory.domainContent != null) {
|
||||
domainHistory.nsHosts = nullToEmptyImmutableCopy(domainHistory.domainContent.nsHosts);
|
||||
if (domainHistory.domainBase != null) {
|
||||
domainHistory.nsHosts = nullToEmptyImmutableCopy(domainHistory.domainBase.nsHosts);
|
||||
domainHistory.dsDataHistories =
|
||||
nullToEmptyImmutableCopy(domainHistory.domainContent.getDsData()).stream()
|
||||
nullToEmptyImmutableCopy(domainHistory.domainBase.getDsData()).stream()
|
||||
.filter(dsData -> dsData.getDigest() != null && dsData.getDigest().length > 0)
|
||||
.map(dsData -> DomainDsDataHistory.createFrom(domainHistory.id, dsData))
|
||||
.collect(toImmutableSet());
|
||||
domainHistory.gracePeriodHistories =
|
||||
nullToEmptyImmutableCopy(domainHistory.domainContent.getGracePeriods()).stream()
|
||||
nullToEmptyImmutableCopy(domainHistory.domainBase.getGracePeriods()).stream()
|
||||
.map(gracePeriod -> GracePeriodHistory.createFrom(domainHistory.id, gracePeriod))
|
||||
.collect(toImmutableSet());
|
||||
} else {
|
||||
|
@ -372,19 +371,19 @@ public class DomainHistory extends HistoryEntry {
|
|||
super(instance);
|
||||
}
|
||||
|
||||
public Builder setDomain(@Nullable DomainContent domainContent) {
|
||||
public Builder setDomain(@Nullable DomainBase domainBase) {
|
||||
// Nullable for the sake of pre-Registry-3.0 history objects
|
||||
if (domainContent == null) {
|
||||
if (domainBase == null) {
|
||||
return this;
|
||||
}
|
||||
// TODO(b/203609982): if actual type of domainContent is Domain, convert to DomainContent
|
||||
// Note: a DomainHistory fetched by JPA has DomainContent in this field. Allowing Domain
|
||||
// TODO(b/203609982): if actual type of domainBase is Domain, convert to DomainBase
|
||||
// Note: a DomainHistory fetched by JPA has DomainBase in this field. Allowing Domain
|
||||
// in the setter makes equality checks messy.
|
||||
getInstance().domainContent = domainContent;
|
||||
if (domainContent instanceof Domain) {
|
||||
super.setParent(domainContent);
|
||||
getInstance().domainBase = domainBase;
|
||||
if (domainBase instanceof Domain) {
|
||||
super.setParent(domainBase);
|
||||
} else {
|
||||
super.setParent(Key.create(Domain.class, domainContent.getRepoId()));
|
||||
super.setParent(Key.create(Domain.class, domainBase.getRepoId()));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -397,10 +396,10 @@ public class DomainHistory extends HistoryEntry {
|
|||
@Override
|
||||
public DomainHistory build() {
|
||||
DomainHistory instance = super.build();
|
||||
// TODO(b/171990736): Assert instance.domainContent is not null after database migration.
|
||||
// Note that we cannot assert that instance.domainContent is not null here because this
|
||||
// TODO(b/171990736): Assert instance.domainBase is not null after database migration.
|
||||
// Note that we cannot assert that instance.domainBase is not null here because this
|
||||
// builder is also used to convert legacy HistoryEntry objects to DomainHistory, when
|
||||
// domainContent is not available.
|
||||
// domainBase is not available.
|
||||
fillAuxiliaryFieldsFromDomain(instance);
|
||||
return instance;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import google.registry.model.EppResource;
|
|||
import google.registry.model.contact.ContactBase;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.host.HostBase;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.model.translators.EnumToAttributeAdapter.EppEnum;
|
||||
|
@ -132,12 +132,12 @@ public enum StatusValue implements EppEnum {
|
|||
ALL(
|
||||
ContactBase.class,
|
||||
ContactResource.class,
|
||||
DomainContent.class,
|
||||
DomainBase.class,
|
||||
Domain.class,
|
||||
HostBase.class,
|
||||
HostResource.class),
|
||||
NONE,
|
||||
DOMAINS(DomainContent.class, Domain.class);
|
||||
DOMAINS(DomainBase.class, Domain.class);
|
||||
|
||||
private final ImmutableSet<Class<? extends EppResource>> classes;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import google.registry.model.contact.ContactHistory;
|
|||
import google.registry.model.contact.ContactHistory.ContactHistoryId;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.DomainHistory.DomainHistoryId;
|
||||
import google.registry.model.domain.Period;
|
||||
|
@ -537,8 +537,8 @@ public class HistoryEntry extends ImmutableObject implements Buildable, UnsafeSe
|
|||
|
||||
public static <E extends EppResource>
|
||||
HistoryEntry.Builder<? extends HistoryEntry, ?> createBuilderForResource(E parent) {
|
||||
if (parent instanceof DomainContent) {
|
||||
return new DomainHistory.Builder().setDomain((DomainContent) parent);
|
||||
if (parent instanceof DomainBase) {
|
||||
return new DomainHistory.Builder().setDomain((DomainBase) parent);
|
||||
} else if (parent instanceof ContactBase) {
|
||||
return new ContactHistory.Builder().setContact((ContactBase) parent);
|
||||
} else if (parent instanceof HostBase) {
|
||||
|
|
|
@ -58,7 +58,7 @@ import google.registry.model.contact.ContactHistory;
|
|||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
|
@ -187,7 +187,7 @@ public class RdePipelineTest {
|
|||
.build());
|
||||
}
|
||||
|
||||
private DomainHistory persistDomainHistory(DomainContent domain) {
|
||||
private DomainHistory persistDomainHistory(DomainBase domain) {
|
||||
DomainTransactionRecord transactionRecord =
|
||||
new DomainTransactionRecord.Builder()
|
||||
.setTld("soy")
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.testing.TestLogHandler;
|
|||
import google.registry.model.EppResource;
|
||||
import google.registry.model.contact.ContactBase;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.eppinput.EppInput.ResourceCommandWrapper;
|
||||
|
@ -155,10 +155,10 @@ public abstract class ResourceFlowTestCase<F extends Flow, R extends EppResource
|
|||
assertAboutImmutableObjects()
|
||||
.that(contactHistory.getContactBase().get())
|
||||
.hasFieldsEqualTo(resource);
|
||||
} else if (resource instanceof DomainContent) {
|
||||
} else if (resource instanceof DomainBase) {
|
||||
DomainHistory domainHistory = (DomainHistory) historyEntry;
|
||||
assertAboutImmutableObjects()
|
||||
.that(domainHistory.getDomainContent().get())
|
||||
.that(domainHistory.getDomainBase().get())
|
||||
.isEqualExceptFields(resource, "gracePeriods", "dsData", "nsHosts");
|
||||
} else if (resource instanceof HostBase) {
|
||||
HostHistory hostHistory = (HostHistory) historyEntry;
|
||||
|
|
|
@ -489,16 +489,16 @@ public class DomainSqlTest {
|
|||
// reason is showing up as different.
|
||||
assertEqualDomainExcept(persisted, "creationTime", "dsData", "gracePeriods");
|
||||
|
||||
// Verify that the DomainContent object from the history record sets the fields correctly.
|
||||
// Verify that the DomainBase object from the history record sets the fields correctly.
|
||||
DomainHistory persistedHistoryEntry = loadByKey(historyEntry.createVKey());
|
||||
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewPollMessage())
|
||||
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewPollMessage())
|
||||
.isEqualTo(domain.getAutorenewPollMessage());
|
||||
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewBillingEvent())
|
||||
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewBillingEvent())
|
||||
.isEqualTo(domain.getAutorenewBillingEvent());
|
||||
assertThat(persistedHistoryEntry.getDomainContent().get().getDeletePollMessage())
|
||||
assertThat(persistedHistoryEntry.getDomainBase().get().getDeletePollMessage())
|
||||
.isEqualTo(domain.getDeletePollMessage());
|
||||
DomainTransferData persistedTransferData =
|
||||
persistedHistoryEntry.getDomainContent().get().getTransferData();
|
||||
persistedHistoryEntry.getDomainBase().get().getTransferData();
|
||||
DomainTransferData originalTransferData = domain.getTransferData();
|
||||
assertThat(persistedTransferData.getServerApproveBillingEvent())
|
||||
.isEqualTo(originalTransferData.getServerApproveBillingEvent());
|
||||
|
@ -621,16 +621,16 @@ public class DomainSqlTest {
|
|||
// reason is showing up as different.
|
||||
assertEqualDomainExcept(persisted, "creationTime", "dsData", "gracePeriods");
|
||||
|
||||
// Verify that the DomainContent object from the history record sets the fields correctly.
|
||||
// Verify that the DomainBase object from the history record sets the fields correctly.
|
||||
DomainHistory persistedHistoryEntry = loadByKey(historyEntry.createVKey());
|
||||
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewPollMessage())
|
||||
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewPollMessage())
|
||||
.isEqualTo(domain.getAutorenewPollMessage());
|
||||
assertThat(persistedHistoryEntry.getDomainContent().get().getAutorenewBillingEvent())
|
||||
assertThat(persistedHistoryEntry.getDomainBase().get().getAutorenewBillingEvent())
|
||||
.isEqualTo(domain.getAutorenewBillingEvent());
|
||||
assertThat(persistedHistoryEntry.getDomainContent().get().getDeletePollMessage())
|
||||
assertThat(persistedHistoryEntry.getDomainBase().get().getDeletePollMessage())
|
||||
.isEqualTo(domain.getDeletePollMessage());
|
||||
DomainTransferData persistedTransferData =
|
||||
persistedHistoryEntry.getDomainContent().get().getTransferData();
|
||||
persistedHistoryEntry.getDomainBase().get().getTransferData();
|
||||
DomainTransferData originalTransferData = domain.getTransferData();
|
||||
assertThat(persistedTransferData.getServerApproveBillingEvent())
|
||||
.isEqualTo(originalTransferData.getServerApproveBillingEvent());
|
||||
|
|
|
@ -230,7 +230,7 @@ public class DomainTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void testDomainContentToDomain() {
|
||||
void testDomainBaseToDomain() {
|
||||
ImmutableObjectSubject.assertAboutImmutableObjects()
|
||||
.that(new Domain.Builder().copyFrom(domain).build())
|
||||
.isEqualExceptFields(domain, "updateTimestamp", "revisions");
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import google.registry.model.EntityTestCase;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.Period;
|
||||
|
@ -134,13 +134,13 @@ public class DomainHistoryTest extends EntityTestCase {
|
|||
}
|
||||
|
||||
static void assertDomainHistoriesEqual(DomainHistory one, DomainHistory two) {
|
||||
assertAboutImmutableObjects().that(one).isEqualExceptFields(two, "domainContent");
|
||||
assertAboutImmutableObjects().that(one).isEqualExceptFields(two, "domainBase");
|
||||
assertAboutImmutableObjects()
|
||||
.that(one.getDomainContent().get())
|
||||
.isEqualExceptFields(two.getDomainContent().get(), "updateTimestamp");
|
||||
.that(one.getDomainBase().get())
|
||||
.isEqualExceptFields(two.getDomainBase().get(), "updateTimestamp");
|
||||
}
|
||||
|
||||
private DomainHistory createDomainHistory(DomainContent domain) {
|
||||
private DomainHistory createDomainHistory(DomainBase domain) {
|
||||
DomainTransactionRecord transactionRecord =
|
||||
new DomainTransactionRecord.Builder()
|
||||
.setTld("tld")
|
||||
|
|
|
@ -76,7 +76,7 @@ class HistoryEntryDaoTest extends EntityTestCase {
|
|||
@Test
|
||||
void testSimpleLoadAll() {
|
||||
assertThat(HistoryEntryDao.loadAllHistoryObjects(START_OF_TIME, END_OF_TIME))
|
||||
.comparingElementsUsing(immutableObjectCorrespondence("nsHosts", "domainContent"))
|
||||
.comparingElementsUsing(immutableObjectCorrespondence("nsHosts", "domainBase"))
|
||||
.containsExactly(domainHistory);
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,7 @@ class HistoryEntryDaoTest extends EntityTestCase {
|
|||
tm().transact(
|
||||
() ->
|
||||
assertThat(HistoryEntryDao.loadHistoryObjectsForResource(domain.createVKey()))
|
||||
.comparingElementsUsing(
|
||||
immutableObjectCorrespondence("nsHosts", "domainContent"))
|
||||
.comparingElementsUsing(immutableObjectCorrespondence("nsHosts", "domainBase"))
|
||||
.containsExactly(domainHistory));
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class HistoryEntryTest extends EntityTestCase {
|
|||
DomainHistory fromDatabase = tm().loadByEntity(domainHistory);
|
||||
assertAboutImmutableObjects()
|
||||
.that(fromDatabase)
|
||||
.isEqualExceptFields(domainHistory, "domainContent");
|
||||
.isEqualExceptFields(domainHistory, "domainBase");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ import google.registry.model.domain.DesignatedContact;
|
|||
import google.registry.model.domain.DesignatedContact.Type;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainAuthInfo;
|
||||
import google.registry.model.domain.DomainContent;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
import google.registry.model.domain.GracePeriod;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
|
@ -906,7 +906,7 @@ public class DatabaseHelper {
|
|||
assertPollMessagesEqual(getPollMessages(), asList(expected));
|
||||
}
|
||||
|
||||
public static void assertPollMessagesForResource(DomainContent domain, PollMessage... expected) {
|
||||
public static void assertPollMessagesForResource(DomainBase domain, PollMessage... expected) {
|
||||
assertPollMessagesEqual(getPollMessages(domain), asList(expected));
|
||||
}
|
||||
|
||||
|
@ -922,7 +922,7 @@ public class DatabaseHelper {
|
|||
.collect(toImmutableList()));
|
||||
}
|
||||
|
||||
public static ImmutableList<PollMessage> getPollMessages(DomainContent domain) {
|
||||
public static ImmutableList<PollMessage> getPollMessages(DomainBase domain) {
|
||||
return tm().transact(
|
||||
() ->
|
||||
tm().loadAllOf(PollMessage.class).stream()
|
||||
|
@ -973,10 +973,7 @@ public class DatabaseHelper {
|
|||
}
|
||||
|
||||
public static PollMessage getOnlyPollMessage(
|
||||
DomainContent domain,
|
||||
String registrarId,
|
||||
DateTime now,
|
||||
Class<? extends PollMessage> subType) {
|
||||
DomainBase domain, String registrarId, DateTime now, Class<? extends PollMessage> subType) {
|
||||
return getPollMessages(domain, registrarId, now).stream()
|
||||
.filter(subType::isInstance)
|
||||
.map(subType::cast)
|
||||
|
|
|
@ -129,7 +129,7 @@ class google.registry.model.domain.Domain {
|
|||
class google.registry.model.domain.DomainAuthInfo {
|
||||
google.registry.model.eppcommon.AuthInfo$PasswordAuth pw;
|
||||
}
|
||||
class google.registry.model.domain.DomainContent {
|
||||
class google.registry.model.domain.DomainBase {
|
||||
@Id java.lang.String repoId;
|
||||
google.registry.model.domain.DomainAuthInfo authInfo;
|
||||
google.registry.model.domain.launch.LaunchNotice launchNotice;
|
||||
|
@ -163,7 +163,7 @@ class google.registry.model.domain.DomainHistory {
|
|||
@Parent com.googlecode.objectify.Key<? extends google.registry.model.EppResource> parent;
|
||||
boolean bySuperuser;
|
||||
byte[] xmlBytes;
|
||||
google.registry.model.domain.DomainContent domainContent;
|
||||
google.registry.model.domain.DomainBase domainBase;
|
||||
google.registry.model.domain.Period period;
|
||||
google.registry.model.eppcommon.Trid trid;
|
||||
google.registry.model.reporting.HistoryEntry$Type type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue