diff --git a/java/google/registry/batch/DeleteProberDataAction.java b/java/google/registry/batch/DeleteProberDataAction.java
index 051eeffd8..f35b10b67 100644
--- a/java/google/registry/batch/DeleteProberDataAction.java
+++ b/java/google/registry/batch/DeleteProberDataAction.java
@@ -42,7 +42,6 @@ import google.registry.mapreduce.MapreduceRunner;
import google.registry.mapreduce.inputs.EppResourceInputs;
import google.registry.model.EppResourceUtils;
import google.registry.model.domain.DomainBase;
-import google.registry.model.domain.DomainResource;
import google.registry.model.index.EppResourceIndex;
import google.registry.model.index.ForeignKeyIndex;
import google.registry.model.registry.Registry;
@@ -58,7 +57,7 @@ import org.joda.time.DateTime;
import org.joda.time.Duration;
/**
- * Deletes all prober DomainResources and their subordinate history entries, poll messages, and
+ * Deletes all prober DomainBases and their subordinate history entries, poll messages, and
* billing events, along with their ForeignKeyDomainIndex and EppResourceIndex entities.
*
*
See: https://www.youtube.com/watch?v=xuuv0syoHnM
@@ -166,7 +165,7 @@ public class DeleteProberDataAction implements Runnable {
}
private void deleteDomain(final Key domainKey) {
- final DomainResource domain = (DomainResource) ofy().load().key(domainKey).now();
+ final DomainBase domain = ofy().load().key(domainKey).now();
DateTime now = DateTime.now(UTC);
@@ -245,9 +244,9 @@ public class DeleteProberDataAction implements Runnable {
getContext().incrementCounter("total entities hard-deleted", entitiesDeleted);
}
- private void softDeleteDomain(final DomainResource domain) {
+ private void softDeleteDomain(final DomainBase domain) {
ofy().transactNew(() -> {
- DomainResource deletedDomain = domain
+ DomainBase deletedDomain = domain
.asBuilder()
.setDeletionTime(ofy().getTransactionTime())
.setStatusValues(null)
diff --git a/java/google/registry/batch/ExpandRecurringBillingEventsAction.java b/java/google/registry/batch/ExpandRecurringBillingEventsAction.java
index 304c45acd..9eee1f9f5 100644
--- a/java/google/registry/batch/ExpandRecurringBillingEventsAction.java
+++ b/java/google/registry/batch/ExpandRecurringBillingEventsAction.java
@@ -47,7 +47,7 @@ import google.registry.model.billing.BillingEvent.Flag;
import google.registry.model.billing.BillingEvent.OneTime;
import google.registry.model.billing.BillingEvent.Recurring;
import google.registry.model.common.Cursor;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.Period;
import google.registry.model.registry.Registry;
import google.registry.model.reporting.DomainTransactionRecord;
@@ -110,7 +110,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
ImmutableList.of(
new NullInput<>(),
createChildEntityInput(
- ImmutableSet.of(DomainResource.class), ImmutableSet.of(Recurring.class))))
+ ImmutableSet.of(DomainBase.class), ImmutableSet.of(Recurring.class))))
.sendLinkToMapreduceConsole(response);
}
diff --git a/java/google/registry/batch/RefreshDnsOnHostRenameAction.java b/java/google/registry/batch/RefreshDnsOnHostRenameAction.java
index 59f3b92f6..ed5995f89 100644
--- a/java/google/registry/batch/RefreshDnsOnHostRenameAction.java
+++ b/java/google/registry/batch/RefreshDnsOnHostRenameAction.java
@@ -49,7 +49,7 @@ import google.registry.batch.AsyncTaskMetrics.OperationResult;
import google.registry.dns.DnsQueue;
import google.registry.mapreduce.MapreduceRunner;
import google.registry.mapreduce.inputs.NullInput;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.host.HostResource;
import google.registry.model.server.Lock;
import google.registry.request.Action;
@@ -166,7 +166,7 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
new RefreshDnsOnHostRenameMapper(refreshRequests, retrier),
new RefreshDnsOnHostRenameReducer(refreshRequests, lock.get(), retrier),
// Add an extra NullInput so that the reducer always fires exactly once.
- ImmutableList.of(new NullInput<>(), createEntityInput(DomainResource.class)))
+ ImmutableList.of(new NullInput<>(), createEntityInput(DomainBase.class)))
.sendLinkToMapreduceConsole(response);
} catch (Throwable t) {
logRespondAndUnlock(
@@ -182,7 +182,7 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
/** Map over domains and refresh the DNS of those that reference the renamed hosts. */
public static class RefreshDnsOnHostRenameMapper
- extends Mapper {
+ extends Mapper {
private static final long serialVersionUID = -5261698524424335531L;
private static final DnsQueue dnsQueue = DnsQueue.create();
@@ -197,7 +197,7 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
}
@Override
- public final void map(@Nullable final DomainResource domain) {
+ public final void map(@Nullable final DomainBase domain) {
if (domain == null) {
// Emit a single value so that the reducer always runs. The key and value don't matter.
emit(true, true);
diff --git a/java/google/registry/dns/RefreshDnsAction.java b/java/google/registry/dns/RefreshDnsAction.java
index 57410761d..7d6fd11c8 100644
--- a/java/google/registry/dns/RefreshDnsAction.java
+++ b/java/google/registry/dns/RefreshDnsAction.java
@@ -20,7 +20,7 @@ import google.registry.dns.DnsConstants.TargetType;
import google.registry.model.EppResource;
import google.registry.model.EppResource.ForeignKeyedEppResource;
import google.registry.model.annotations.ExternalMessagingName;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.host.HostResource;
import google.registry.request.Action;
import google.registry.request.HttpException.BadRequestException;
@@ -51,7 +51,7 @@ public final class RefreshDnsAction implements Runnable {
}
switch (type) {
case DOMAIN:
- loadAndVerifyExistence(DomainResource.class, domainOrHostName);
+ loadAndVerifyExistence(DomainBase.class, domainOrHostName);
dnsQueue.addDomainRefreshTask(domainOrHostName);
break;
case HOST:
diff --git a/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java b/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java
index 152921277..cc77b6d4e 100644
--- a/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java
+++ b/java/google/registry/dns/writer/clouddns/CloudDnsWriter.java
@@ -36,7 +36,7 @@ import google.registry.config.RegistryConfig.Config;
import google.registry.dns.writer.BaseDnsWriter;
import google.registry.dns.writer.DnsWriter;
import google.registry.dns.writer.DnsWriterZone;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.host.HostResource;
import google.registry.model.registry.Registries;
@@ -121,13 +121,13 @@ public class CloudDnsWriter extends BaseDnsWriter {
String absoluteDomainName = getAbsoluteHostName(domainName);
// Load the target domain. Note that it can be absent if this domain was just deleted.
- Optional domainResource =
- loadByForeignKey(DomainResource.class, domainName, clock.nowUtc());
+ Optional domainBase =
+ loadByForeignKey(DomainBase.class, domainName, clock.nowUtc());
// Return early if no DNS records should be published.
// desiredRecordsBuilder is populated with an empty set to indicate that all existing records
// should be deleted.
- if (!domainResource.isPresent() || !domainResource.get().shouldPublishToDns()) {
+ if (!domainBase.isPresent() || !domainBase.get().shouldPublishToDns()) {
desiredRecords.put(absoluteDomainName, ImmutableSet.of());
return;
}
@@ -135,7 +135,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
ImmutableSet.Builder domainRecords = new ImmutableSet.Builder<>();
// Construct DS records (if any).
- Set dsData = domainResource.get().getDsData();
+ Set dsData = domainBase.get().getDsData();
if (!dsData.isEmpty()) {
HashSet dsRrData = new HashSet<>();
for (DelegationSignerData ds : dsData) {
@@ -154,8 +154,8 @@ public class CloudDnsWriter extends BaseDnsWriter {
}
// Construct NS records (if any).
- Set nameserverData = domainResource.get().loadNameserverFullyQualifiedHostNames();
- Set subordinateHosts = domainResource.get().getSubordinateHosts();
+ Set nameserverData = domainBase.get().loadNameserverFullyQualifiedHostNames();
+ Set subordinateHosts = domainBase.get().getSubordinateHosts();
if (!nameserverData.isEmpty()) {
HashSet nsRrData = new HashSet<>();
for (String hostName : nameserverData) {
diff --git a/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java b/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java
index 4baecb065..dc885cbe4 100644
--- a/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java
+++ b/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriter.java
@@ -27,7 +27,7 @@ import com.google.common.net.InternetDomainName;
import google.registry.config.RegistryConfig.Config;
import google.registry.dns.writer.BaseDnsWriter;
import google.registry.dns.writer.DnsWriterZone;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.secdns.DelegationSignerData;
import google.registry.model.host.HostResource;
import google.registry.model.registry.Registries;
@@ -127,12 +127,12 @@ public class DnsUpdateWriter extends BaseDnsWriter {
* this domain refresh request
*/
private void publishDomain(String domainName, String requestingHostName) {
- Optional domainOptional =
- loadByForeignKey(DomainResource.class, domainName, clock.nowUtc());
+ Optional domainOptional =
+ loadByForeignKey(DomainBase.class, domainName, clock.nowUtc());
update.delete(toAbsoluteName(domainName), Type.ANY);
// If the domain is now deleted, then don't update DNS for it.
if (domainOptional.isPresent()) {
- DomainResource domain = domainOptional.get();
+ DomainBase domain = domainOptional.get();
// As long as the domain exists, orphan glues should be cleaned.
deleteSubordinateHostAddressSet(domain, requestingHostName, update);
if (domain.shouldPublishToDns()) {
@@ -184,7 +184,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
}
}
- private RRset makeDelegationSignerSet(DomainResource domain) {
+ private RRset makeDelegationSignerSet(DomainBase domain) {
RRset signerSet = new RRset();
for (DelegationSignerData signerData : domain.getDsData()) {
DSRecord dsRecord =
@@ -202,7 +202,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
}
private void deleteSubordinateHostAddressSet(
- DomainResource domain, String additionalHost, Update update) {
+ DomainBase domain, String additionalHost, Update update) {
for (String hostName :
union(
domain.getSubordinateHosts(),
@@ -213,7 +213,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
}
}
- private void addInBailiwickNameServerSet(DomainResource domain, Update update) {
+ private void addInBailiwickNameServerSet(DomainBase domain, Update update) {
for (String hostName :
intersection(
domain.loadNameserverFullyQualifiedHostNames(), domain.getSubordinateHosts())) {
@@ -224,7 +224,7 @@ public class DnsUpdateWriter extends BaseDnsWriter {
}
}
- private RRset makeNameServerSet(DomainResource domain) {
+ private RRset makeNameServerSet(DomainBase domain) {
RRset nameServerSet = new RRset();
for (String hostName : domain.loadNameserverFullyQualifiedHostNames()) {
NSRecord record =
diff --git a/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml b/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml
index dffd81d01..236f50c7f 100644
--- a/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml
+++ b/java/google/registry/env/common/default/WEB-INF/datastore-indexes.xml
@@ -6,21 +6,11 @@
-
-
-
-
-
-
-
-
-
-
@@ -31,11 +21,6 @@
-
-
-
-
-
@@ -62,11 +47,6 @@
-
-
-
-
-
@@ -95,31 +75,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/google/registry/export/ExportDomainListsAction.java b/java/google/registry/export/ExportDomainListsAction.java
index 474d772a6..0b8d3e70a 100644
--- a/java/google/registry/export/ExportDomainListsAction.java
+++ b/java/google/registry/export/ExportDomainListsAction.java
@@ -38,7 +38,7 @@ import com.google.common.net.MediaType;
import google.registry.config.RegistryConfig.Config;
import google.registry.gcs.GcsUtils;
import google.registry.mapreduce.MapreduceRunner;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.registry.Registry;
import google.registry.model.registry.Registry.TldType;
import google.registry.request.Action;
@@ -88,11 +88,11 @@ public class ExportDomainListsAction implements Runnable {
.runMapreduce(
new ExportDomainListsMapper(DateTime.now(UTC), realTlds),
new ExportDomainListsReducer(gcsBucket, gcsBufferSize),
- ImmutableList.of(createEntityInput(DomainResource.class)))
+ ImmutableList.of(createEntityInput(DomainBase.class)))
.sendLinkToMapreduceConsole(response);
}
- static class ExportDomainListsMapper extends Mapper {
+ static class ExportDomainListsMapper extends Mapper {
private static final long serialVersionUID = -7312206212434039854L;
@@ -105,7 +105,7 @@ public class ExportDomainListsAction implements Runnable {
}
@Override
- public void map(DomainResource domain) {
+ public void map(DomainBase domain) {
if (realTlds.contains(domain.getTld()) && isActive(domain, exportTime)) {
emit(domain.getTld(), domain.getFullyQualifiedDomainName());
getContext().incrementCounter(String.format("domains in tld %s", domain.getTld()));
diff --git a/java/google/registry/flows/CheckApiAction.java b/java/google/registry/flows/CheckApiAction.java
index 1b513fe76..5e5e540bd 100644
--- a/java/google/registry/flows/CheckApiAction.java
+++ b/java/google/registry/flows/CheckApiAction.java
@@ -44,7 +44,7 @@ import dagger.Module;
import dagger.Provides;
import google.registry.flows.domain.DomainFlowUtils.BadCommandForRegistryPhaseException;
import google.registry.flows.domain.DomainFlowUtils.InvalidIdnDomainLabelException;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.index.ForeignKeyIndex;
import google.registry.model.registry.Registry;
import google.registry.model.registry.label.ReservationType;
@@ -157,7 +157,7 @@ public class CheckApiAction implements Runnable {
}
private boolean checkExists(String domainString, DateTime now) {
- return !ForeignKeyIndex.loadCached(DomainResource.class, ImmutableList.of(domainString), now)
+ return !ForeignKeyIndex.loadCached(DomainBase.class, ImmutableList.of(domainString), now)
.isEmpty();
}
diff --git a/java/google/registry/flows/EppController.java b/java/google/registry/flows/EppController.java
index 44f2ae054..7de8bf6e3 100644
--- a/java/google/registry/flows/EppController.java
+++ b/java/google/registry/flows/EppController.java
@@ -95,7 +95,7 @@ public final class EppController {
e.getResult(), Trid.create(null, serverTridProvider.createServerTrid()));
}
if (!eppInput.getTargetIds().isEmpty()) {
- if (eppInput.isDomainResourceType()) {
+ if (eppInput.isDomainType()) {
eppMetricBuilder.setTlds(extractTlds(eppInput.getTargetIds()));
}
}
diff --git a/java/google/registry/flows/FlowReporter.java b/java/google/registry/flows/FlowReporter.java
index c59dea773..7c15e45d4 100644
--- a/java/google/registry/flows/FlowReporter.java
+++ b/java/google/registry/flows/FlowReporter.java
@@ -70,12 +70,8 @@ public class FlowReporter {
.put("flowClassName", flowClass.getSimpleName())
.put("targetId", singleTargetId)
.put("targetIds", targetIds)
- .put(
- "tld",
- eppInput.isDomainResourceType() ? extractTld(singleTargetId).orElse("") : "")
- .put(
- "tlds",
- eppInput.isDomainResourceType() ? extractTlds(targetIds).asList() : EMPTY_LIST)
+ .put("tld", eppInput.isDomainType() ? extractTld(singleTargetId).orElse("") : "")
+ .put("tlds", eppInput.isDomainType() ? extractTlds(targetIds).asList() : EMPTY_LIST)
.put("icannActivityReportField", extractActivityReportField(flowClass))
.build()));
}
diff --git a/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java b/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java
index 0c2d10d34..3675b63ae 100644
--- a/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java
+++ b/java/google/registry/flows/custom/DomainCreateFlowCustomLogic.java
@@ -22,7 +22,7 @@ import google.registry.flows.FlowMetadata;
import google.registry.flows.SessionMetadata;
import google.registry.flows.domain.DomainCreateFlow;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppResponse.ResponseData;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
@@ -125,10 +125,10 @@ public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic {
public abstract static class BeforeSaveParameters extends ImmutableObject {
/**
- * The new {@link DomainResource} entity that is going to be persisted at the end of the
+ * The new {@link DomainBase} entity that is going to be persisted at the end of the
* transaction.
*/
- public abstract DomainResource newDomain();
+ public abstract DomainBase newDomain();
/**
* The new {@link HistoryEntry} entity for the domain's creation that is going to be persisted
@@ -162,7 +162,7 @@ public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setNewDomain(DomainResource newDomain);
+ public abstract Builder setNewDomain(DomainBase newDomain);
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
diff --git a/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java b/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java
index b43418cf6..70a1b73a6 100644
--- a/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java
+++ b/java/google/registry/flows/custom/DomainDeleteFlowCustomLogic.java
@@ -21,7 +21,7 @@ import google.registry.flows.FlowMetadata;
import google.registry.flows.SessionMetadata;
import google.registry.flows.domain.DomainDeleteFlow;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import google.registry.model.eppoutput.Result;
@@ -83,7 +83,7 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class AfterValidationParameters extends ImmutableObject {
- public abstract DomainResource existingDomain();
+ public abstract DomainBase existingDomain();
public static Builder newBuilder() {
return new AutoValue_DomainDeleteFlowCustomLogic_AfterValidationParameters.Builder();
@@ -93,7 +93,7 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setExistingDomain(DomainResource existingDomain);
+ public abstract Builder setExistingDomain(DomainBase existingDomain);
public abstract AfterValidationParameters build();
}
@@ -109,9 +109,9 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class BeforeSaveParameters extends ImmutableObject {
- public abstract DomainResource existingDomain();
+ public abstract DomainBase existingDomain();
- public abstract DomainResource newDomain();
+ public abstract DomainBase newDomain();
public abstract HistoryEntry historyEntry();
@@ -125,9 +125,9 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setExistingDomain(DomainResource existingDomain);
+ public abstract Builder setExistingDomain(DomainBase existingDomain);
- public abstract Builder setNewDomain(DomainResource newDomain);
+ public abstract Builder setNewDomain(DomainBase newDomain);
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
diff --git a/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java b/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java
index fba46ed37..3b19fd2ea 100644
--- a/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java
+++ b/java/google/registry/flows/custom/DomainInfoFlowCustomLogic.java
@@ -21,8 +21,8 @@ import google.registry.flows.FlowMetadata;
import google.registry.flows.SessionMetadata;
import google.registry.flows.domain.DomainInfoFlow;
import google.registry.model.ImmutableObject;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainInfoData;
-import google.registry.model.domain.DomainResource;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
@@ -53,7 +53,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
/**
* A hook that runs before the response is returned.
*
- *
This takes the {@link DomainResource} and {@link ResponseExtension}s as input and returns
+ *
This takes the {@link DomainBase} and {@link ResponseExtension}s as input and returns
* them, potentially with modifications.
*/
@SuppressWarnings("unused")
@@ -69,7 +69,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class AfterValidationParameters extends ImmutableObject {
- public abstract DomainResource domain();
+ public abstract DomainBase domain();
public static Builder newBuilder() {
return new AutoValue_DomainInfoFlowCustomLogic_AfterValidationParameters.Builder();
@@ -79,7 +79,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setDomain(DomainResource domain);
+ public abstract Builder setDomain(DomainBase domain);
public abstract AfterValidationParameters build();
}
@@ -89,7 +89,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class BeforeResponseParameters extends ImmutableObject {
- public abstract DomainResource domain();
+ public abstract DomainBase domain();
public abstract DomainInfoData resData();
@@ -103,7 +103,7 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setDomain(DomainResource domain);
+ public abstract Builder setDomain(DomainBase domain);
public abstract Builder setResData(DomainInfoData resData);
diff --git a/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java b/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java
index 89497f6a6..adf6b1275 100644
--- a/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java
+++ b/java/google/registry/flows/custom/DomainRenewFlowCustomLogic.java
@@ -21,7 +21,7 @@ import google.registry.flows.FlowMetadata;
import google.registry.flows.SessionMetadata;
import google.registry.flows.domain.DomainRenewFlow;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppinput.EppInput;
import google.registry.model.eppoutput.EppResponse.ResponseData;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
@@ -68,7 +68,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
/**
* A hook that runs before the response is returned.
*
- *
This takes the {@link DomainResource} and {@link ResponseExtension}s as input and returns
+ *
This takes the {@link DomainBase} and {@link ResponseExtension}s as input and returns
* them, potentially with modifications.
*/
@SuppressWarnings("unused")
@@ -84,7 +84,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class AfterValidationParameters extends ImmutableObject {
- public abstract DomainResource existingDomain();
+ public abstract DomainBase existingDomain();
public abstract int years();
@@ -98,7 +98,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setExistingDomain(DomainResource existingDomain);
+ public abstract Builder setExistingDomain(DomainBase existingDomain);
public abstract Builder setYears(int years);
@@ -118,9 +118,9 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class BeforeSaveParameters extends ImmutableObject {
- public abstract DomainResource existingDomain();
+ public abstract DomainBase existingDomain();
- public abstract DomainResource newDomain();
+ public abstract DomainBase newDomain();
public abstract HistoryEntry historyEntry();
@@ -138,9 +138,9 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setExistingDomain(DomainResource existingDomain);
+ public abstract Builder setExistingDomain(DomainBase existingDomain);
- public abstract Builder setNewDomain(DomainResource newDomain);
+ public abstract Builder setNewDomain(DomainBase newDomain);
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
@@ -158,7 +158,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class BeforeResponseParameters extends ImmutableObject {
- public abstract DomainResource domain();
+ public abstract DomainBase domain();
public abstract ResponseData resData();
@@ -172,7 +172,7 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract BeforeResponseParameters.Builder setDomain(DomainResource domain);
+ public abstract BeforeResponseParameters.Builder setDomain(DomainBase domain);
public abstract BeforeResponseParameters.Builder setResData(ResponseData resData);
diff --git a/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java b/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java
index 09425d834..92f07b91a 100644
--- a/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java
+++ b/java/google/registry/flows/custom/DomainUpdateFlowCustomLogic.java
@@ -20,7 +20,7 @@ import google.registry.flows.FlowMetadata;
import google.registry.flows.SessionMetadata;
import google.registry.flows.domain.DomainUpdateFlow;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppinput.EppInput;
import google.registry.model.reporting.HistoryEntry;
@@ -65,7 +65,7 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class AfterValidationParameters extends ImmutableObject {
- public abstract DomainResource existingDomain();
+ public abstract DomainBase existingDomain();
public static Builder newBuilder() {
return new AutoValue_DomainUpdateFlowCustomLogic_AfterValidationParameters.Builder();
@@ -75,7 +75,7 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setExistingDomain(DomainResource existingDomain);
+ public abstract Builder setExistingDomain(DomainBase existingDomain);
public abstract AfterValidationParameters build();
}
@@ -91,9 +91,9 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue
public abstract static class BeforeSaveParameters extends ImmutableObject {
- public abstract DomainResource existingDomain();
+ public abstract DomainBase existingDomain();
- public abstract DomainResource newDomain();
+ public abstract DomainBase newDomain();
public abstract HistoryEntry historyEntry();
@@ -107,9 +107,9 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic {
@AutoValue.Builder
public abstract static class Builder {
- public abstract Builder setExistingDomain(DomainResource existingDomain);
+ public abstract Builder setExistingDomain(DomainBase existingDomain);
- public abstract Builder setNewDomain(DomainResource newDomain);
+ public abstract Builder setNewDomain(DomainBase newDomain);
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
diff --git a/java/google/registry/flows/domain/DomainCheckFlow.java b/java/google/registry/flows/domain/DomainCheckFlow.java
index 2735c4249..ce53e27e6 100644
--- a/java/google/registry/flows/domain/DomainCheckFlow.java
+++ b/java/google/registry/flows/domain/DomainCheckFlow.java
@@ -42,8 +42,8 @@ import google.registry.flows.custom.DomainCheckFlowCustomLogic;
import google.registry.flows.custom.DomainCheckFlowCustomLogic.BeforeResponseParameters;
import google.registry.flows.custom.DomainCheckFlowCustomLogic.BeforeResponseReturnData;
import google.registry.flows.domain.token.AllocationTokenFlowUtils;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand.Check;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.fee.FeeCheckCommandExtension;
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
@@ -141,7 +141,7 @@ public final class DomainCheckFlow implements Flow {
// TODO: Use as of date from fee extension v0.12 instead of now, if specified.
.setAsOfDate(now)
.build());
- Set existingIds = checkResourcesExist(DomainResource.class, targetIds, now);
+ Set existingIds = checkResourcesExist(DomainBase.class, targetIds, now);
Optional allocationTokenExtension =
eppInput.getSingleExtension(AllocationTokenExtension.class);
ImmutableMap tokenCheckResults =
diff --git a/java/google/registry/flows/domain/DomainCreateFlow.java b/java/google/registry/flows/domain/DomainCreateFlow.java
index f830a5f1b..c65ce8275 100644
--- a/java/google/registry/flows/domain/DomainCreateFlow.java
+++ b/java/google/registry/flows/domain/DomainCreateFlow.java
@@ -76,9 +76,9 @@ import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Flag;
import google.registry.model.billing.BillingEvent.Reason;
import google.registry.model.billing.BillingEvent.Recurring;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand;
import google.registry.model.domain.DomainCommand.Create;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeCreateCommandExtension;
@@ -221,7 +221,7 @@ public class DomainCreateFlow implements TransactionalFlow {
verifyUnitIsYears(period);
int years = period.getValue();
validateRegistrationPeriod(years);
- verifyResourceDoesNotExist(DomainResource.class, targetId, now);
+ verifyResourceDoesNotExist(DomainBase.class, targetId, now);
// Validate that this is actually a legal domain name on a TLD that the registrar has access to.
InternetDomainName domainName = validateDomainName(command.getFullyQualifiedDomainName());
String domainLabel = domainName.parts().get(0);
@@ -334,8 +334,8 @@ public class DomainCreateFlow implements TransactionalFlow {
createNameCollisionOneTimePollMessage(targetId, historyEntry, clientId, now));
}
- DomainResource newDomain =
- new DomainResource.Builder()
+ DomainBase newDomain =
+ new DomainBase.Builder()
.setCreationClientId(clientId)
.setPersistedCurrentSponsorClientId(clientId)
.setRepoId(repoId)
@@ -477,7 +477,7 @@ public class DomainCreateFlow implements TransactionalFlow {
.setType(HistoryEntry.Type.DOMAIN_CREATE)
.setPeriod(period)
.setModificationTime(now)
- .setParent(Key.create(DomainResource.class, repoId))
+ .setParent(Key.create(DomainBase.class, repoId))
.build();
}
@@ -573,12 +573,12 @@ public class DomainCreateFlow implements TransactionalFlow {
}
private void enqueueTasks(
- DomainResource newDomain, boolean hasSignedMarks, boolean hasClaimsNotice) {
+ DomainBase newDomain, boolean hasSignedMarks, boolean hasClaimsNotice) {
if (newDomain.shouldPublishToDns()) {
dnsQueue.addDomainRefreshTask(newDomain.getFullyQualifiedDomainName());
}
if (hasClaimsNotice || hasSignedMarks) {
- LordnTaskUtils.enqueueDomainResourceTask(newDomain);
+ LordnTaskUtils.enqueueDomainBaseTask(newDomain);
}
}
diff --git a/java/google/registry/flows/domain/DomainDeleteFlow.java b/java/google/registry/flows/domain/DomainDeleteFlow.java
index e4cb34687..c4dbd007b 100644
--- a/java/google/registry/flows/domain/DomainDeleteFlow.java
+++ b/java/google/registry/flows/domain/DomainDeleteFlow.java
@@ -61,8 +61,8 @@ import google.registry.flows.custom.DomainDeleteFlowCustomLogic.BeforeSaveParame
import google.registry.flows.custom.EntityChanges;
import google.registry.model.ImmutableObject;
import google.registry.model.billing.BillingEvent;
-import google.registry.model.domain.DomainResource;
-import google.registry.model.domain.DomainResource.Builder;
+import google.registry.model.domain.DomainBase;
+import google.registry.model.domain.DomainBase.Builder;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Credit;
@@ -143,7 +143,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime();
// Loads the target resource if it exists
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
Registry registry = Registry.get(existingDomain.getTld());
verifyDeleteAllowed(existingDomain, registry, now);
flowCustomLogic.afterValidation(
@@ -204,7 +204,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
// message are produced (since we are ending the autorenew recurrences at "now" below). For
// now at least this is working as intended.
}
- DomainResource newDomain = builder.build();
+ DomainBase newDomain = builder.build();
updateForeignKeyIndexDeletionTime(newDomain);
handlePendingTransferOnDelete(existingDomain, newDomain, now, historyEntry);
// Close the autorenew billing event and poll message. This may delete the poll message.
@@ -245,7 +245,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
.build();
}
- private void verifyDeleteAllowed(DomainResource existingDomain, Registry registry, DateTime now)
+ private void verifyDeleteAllowed(DomainBase existingDomain, Registry registry, DateTime now)
throws EppException {
verifyNoDisallowedStatuses(existingDomain, DISALLOWED_STATUSES);
verifyOptionalAuthInfo(authInfo, existingDomain);
@@ -260,7 +260,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
}
private HistoryEntry buildHistoryEntry(
- DomainResource existingResource,
+ DomainBase existingResource,
Registry registry,
DateTime now,
Duration durationUntilDelete,
@@ -298,7 +298,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
}
private OneTime createDeletePollMessage(
- DomainResource existingResource, HistoryEntry historyEntry, DateTime deletionTime) {
+ DomainBase existingResource, HistoryEntry historyEntry, DateTime deletionTime) {
return new PollMessage.OneTime.Builder()
.setClientId(existingResource.getCurrentSponsorClientId())
.setEventTime(deletionTime)
@@ -312,7 +312,7 @@ public final class DomainDeleteFlow implements TransactionalFlow {
@Nullable
private ImmutableList getResponseExtensions(
- DomainResource existingDomain, DateTime now) {
+ DomainBase existingDomain, DateTime now) {
FeeTransformResponseExtension.Builder feeResponseBuilder = getDeleteResponseBuilder();
if (feeResponseBuilder == null) {
return ImmutableList.of();
diff --git a/java/google/registry/flows/domain/DomainFlowUtils.java b/java/google/registry/flows/domain/DomainFlowUtils.java
index 8a44689af..33c1a5c5b 100644
--- a/java/google/registry/flows/domain/DomainFlowUtils.java
+++ b/java/google/registry/flows/domain/DomainFlowUtils.java
@@ -22,7 +22,7 @@ import static com.google.common.collect.Iterables.any;
import static com.google.common.collect.Sets.difference;
import static com.google.common.collect.Sets.intersection;
import static com.google.common.collect.Sets.union;
-import static google.registry.model.domain.DomainResource.MAX_REGISTRATION_YEARS;
+import static google.registry.model.domain.DomainBase.MAX_REGISTRATION_YEARS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.Registries.findTldForName;
import static google.registry.model.registry.Registries.getTlds;
@@ -77,7 +77,6 @@ import google.registry.model.domain.DomainCommand.Create;
import google.registry.model.domain.DomainCommand.CreateOrUpdate;
import google.registry.model.domain.DomainCommand.InvalidReferencesException;
import google.registry.model.domain.DomainCommand.Update;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.ForeignKeyedDesignatedContact;
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.BaseFee.FeeType;
@@ -504,7 +503,7 @@ public class DomainFlowUtils {
* Fills in a builder with the data needed for an autorenew billing event for this domain. This
* does not copy over the id of the current autorenew billing event.
*/
- public static BillingEvent.Recurring.Builder newAutorenewBillingEvent(DomainResource domain) {
+ public static BillingEvent.Recurring.Builder newAutorenewBillingEvent(DomainBase domain) {
return new BillingEvent.Recurring.Builder()
.setReason(Reason.RENEW)
.setFlags(ImmutableSet.of(Flag.AUTO_RENEW))
@@ -517,7 +516,7 @@ public class DomainFlowUtils {
* Fills in a builder with the data needed for an autorenew poll message for this domain. This
* does not copy over the id of the current autorenew poll message.
*/
- public static PollMessage.Autorenew.Builder newAutorenewPollMessage(DomainResource domain) {
+ public static PollMessage.Autorenew.Builder newAutorenewPollMessage(DomainBase domain) {
return new PollMessage.Autorenew.Builder()
.setTargetId(domain.getFullyQualifiedDomainName())
.setClientId(domain.getCurrentSponsorClientId())
@@ -533,7 +532,7 @@ public class DomainFlowUtils {
* time earlier than its event time (i.e. if it's being ended before it was ever triggered).
*/
@SuppressWarnings("unchecked")
- public static void updateAutorenewRecurrenceEndTime(DomainResource domain, DateTime newEndTime) {
+ public static void updateAutorenewRecurrenceEndTime(DomainBase domain, DateTime newEndTime) {
Optional autorenewPollMessage =
Optional.ofNullable(ofy().load().key(domain.getAutorenewPollMessage()).now());
@@ -787,7 +786,7 @@ public class DomainFlowUtils {
/**
* Check whether a new expiration time (via a renew) does not extend beyond a maximum number of
- * years (e.g. {@link DomainResource#MAX_REGISTRATION_YEARS}) from "now".
+ * years (e.g. {@link DomainBase#MAX_REGISTRATION_YEARS}) from "now".
*
* @throws ExceedsMaxRegistrationYearsException if the new registration period is too long
*/
@@ -800,7 +799,7 @@ public class DomainFlowUtils {
/**
* Check that a new registration period (via a create) does not extend beyond a maximum number of
- * years (e.g. {@link DomainResource#MAX_REGISTRATION_YEARS}).
+ * years (e.g. {@link DomainBase#MAX_REGISTRATION_YEARS}).
*
* @throws ExceedsMaxRegistrationYearsException if the new registration period is too long
*/
@@ -1019,7 +1018,7 @@ public class DomainFlowUtils {
* the most recent HistoryEntry that fits the above criteria, with negated reportAmounts.
*/
static ImmutableSet createCancelingRecords(
- DomainResource domainResource,
+ DomainBase domainBase,
final DateTime now,
Duration maxSearchPeriod,
final ImmutableSet cancelableFields) {
@@ -1028,7 +1027,7 @@ public class DomainFlowUtils {
ofy()
.load()
.type(HistoryEntry.class)
- .ancestor(domainResource)
+ .ancestor(domainBase)
.filter("modificationTime >=", now.minus(maxSearchPeriod))
.order("modificationTime")
.list();
diff --git a/java/google/registry/flows/domain/DomainInfoFlow.java b/java/google/registry/flows/domain/DomainInfoFlow.java
index 03357280a..a87b23dbb 100644
--- a/java/google/registry/flows/domain/DomainInfoFlow.java
+++ b/java/google/registry/flows/domain/DomainInfoFlow.java
@@ -37,10 +37,10 @@ import google.registry.flows.custom.DomainInfoFlowCustomLogic;
import google.registry.flows.custom.DomainInfoFlowCustomLogic.AfterValidationParameters;
import google.registry.flows.custom.DomainInfoFlowCustomLogic.BeforeResponseParameters;
import google.registry.flows.custom.DomainInfoFlowCustomLogic.BeforeResponseReturnData;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand.Info;
import google.registry.model.domain.DomainCommand.Info.HostsRequest;
import google.registry.model.domain.DomainInfoData;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.fee06.FeeInfoCommandExtensionV06;
import google.registry.model.domain.fee06.FeeInfoResponseExtensionV06;
import google.registry.model.domain.rgp.GracePeriodStatus;
@@ -95,8 +95,8 @@ public final class DomainInfoFlow implements Flow {
extensionManager.validate();
validateClientIsLoggedIn(clientId);
DateTime now = clock.nowUtc();
- DomainResource domain = verifyExistence(
- DomainResource.class, targetId, loadByForeignKey(DomainResource.class, targetId, now));
+ DomainBase domain = verifyExistence(
+ DomainBase.class, targetId, loadByForeignKey(DomainBase.class, targetId, now));
verifyOptionalAuthInfo(authInfo, domain);
flowCustomLogic.afterValidation(
AfterValidationParameters.newBuilder().setDomain(domain).build());
@@ -145,7 +145,7 @@ public final class DomainInfoFlow implements Flow {
}
private ImmutableList getDomainResponseExtensions(
- DomainResource domain, DateTime now) throws EppException {
+ DomainBase domain, DateTime now) throws EppException {
ImmutableList.Builder extensions = new ImmutableList.Builder<>();
addSecDnsExtensionIfPresent(extensions, domain.getDsData());
ImmutableSet gracePeriodStatuses = domain.getGracePeriodStatuses();
diff --git a/java/google/registry/flows/domain/DomainRenewFlow.java b/java/google/registry/flows/domain/DomainRenewFlow.java
index 3a122a49c..37049b072 100644
--- a/java/google/registry/flows/domain/DomainRenewFlow.java
+++ b/java/google/registry/flows/domain/DomainRenewFlow.java
@@ -51,9 +51,9 @@ import google.registry.flows.custom.EntityChanges;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.OneTime;
import google.registry.model.billing.BillingEvent.Reason;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand.Renew;
import google.registry.model.domain.DomainRenewData;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.BaseFee.FeeType;
@@ -139,7 +139,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
DateTime now = ofy().getTransactionTime();
Renew command = (Renew) resourceCommand;
// Loads the target resource if it exists
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyRenewAllowed(authInfo, existingDomain, command);
int years = command.getPeriod().getValue();
DateTime newExpirationTime =
@@ -174,7 +174,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
.build();
// End the old autorenew billing event and poll message now. This may delete the poll message.
updateAutorenewRecurrenceEndTime(existingDomain, now);
- DomainResource newDomain =
+ DomainBase newDomain =
existingDomain
.asBuilder()
.setLastEppUpdateTime(now)
@@ -220,7 +220,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
}
private HistoryEntry buildHistoryEntry(
- DomainResource existingDomain, DateTime now, Period period, Duration renewGracePeriod) {
+ DomainBase existingDomain, DateTime now, Period period, Duration renewGracePeriod) {
return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_RENEW)
.setPeriod(period)
@@ -238,7 +238,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
private void verifyRenewAllowed(
Optional authInfo,
- DomainResource existingDomain,
+ DomainBase existingDomain,
Renew command) throws EppException {
verifyOptionalAuthInfo(authInfo, existingDomain);
verifyNoDisallowedStatuses(existingDomain, RENEW_DISALLOWED_STATUSES);
diff --git a/java/google/registry/flows/domain/DomainRestoreRequestFlow.java b/java/google/registry/flows/domain/DomainRestoreRequestFlow.java
index 02abe2a5f..197e550e0 100644
--- a/java/google/registry/flows/domain/DomainRestoreRequestFlow.java
+++ b/java/google/registry/flows/domain/DomainRestoreRequestFlow.java
@@ -48,8 +48,8 @@ import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.OneTime;
import google.registry.model.billing.BillingEvent.OneTime.Builder;
import google.registry.model.billing.BillingEvent.Reason;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand.Update;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeTransformResponseExtension;
@@ -134,7 +134,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
verifyRegistrarIsActive(clientId);
Update command = (Update) resourceCommand;
DateTime now = ofy().getTransactionTime();
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
FeesAndCredits feesAndCredits =
pricingLogic.getRestorePrice(Registry.get(existingDomain.getTld()), targetId, now);
Optional feeUpdate =
@@ -160,7 +160,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
.setAutorenewEndTime(END_OF_TIME)
.setParent(historyEntry)
.build();
- DomainResource newDomain =
+ DomainBase newDomain =
performRestore(
existingDomain, newExpirationTime, autorenewEvent, autorenewPollMessage, now, clientId);
updateForeignKeyIndexDeletionTime(newDomain);
@@ -175,7 +175,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
.build();
}
- private HistoryEntry buildHistoryEntry(DomainResource existingDomain, DateTime now) {
+ private HistoryEntry buildHistoryEntry(DomainBase existingDomain, DateTime now) {
return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_RESTORE)
.setModificationTime(now)
@@ -189,7 +189,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
private void verifyRestoreAllowed(
Update command,
- DomainResource existingDomain,
+ DomainBase existingDomain,
Optional feeUpdate,
FeesAndCredits feesAndCredits,
DateTime now) throws EppException {
@@ -223,8 +223,8 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
return ImmutableSet.of(restoreEvent, renewEvent);
}
- private static DomainResource performRestore(
- DomainResource existingDomain,
+ private static DomainBase performRestore(
+ DomainBase existingDomain,
DateTime newExpirationTime,
BillingEvent.Recurring autorenewEvent,
PollMessage.Autorenew autorenewPollMessage,
diff --git a/java/google/registry/flows/domain/DomainTransferApproveFlow.java b/java/google/registry/flows/domain/DomainTransferApproveFlow.java
index 555063b06..713cce753 100644
--- a/java/google/registry/flows/domain/DomainTransferApproveFlow.java
+++ b/java/google/registry/flows/domain/DomainTransferApproveFlow.java
@@ -26,7 +26,7 @@ import static google.registry.flows.domain.DomainFlowUtils.updateAutorenewRecurr
import static google.registry.flows.domain.DomainTransferUtils.createGainingTransferPollMessage;
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse;
import static google.registry.model.ResourceTransferUtils.approvePendingTransfer;
-import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
+import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.reporting.DomainTransactionRecord.TransactionReportField.TRANSFER_SUCCESSFUL;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
@@ -46,7 +46,7 @@ import google.registry.model.ImmutableObject;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Flag;
import google.registry.model.billing.BillingEvent.Reason;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.domain.rgp.GracePeriodStatus;
@@ -95,7 +95,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
/**
*
The logic in this flow, which handles client approvals, very closely parallels the logic in
- * {@link DomainResource#cloneProjectedAtTime} which handles implicit server approvals.
+ * {@link DomainBase#cloneProjectedAtTime} which handles implicit server approvals.
*/
@Override
public final EppResponse run() throws EppException {
@@ -103,7 +103,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
extensionManager.validate();
validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime();
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyOptionalAuthInfo(authInfo, existingDomain);
verifyHasPendingTransfer(existingDomain);
verifyResourceOwnership(clientId, existingDomain);
@@ -173,9 +173,9 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
.setParent(historyEntry)
.build();
// Construct the post-transfer domain.
- DomainResource partiallyApprovedDomain =
+ DomainBase partiallyApprovedDomain =
approvePendingTransfer(existingDomain, TransferStatus.CLIENT_APPROVED, now);
- DomainResource newDomain =
+ DomainBase newDomain =
partiallyApprovedDomain
.asBuilder()
// Update the transferredRegistrationExpirationTime here since approvePendingTransfer()
@@ -223,7 +223,7 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
}
private HistoryEntry buildHistoryEntry(
- DomainResource existingDomain, Registry registry, DateTime now, String gainingClientId) {
+ DomainBase existingDomain, Registry registry, DateTime now, String gainingClientId) {
ImmutableSet cancelingRecords =
createCancelingRecords(
existingDomain,
diff --git a/java/google/registry/flows/domain/DomainTransferCancelFlow.java b/java/google/registry/flows/domain/DomainTransferCancelFlow.java
index 123236e98..7251180cb 100644
--- a/java/google/registry/flows/domain/DomainTransferCancelFlow.java
+++ b/java/google/registry/flows/domain/DomainTransferCancelFlow.java
@@ -39,7 +39,7 @@ import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.eppcommon.AuthInfo;
import google.registry.model.eppoutput.EppResponse;
@@ -88,7 +88,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
extensionManager.validate();
validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime();
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyOptionalAuthInfo(authInfo, existingDomain);
verifyHasPendingTransfer(existingDomain);
verifyTransferInitiator(clientId, existingDomain);
@@ -97,7 +97,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
}
Registry registry = Registry.get(existingDomain.getTld());
HistoryEntry historyEntry = buildHistoryEntry(existingDomain, registry, now);
- DomainResource newDomain =
+ DomainBase newDomain =
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_CANCELLED, now, clientId);
ofy().save().entities(
newDomain,
@@ -116,7 +116,7 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
}
private HistoryEntry buildHistoryEntry(
- DomainResource existingDomain, Registry registry, DateTime now) {
+ DomainBase existingDomain, Registry registry, DateTime now) {
ImmutableSet cancelingRecords =
createCancelingRecords(
existingDomain,
diff --git a/java/google/registry/flows/domain/DomainTransferQueryFlow.java b/java/google/registry/flows/domain/DomainTransferQueryFlow.java
index 2e16e40d3..6ce16eda3 100644
--- a/java/google/registry/flows/domain/DomainTransferQueryFlow.java
+++ b/java/google/registry/flows/domain/DomainTransferQueryFlow.java
@@ -18,7 +18,7 @@ import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfo;
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse;
-import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
+import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager;
@@ -28,7 +28,7 @@ import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.annotations.ReportingSpec;
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
import google.registry.flows.exceptions.NotAuthorizedToViewTransferException;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppcommon.AuthInfo;
import google.registry.model.eppoutput.EppResponse;
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
@@ -70,7 +70,7 @@ public final class DomainTransferQueryFlow implements Flow {
extensionManager.validate(); // There are no legal extensions for this flow.
validateClientIsLoggedIn(clientId);
DateTime now = clock.nowUtc();
- DomainResource domain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase domain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyOptionalAuthInfo(authInfo, domain);
// Most of the fields on the transfer response are required, so there's no way to return valid
// XML if the object has never been transferred (and hence the fields aren't populated).
diff --git a/java/google/registry/flows/domain/DomainTransferRejectFlow.java b/java/google/registry/flows/domain/DomainTransferRejectFlow.java
index 3408605fc..4b01ab1b9 100644
--- a/java/google/registry/flows/domain/DomainTransferRejectFlow.java
+++ b/java/google/registry/flows/domain/DomainTransferRejectFlow.java
@@ -41,7 +41,7 @@ import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.eppcommon.AuthInfo;
import google.registry.model.eppoutput.EppResponse;
@@ -90,7 +90,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
extensionManager.validate();
validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime();
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
Registry registry = Registry.get(existingDomain.getTld());
HistoryEntry historyEntry = buildHistoryEntry(existingDomain, registry, now);
verifyOptionalAuthInfo(authInfo, existingDomain);
@@ -99,7 +99,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
if (!isSuperuser) {
checkAllowedAccessToTld(clientId, existingDomain.getTld());
}
- DomainResource newDomain =
+ DomainBase newDomain =
denyPendingTransfer(existingDomain, TransferStatus.CLIENT_REJECTED, now, clientId);
ofy().save().entities(
newDomain,
@@ -118,7 +118,7 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
}
private HistoryEntry buildHistoryEntry(
- DomainResource existingDomain, Registry registry, DateTime now) {
+ DomainBase existingDomain, Registry registry, DateTime now) {
ImmutableSet cancelingRecords =
createCancelingRecords(
existingDomain,
diff --git a/java/google/registry/flows/domain/DomainTransferRequestFlow.java b/java/google/registry/flows/domain/DomainTransferRequestFlow.java
index 7799a08c7..721c9fa17 100644
--- a/java/google/registry/flows/domain/DomainTransferRequestFlow.java
+++ b/java/google/registry/flows/domain/DomainTransferRequestFlow.java
@@ -29,7 +29,7 @@ import static google.registry.flows.domain.DomainTransferUtils.createLosingTrans
import static google.registry.flows.domain.DomainTransferUtils.createPendingTransferData;
import static google.registry.flows.domain.DomainTransferUtils.createTransferResponse;
import static google.registry.flows.domain.DomainTransferUtils.createTransferServerApproveEntities;
-import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
+import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy;
@@ -49,8 +49,8 @@ import google.registry.flows.exceptions.InvalidTransferPeriodValueException;
import google.registry.flows.exceptions.ObjectAlreadySponsoredException;
import google.registry.flows.exceptions.TransferPeriodMustBeOneYearException;
import google.registry.flows.exceptions.TransferPeriodZeroAndFeeTransferExtensionException;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand.Transfer;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeTransferCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension;
@@ -143,7 +143,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
validateClientIsLoggedIn(gainingClientId);
verifyRegistrarIsActive(gainingClientId);
DateTime now = ofy().getTransactionTime();
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
Optional superuserExtension =
eppInput.getSingleExtension(DomainTransferRequestSuperuserExtension.class);
Period period =
@@ -182,7 +182,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
// See b/19430703#comment17 and https://www.icann.org/news/advisory-2002-06-06-en for the
// policy documentation for transfers subsuming autorenews within the autorenew grace period.
int extraYears = period.getValue();
- DomainResource domainAtTransferTime =
+ DomainBase domainAtTransferTime =
existingDomain.cloneProjectedAtTime(automaticTransferTime);
if (!domainAtTransferTime.getGracePeriodsOfType(GracePeriodStatus.AUTO_RENEW).isEmpty()) {
extraYears = 0;
@@ -225,7 +225,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
// cloneProjectedAtTime() will replace these old autorenew entities with the server approve ones
// that we've created in this flow and stored in pendingTransferData.
updateAutorenewRecurrenceEndTime(existingDomain, automaticTransferTime);
- DomainResource newDomain =
+ DomainBase newDomain =
existingDomain
.asBuilder()
.setTransferData(pendingTransferData)
@@ -248,7 +248,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
}
private void verifyTransferAllowed(
- DomainResource existingDomain,
+ DomainBase existingDomain,
Period period,
DateTime now,
Optional superuserExtension)
@@ -310,7 +310,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
}
private HistoryEntry buildHistoryEntry(
- DomainResource existingDomain, Registry registry, DateTime now, Period period) {
+ DomainBase existingDomain, Registry registry, DateTime now, Period period) {
return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST)
.setOtherClientId(existingDomain.getCurrentSponsorClientId())
@@ -329,7 +329,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
}
private DomainTransferResponse createResponse(
- Period period, DomainResource existingDomain, DomainResource newDomain, DateTime now) {
+ Period period, DomainBase existingDomain, DomainBase newDomain, DateTime now) {
// If the registration were approved this instant, this is what the new expiration would be,
// because we cap at 10 years from the moment of approval. This is different than the server
// approval new expiration time, which is capped at 10 years from the server approve time.
diff --git a/java/google/registry/flows/domain/DomainTransferUtils.java b/java/google/registry/flows/domain/DomainTransferUtils.java
index fe24d01cf..49bab34c4 100644
--- a/java/google/registry/flows/domain/DomainTransferUtils.java
+++ b/java/google/registry/flows/domain/DomainTransferUtils.java
@@ -24,7 +24,7 @@ import com.googlecode.objectify.Key;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Flag;
import google.registry.model.billing.BillingEvent.Reason;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.Period;
import google.registry.model.domain.rgp.GracePeriodStatus;
@@ -106,7 +106,7 @@ public final class DomainTransferUtils {
DateTime automaticTransferTime,
DateTime serverApproveNewExpirationTime,
HistoryEntry historyEntry,
- DomainResource existingDomain,
+ DomainBase existingDomain,
Trid trid,
String gainingClientId,
Optional transferCost,
@@ -258,9 +258,9 @@ public final class DomainTransferUtils {
DateTime automaticTransferTime,
HistoryEntry historyEntry,
String targetId,
- DomainResource existingDomain,
+ DomainBase existingDomain,
Optional transferCost) {
- DomainResource domainAtTransferTime =
+ DomainBase domainAtTransferTime =
existingDomain.cloneProjectedAtTime(automaticTransferTime);
GracePeriod autorenewGracePeriod =
getOnlyElement(
diff --git a/java/google/registry/flows/domain/DomainUpdateFlow.java b/java/google/registry/flows/domain/DomainUpdateFlow.java
index 5aa32a6de..f22d676ed 100644
--- a/java/google/registry/flows/domain/DomainUpdateFlow.java
+++ b/java/google/registry/flows/domain/DomainUpdateFlow.java
@@ -62,10 +62,10 @@ import google.registry.flows.domain.DomainFlowUtils.MissingRegistrantException;
import google.registry.model.ImmutableObject;
import google.registry.model.billing.BillingEvent;
import google.registry.model.billing.BillingEvent.Reason;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.DomainCommand.Update;
import google.registry.model.domain.DomainCommand.Update.AddRemove;
import google.registry.model.domain.DomainCommand.Update.Change;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.fee.FeeUpdateCommandExtension;
import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.domain.secdns.SecDnsUpdateExtension;
@@ -162,12 +162,12 @@ public final class DomainUpdateFlow implements TransactionalFlow {
validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime();
Update command = cloneAndLinkReferences((Update) resourceCommand, now);
- DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
+ DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
verifyUpdateAllowed(command, existingDomain, now);
flowCustomLogic.afterValidation(
AfterValidationParameters.newBuilder().setExistingDomain(existingDomain).build());
HistoryEntry historyEntry = buildHistoryEntry(existingDomain, now);
- DomainResource newDomain = performUpdate(command, existingDomain, now);
+ DomainBase newDomain = performUpdate(command, existingDomain, now);
validateNewState(newDomain);
dnsQueue.addDomainRefreshTask(targetId);
ImmutableSet.Builder entitiesToSave = new ImmutableSet.Builder<>();
@@ -189,7 +189,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
}
/** Fail if the object doesn't exist or was deleted. */
- private void verifyUpdateAllowed(Update command, DomainResource existingDomain, DateTime now)
+ private void verifyUpdateAllowed(Update command, DomainBase existingDomain, DateTime now)
throws EppException {
verifyOptionalAuthInfo(authInfo, existingDomain);
AddRemove add = command.getInnerAdd();
@@ -225,7 +225,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
domainName, nullToEmpty(add.getNameserverFullyQualifiedHostNames()));
}
- private HistoryEntry buildHistoryEntry(DomainResource existingDomain, DateTime now) {
+ private HistoryEntry buildHistoryEntry(DomainBase existingDomain, DateTime now) {
return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_UPDATE)
.setModificationTime(now)
@@ -233,7 +233,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
.build();
}
- private DomainResource performUpdate(Update command, DomainResource domain, DateTime now)
+ private DomainBase performUpdate(Update command, DomainBase domain, DateTime now)
throws EppException {
AddRemove add = command.getInnerAdd();
AddRemove remove = command.getInnerRemove();
@@ -244,7 +244,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
validateRegistrantIsntBeingRemoved(change);
Optional secDnsUpdate =
eppInput.getSingleExtension(SecDnsUpdateExtension.class);
- DomainResource.Builder domainBuilder =
+ DomainBase.Builder domainBuilder =
domain
.asBuilder()
// Handle the secDNS extension.
@@ -276,7 +276,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
}
}
- private void validateNewState(DomainResource newDomain) throws EppException {
+ private void validateNewState(DomainBase newDomain) throws EppException {
validateNoDuplicateContacts(newDomain.getContacts());
validateRequiredContactsPresent(newDomain.getRegistrant(), newDomain.getContacts());
validateDsData(newDomain.getDsData());
@@ -288,8 +288,8 @@ public final class DomainUpdateFlow implements TransactionalFlow {
/** Some status updates cost money. Bill only once no matter how many of them are changed. */
private Optional createBillingEventForStatusUpdates(
- DomainResource existingDomain,
- DomainResource newDomain,
+ DomainBase existingDomain,
+ DomainBase newDomain,
HistoryEntry historyEntry,
DateTime now) {
Optional metadataExtension =
diff --git a/java/google/registry/flows/host/HostCreateFlow.java b/java/google/registry/flows/host/HostCreateFlow.java
index 63aa8c0a0..504addb2e 100644
--- a/java/google/registry/flows/host/HostCreateFlow.java
+++ b/java/google/registry/flows/host/HostCreateFlow.java
@@ -38,7 +38,7 @@ import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.TransactionalFlow;
import google.registry.flows.annotations.ReportingSpec;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.eppinput.ResourceCommand;
import google.registry.model.eppoutput.CreateData.HostCreateData;
@@ -106,7 +106,7 @@ public final class HostCreateFlow implements TransactionalFlow {
// The superordinate domain of the host object if creating an in-bailiwick host, or null if
// creating an external host. This is looked up before we actually create the Host object so
// we can detect error conditions earlier.
- Optional superordinateDomain =
+ Optional superordinateDomain =
lookupSuperordinateDomain(validateHostName(targetId), now);
verifySuperordinateDomainNotInPendingDelete(superordinateDomain.orElse(null));
verifySuperordinateDomainOwnership(clientId, superordinateDomain.orElse(null));
diff --git a/java/google/registry/flows/host/HostFlowUtils.java b/java/google/registry/flows/host/HostFlowUtils.java
index 704eaa397..9ffd7a146 100644
--- a/java/google/registry/flows/host/HostFlowUtils.java
+++ b/java/google/registry/flows/host/HostFlowUtils.java
@@ -29,7 +29,7 @@ import google.registry.flows.EppException.ParameterValuePolicyErrorException;
import google.registry.flows.EppException.ParameterValueRangeErrorException;
import google.registry.flows.EppException.ParameterValueSyntaxErrorException;
import google.registry.flows.EppException.StatusProhibitsOperationException;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppcommon.StatusValue;
import google.registry.util.Idn;
import java.util.Optional;
@@ -77,8 +77,8 @@ public class HostFlowUtils {
}
}
- /** Return the {@link DomainResource} this host is subordinate to, or null for external hosts. */
- public static Optional lookupSuperordinateDomain(
+ /** Return the {@link DomainBase} this host is subordinate to, or null for external hosts. */
+ public static Optional lookupSuperordinateDomain(
InternetDomainName hostName, DateTime now) throws EppException {
Optional tld = findTldForName(hostName);
if (!tld.isPresent()) {
@@ -90,8 +90,8 @@ public class HostFlowUtils {
hostName.parts().stream()
.skip(hostName.parts().size() - (tld.get().parts().size() + 1))
.collect(joining("."));
- Optional superordinateDomain =
- loadByForeignKey(DomainResource.class, domainName, now);
+ Optional superordinateDomain =
+ loadByForeignKey(DomainBase.class, domainName, now);
if (!superordinateDomain.isPresent() || !isActive(superordinateDomain.get(), now)) {
throw new SuperordinateDomainDoesNotExistException(domainName);
}
@@ -101,13 +101,13 @@ public class HostFlowUtils {
/** Superordinate domain for this hostname does not exist. */
static class SuperordinateDomainDoesNotExistException extends ObjectDoesNotExistException {
public SuperordinateDomainDoesNotExistException(String domainName) {
- super(DomainResource.class, domainName);
+ super(DomainBase.class, domainName);
}
}
/** Ensure that the superordinate domain is sponsored by the provided clientId. */
static void verifySuperordinateDomainOwnership(
- String clientId, DomainResource superordinateDomain) throws EppException {
+ String clientId, DomainBase superordinateDomain) throws EppException {
if (superordinateDomain != null
&& !clientId.equals(superordinateDomain.getCurrentSponsorClientId())) {
throw new HostDomainNotOwnedException();
@@ -122,7 +122,7 @@ public class HostFlowUtils {
}
/** Ensure that the superordinate domain is not in pending delete. */
- static void verifySuperordinateDomainNotInPendingDelete(DomainResource superordinateDomain)
+ static void verifySuperordinateDomainNotInPendingDelete(DomainBase superordinateDomain)
throws EppException {
if ((superordinateDomain != null)
&& superordinateDomain.getStatusValues().contains(StatusValue.PENDING_DELETE)) {
diff --git a/java/google/registry/flows/host/HostInfoFlow.java b/java/google/registry/flows/host/HostInfoFlow.java
index 6750f0fca..692eceb24 100644
--- a/java/google/registry/flows/host/HostInfoFlow.java
+++ b/java/google/registry/flows/host/HostInfoFlow.java
@@ -28,7 +28,7 @@ import google.registry.flows.Flow;
import google.registry.flows.FlowModule.ClientId;
import google.registry.flows.FlowModule.TargetId;
import google.registry.flows.annotations.ReportingSpec;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.eppoutput.EppResponse;
import google.registry.model.host.HostInfoData;
@@ -77,7 +77,7 @@ public final class HostInfoFlow implements Flow {
// the client id, last transfer time, and pending transfer status need to be read off of it. If
// there is no superordinate domain, the host's own values for these fields will be correct.
if (host.isSubordinate()) {
- DomainResource superordinateDomain =
+ DomainBase superordinateDomain =
ofy().load().key(host.getSuperordinateDomain()).now().cloneProjectedAtTime(now);
hostInfoDataBuilder
.setCurrentSponsorClientId(superordinateDomain.getCurrentSponsorClientId())
diff --git a/java/google/registry/flows/host/HostUpdateFlow.java b/java/google/registry/flows/host/HostUpdateFlow.java
index 82c96ea6f..72a4493ec 100644
--- a/java/google/registry/flows/host/HostUpdateFlow.java
+++ b/java/google/registry/flows/host/HostUpdateFlow.java
@@ -47,7 +47,7 @@ import google.registry.flows.annotations.ReportingSpec;
import google.registry.flows.exceptions.ResourceHasClientUpdateProhibitedException;
import google.registry.model.EppResource;
import google.registry.model.ImmutableObject;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.eppinput.ResourceCommand;
@@ -135,11 +135,11 @@ public final class HostUpdateFlow implements TransactionalFlow {
boolean isHostRename = suppliedNewHostName != null;
String oldHostName = targetId;
String newHostName = firstNonNull(suppliedNewHostName, oldHostName);
- DomainResource oldSuperordinateDomain = existingHost.isSubordinate()
+ DomainBase oldSuperordinateDomain = existingHost.isSubordinate()
? ofy().load().key(existingHost.getSuperordinateDomain()).now().cloneProjectedAtTime(now)
: null;
// Note that lookupSuperordinateDomain calls cloneProjectedAtTime on the domain for us.
- Optional newSuperordinateDomain =
+ Optional newSuperordinateDomain =
lookupSuperordinateDomain(validateHostName(newHostName), now);
verifySuperordinateDomainNotInPendingDelete(newSuperordinateDomain.orElse(null));
EppResource owningResource = firstNonNull(oldSuperordinateDomain, existingHost);
@@ -152,7 +152,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
AddRemove remove = command.getInnerRemove();
checkSameValuesNotAddedAndRemoved(add.getStatusValues(), remove.getStatusValues());
checkSameValuesNotAddedAndRemoved(add.getInetAddresses(), remove.getInetAddresses());
- Key newSuperordinateDomainKey =
+ Key newSuperordinateDomainKey =
newSuperordinateDomain.map(Key::create).orElse(null);
// If the superordinateDomain field is changing, set the lastSuperordinateChange to now.
DateTime lastSuperordinateChange =
@@ -209,7 +209,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
private void verifyUpdateAllowed(
Update command,
HostResource existingHost,
- DomainResource newSuperordinateDomain,
+ DomainBase newSuperordinateDomain,
EppResource owningResource,
boolean isHostRename)
throws EppException {
diff --git a/java/google/registry/mapreduce/inputs/EppResourceBaseReader.java b/java/google/registry/mapreduce/inputs/EppResourceBaseReader.java
index ab4a7e35a..768142c42 100644
--- a/java/google/registry/mapreduce/inputs/EppResourceBaseReader.java
+++ b/java/google/registry/mapreduce/inputs/EppResourceBaseReader.java
@@ -40,7 +40,7 @@ abstract class EppResourceBaseReader extends RetryingInputReaderThis can be empty, or any of {"ContactResource", "HostResource", "DomainBase"}. It will
- * never contain "EppResource" or "DomainResource" since these aren't actual kinds in Datastore.
+ * never contain "EppResource" since this isn't an actual kind in Datastore.
*/
private final ImmutableSet filterKinds;
diff --git a/java/google/registry/mapreduce/inputs/EppResourceEntityReader.java b/java/google/registry/mapreduce/inputs/EppResourceEntityReader.java
index dda110c50..6e9639fad 100644
--- a/java/google/registry/mapreduce/inputs/EppResourceEntityReader.java
+++ b/java/google/registry/mapreduce/inputs/EppResourceEntityReader.java
@@ -67,7 +67,7 @@ class EppResourceEntityReader extends EppResourceBaseRead
logger.atSevere().log("EppResourceIndex key %s points at a missing resource", key);
continue;
}
- // Postfilter to distinguish polymorphic types (e.g. DomainBase and DomainResource).
+ // Postfilter to distinguish polymorphic types (e.g. EppResources).
for (Class extends R> resourceClass : resourceClasses) {
if (resourceClass.isAssignableFrom(resource.getClass())) {
@SuppressWarnings("unchecked")
diff --git a/java/google/registry/mapreduce/inputs/EppResourceInputs.java b/java/google/registry/mapreduce/inputs/EppResourceInputs.java
index 6d7ca772e..37ec23713 100644
--- a/java/google/registry/mapreduce/inputs/EppResourceInputs.java
+++ b/java/google/registry/mapreduce/inputs/EppResourceInputs.java
@@ -16,12 +16,10 @@ package google.registry.mapreduce.inputs;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Lists.asList;
-import static google.registry.util.TypeUtils.hasAnnotation;
import com.google.appengine.tools.mapreduce.Input;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
-import com.googlecode.objectify.annotation.EntitySubclass;
import google.registry.model.EppResource;
import google.registry.model.ImmutableObject;
import google.registry.model.index.EppResourceIndex;
@@ -84,13 +82,8 @@ public final class EppResourceInputs {
*/
@SafeVarargs
public static Input> createKeyInput(
- Class extends R> resourceClass,
- Class extends R>... moreResourceClasses) {
- ImmutableSet> resourceClasses =
- ImmutableSet.copyOf(asList(resourceClass, moreResourceClasses));
- checkArgument(
- resourceClasses.stream().noneMatch(hasAnnotation(EntitySubclass.class)),
- "Mapping over keys requires a non-polymorphic Entity");
- return new EppResourceKeyInput<>(resourceClasses);
+ Class extends R> resourceClass, Class extends R>... moreResourceClasses) {
+ return new EppResourceKeyInput<>(
+ ImmutableSet.copyOf(asList(resourceClass, moreResourceClasses)));
}
}
diff --git a/java/google/registry/model/EntityClasses.java b/java/google/registry/model/EntityClasses.java
index e617fc856..e8787e5eb 100644
--- a/java/google/registry/model/EntityClasses.java
+++ b/java/google/registry/model/EntityClasses.java
@@ -21,7 +21,6 @@ import google.registry.model.common.EntityGroupRoot;
import google.registry.model.common.GaeUserIdConverter;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DomainBase;
-import google.registry.model.domain.DomainResource;
import google.registry.model.domain.token.AllocationToken;
import google.registry.model.host.HostResource;
import google.registry.model.index.EppResourceIndex;
@@ -73,7 +72,6 @@ public final class EntityClasses {
ContactResource.class,
Cursor.class,
DomainBase.class,
- DomainResource.class,
EntityGroupRoot.class,
EppResourceIndex.class,
EppResourceIndexBucket.class,
diff --git a/java/google/registry/model/ResourceTransferUtils.java b/java/google/registry/model/ResourceTransferUtils.java
index 338fe3129..017e57aa2 100644
--- a/java/google/registry/model/ResourceTransferUtils.java
+++ b/java/google/registry/model/ResourceTransferUtils.java
@@ -17,7 +17,7 @@ package google.registry.model;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
-import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
+import static google.registry.model.domain.DomainBase.extendRegistrationWithCap;
import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.collect.ImmutableList;
@@ -28,7 +28,7 @@ import google.registry.model.EppResource.BuilderWithTransferData;
import google.registry.model.EppResource.ForeignKeyedEppResource;
import google.registry.model.EppResource.ResourceWithTransferData;
import google.registry.model.contact.ContactResource;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.eppcommon.Trid;
import google.registry.model.index.ForeignKeyIndex;
@@ -64,7 +64,7 @@ public final class ResourceTransferUtils {
if (eppResource instanceof ContactResource) {
builder = new ContactTransferResponse.Builder().setContactId(eppResource.getForeignKey());
} else {
- DomainResource domain = (DomainResource) eppResource;
+ DomainBase domain = (DomainBase) eppResource;
builder =
new DomainTransferResponse.Builder()
.setFullyQualifiedDomainName(eppResource.getForeignKey())
@@ -102,7 +102,7 @@ public final class ResourceTransferUtils {
}
private static void assertIsContactOrDomain(EppResource eppResource) {
- checkState(eppResource instanceof ContactResource || eppResource instanceof DomainResource);
+ checkState(eppResource instanceof ContactResource || eppResource instanceof DomainBase);
}
/** Update the relevant {@link ForeignKeyIndex} to cache the new deletion time. */
diff --git a/java/google/registry/model/contact/ContactResource.java b/java/google/registry/model/contact/ContactResource.java
index 12583b8db..9c09f165f 100644
--- a/java/google/registry/model/contact/ContactResource.java
+++ b/java/google/registry/model/contact/ContactResource.java
@@ -193,7 +193,7 @@ public class ContactResource extends EppResource implements
/** A builder for constructing {@link ContactResource}, since it is immutable. */
public static class Builder extends EppResource.Builder
- implements BuilderWithTransferData{
+ implements BuilderWithTransferData {
public Builder() {}
diff --git a/java/google/registry/model/domain/DomainBase.java b/java/google/registry/model/domain/DomainBase.java
index e144ea90a..00921d29d 100644
--- a/java/google/registry/model/domain/DomainBase.java
+++ b/java/google/registry/model/domain/DomainBase.java
@@ -19,13 +19,19 @@ import static com.google.common.base.Strings.emptyToNull;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
import static com.google.common.collect.Sets.difference;
+import static com.google.common.collect.Sets.intersection;
import static com.google.common.collect.Sets.union;
+import static google.registry.model.EppResourceUtils.projectResourceOntoBuilderAtTime;
+import static google.registry.model.EppResourceUtils.setAutomaticTransferSuccessProperties;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.forceEmptyToNull;
import static google.registry.util.CollectionUtils.nullToEmpty;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableSortedCopy;
import static google.registry.util.CollectionUtils.union;
+import static google.registry.util.DateTimeUtils.earliestOf;
+import static google.registry.util.DateTimeUtils.isBeforeOrAt;
+import static google.registry.util.DateTimeUtils.leapSafeAddYears;
import static google.registry.util.DomainNameUtils.canonicalizeDomainName;
import static google.registry.util.DomainNameUtils.getTldFromDomainName;
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
@@ -40,22 +46,58 @@ import com.googlecode.objectify.annotation.IgnoreSave;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.condition.IfNull;
import google.registry.model.EppResource;
+import google.registry.model.EppResource.ForeignKeyedEppResource;
+import google.registry.model.EppResource.ResourceWithTransferData;
+import google.registry.model.annotations.ExternalMessagingName;
import google.registry.model.annotations.ReportedOn;
+import google.registry.model.billing.BillingEvent;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DesignatedContact.Type;
import google.registry.model.domain.launch.LaunchNotice;
+import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.domain.secdns.DelegationSignerData;
+import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource;
+import google.registry.model.poll.PollMessage;
+import google.registry.model.registry.Registry;
+import google.registry.model.transfer.TransferData;
+import google.registry.model.transfer.TransferStatus;
+import google.registry.util.CollectionUtils;
+import java.util.HashSet;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
+import javax.annotation.Nullable;
+import org.joda.time.DateTime;
+import org.joda.time.Interval;
-/** Base class for {@link DomainResource}. */
-// TODO(b/121028829): Squash DomainResource into this.
+/**
+ * A persistable domain resource including mutable and non-mutable fields.
+ *
+ *
For historical reasons, the name of this entity is "DomainBase". Ideally it would be
+ * "DomainResource" for linguistic parallelism with the other {@link EppResource} entity classes,
+ * but that would necessitate a complex data migration which isn't worth it.
+ *
+ * @see RFC 5731
+ */
@ReportedOn
@Entity
-public abstract class DomainBase extends EppResource {
+@ExternalMessagingName("domain")
+public class DomainBase extends EppResource
+ implements ForeignKeyedEppResource, ResourceWithTransferData {
+ /** The max number of years that a domain can be registered for, as set by ICANN policy. */
+ public static final int MAX_REGISTRATION_YEARS = 10;
+
+ /** Status values which prohibit DNS information from being published. */
+ private static final ImmutableSet DNS_PUBLISHING_PROHIBITED_STATUSES =
+ ImmutableSet.of(
+ StatusValue.CLIENT_HOLD,
+ StatusValue.INACTIVE,
+ StatusValue.PENDING_DELETE,
+ StatusValue.SERVER_HOLD);
+
/**
* Fully qualified domain name (puny-coded), which serves as the foreign key for this domain.
*
@@ -109,6 +151,105 @@ public abstract class DomainBase extends EppResource {
@IgnoreSave(IfNull.class)
String idnTableName;
+ /** Fully qualified host names of this domain's active subordinate hosts. */
+ Set subordinateHosts;
+
+ /** When this domain's registration will expire. */
+ DateTime registrationExpirationTime;
+
+ /**
+ * The poll message associated with this domain being deleted.
+ *
+ *
This field should be null if the domain is not in pending delete. If it is, the field should
+ * refer to a {@link PollMessage} timed to when the domain is fully deleted. If the domain is
+ * restored, the message should be deleted.
+ */
+ Key deletePollMessage;
+
+ /**
+ * The recurring billing event associated with this domain's autorenewals.
+ *
+ *
The recurrence should be open ended unless the domain is in pending delete or fully deleted,
+ * in which case it should be closed at the time the delete was requested. Whenever the domain's
+ * {@link #registrationExpirationTime} is changed the recurrence should be closed, a new one
+ * should be created, and this field should be updated to point to the new one.
+ */
+ Key autorenewBillingEvent;
+
+ /**
+ * The recurring poll message associated with this domain's autorenewals.
+ *
+ *
The recurrence should be open ended unless the domain is in pending delete or fully deleted,
+ * in which case it should be closed at the time the delete was requested. Whenever the domain's
+ * {@link #registrationExpirationTime} is changed the recurrence should be closed, a new one
+ * should be created, and this field should be updated to point to the new one.
+ */
+ Key autorenewPollMessage;
+
+ /** The unexpired grace periods for this domain (some of which may not be active yet). */
+ Set gracePeriods;
+
+ /**
+ * The id of the signed mark that was used to create this domain in sunrise.
+ *
+ *
Will only be populated for domains created in sunrise.
+ */
+ @IgnoreSave(IfNull.class)
+ String smdId;
+
+ /** Data about any pending or past transfers on this domain. */
+ TransferData transferData;
+
+ /**
+ * The time that this resource was last transferred.
+ *
+ *
Can be null if the resource has never been transferred.
+ */
+ DateTime lastTransferTime;
+
+ public ImmutableSet getSubordinateHosts() {
+ return nullToEmptyImmutableCopy(subordinateHosts);
+ }
+
+ public DateTime getRegistrationExpirationTime() {
+ return registrationExpirationTime;
+ }
+
+ public Key getDeletePollMessage() {
+ return deletePollMessage;
+ }
+
+ public Key getAutorenewBillingEvent() {
+ return autorenewBillingEvent;
+ }
+
+ public Key getAutorenewPollMessage() {
+ return autorenewPollMessage;
+ }
+
+ public ImmutableSet getGracePeriods() {
+ return nullToEmptyImmutableCopy(gracePeriods);
+ }
+
+ public String getSmdId() {
+ return smdId;
+ }
+
+ @Override
+ public final TransferData getTransferData() {
+ return Optional.ofNullable(transferData).orElse(TransferData.EMPTY);
+ }
+
+ @Override
+ public DateTime getLastTransferTime() {
+ return lastTransferTime;
+ }
+
+ @Override
+ public String getForeignKey() {
+ return fullyQualifiedDomainName;
+ }
+
public String getFullyQualifiedDomainName() {
return fullyQualifiedDomainName;
}
@@ -133,6 +274,174 @@ public abstract class DomainBase extends EppResource {
return getPersistedCurrentSponsorClientId();
}
+ /** Returns true if DNS information should be published for the given domain. */
+ public boolean shouldPublishToDns() {
+ return intersection(getStatusValues(), DNS_PUBLISHING_PROHIBITED_STATUSES).isEmpty();
+ }
+
+ /**
+ * Returns the Registry Grace Period Statuses for this domain.
+ *
+ *
This collects all statuses from the domain's {@link GracePeriod} entries and also adds the
+ * PENDING_DELETE status if needed.
+ */
+ public ImmutableSet getGracePeriodStatuses() {
+ Set gracePeriodStatuses = new HashSet<>();
+ for (GracePeriod gracePeriod : getGracePeriods()) {
+ gracePeriodStatuses.add(gracePeriod.getType());
+ }
+ if (getStatusValues().contains(StatusValue.PENDING_DELETE)
+ && !gracePeriodStatuses.contains(GracePeriodStatus.REDEMPTION)) {
+ gracePeriodStatuses.add(GracePeriodStatus.PENDING_DELETE);
+ }
+ return ImmutableSet.copyOf(gracePeriodStatuses);
+ }
+
+ /** Returns the subset of grace periods having the specified type. */
+ public ImmutableSet getGracePeriodsOfType(GracePeriodStatus gracePeriodType) {
+ ImmutableSet.Builder builder = new ImmutableSet.Builder<>();
+ for (GracePeriod gracePeriod : getGracePeriods()) {
+ if (gracePeriod.getType() == gracePeriodType) {
+ builder.add(gracePeriod);
+ }
+ }
+ return builder.build();
+ }
+
+ /**
+ * The logic in this method, which handles implicit server approval of transfers, very closely
+ * parallels the logic in {@code DomainTransferApproveFlow} which handles explicit client
+ * approvals.
+ */
+ @Override
+ public DomainBase cloneProjectedAtTime(final DateTime now) {
+
+ TransferData transferData = getTransferData();
+ DateTime transferExpirationTime = transferData.getPendingTransferExpirationTime();
+
+ // If there's a pending transfer that has expired, handle it.
+ if (TransferStatus.PENDING.equals(transferData.getTransferStatus())
+ && isBeforeOrAt(transferExpirationTime, now)) {
+ // Project until just before the transfer time. This will handle the case of an autorenew
+ // before the transfer was even requested or during the request period.
+ // If the transfer time is precisely the moment that the domain expires, there will not be an
+ // autorenew billing event (since we end the recurrence at transfer time and recurrences are
+ // exclusive of their ending), and we can just proceed with the transfer.
+ DomainBase domainAtTransferTime =
+ cloneProjectedAtTime(transferExpirationTime.minusMillis(1));
+ // If we are within an autorenew grace period, the transfer will subsume the autorenew. There
+ // will already be a cancellation written in advance by the transfer request flow, so we don't
+ // need to worry about billing, but we do need to cancel out the expiration time increase.
+ // The transfer period saved in the transfer data will be one year, unless the superuser
+ // extension set the transfer period to zero.
+ int extraYears = transferData.getTransferPeriod().getValue();
+ if (domainAtTransferTime.getGracePeriodStatuses().contains(GracePeriodStatus.AUTO_RENEW)) {
+ extraYears = 0;
+ }
+ // Set the expiration, autorenew events, and grace period for the transfer. (Transfer ends
+ // all other graces).
+ Builder builder = domainAtTransferTime.asBuilder()
+ // Extend the registration by the correct number of years from the expiration time that
+ // was current on the domain right before the transfer, capped at 10 years from the
+ // moment of the transfer.
+ .setRegistrationExpirationTime(extendRegistrationWithCap(
+ transferExpirationTime,
+ domainAtTransferTime.getRegistrationExpirationTime(),
+ extraYears))
+ // Set the speculatively-written new autorenew events as the domain's autorenew events.
+ .setAutorenewBillingEvent(transferData.getServerApproveAutorenewEvent())
+ .setAutorenewPollMessage(transferData.getServerApproveAutorenewPollMessage());
+ if (transferData.getTransferPeriod().getValue() == 1) {
+ // Set the grace period using a key to the prescheduled transfer billing event. Not using
+ // GracePeriod.forBillingEvent() here in order to avoid the actual Datastore fetch.
+ builder.setGracePeriods(
+ ImmutableSet.of(
+ GracePeriod.create(
+ GracePeriodStatus.TRANSFER,
+ transferExpirationTime.plus(
+ Registry.get(getTld()).getTransferGracePeriodLength()),
+ transferData.getGainingClientId(),
+ transferData.getServerApproveBillingEvent())));
+ } else {
+ // There won't be a billing event, so we don't need a grace period
+ builder.setGracePeriods(ImmutableSet.of());
+ }
+ // Set all remaining transfer properties.
+ setAutomaticTransferSuccessProperties(builder, transferData);
+ builder
+ .setLastEppUpdateTime(transferExpirationTime)
+ .setLastEppUpdateClientId(transferData.getGainingClientId());
+ // Finish projecting to now.
+ return builder.build().cloneProjectedAtTime(now);
+ }
+
+ Optional newLastEppUpdateTime = Optional.empty();
+
+ // There is no transfer. Do any necessary autorenews.
+
+ Builder builder = asBuilder();
+ if (isBeforeOrAt(registrationExpirationTime, now)) {
+ // Autorenew by the number of years between the old expiration time and now.
+ DateTime lastAutorenewTime = leapSafeAddYears(
+ registrationExpirationTime,
+ new Interval(registrationExpirationTime, now).toPeriod().getYears());
+ DateTime newExpirationTime = lastAutorenewTime.plusYears(1);
+ builder
+ .setRegistrationExpirationTime(newExpirationTime)
+ .addGracePeriod(
+ GracePeriod.createForRecurring(
+ GracePeriodStatus.AUTO_RENEW,
+ lastAutorenewTime.plus(Registry.get(getTld()).getAutoRenewGracePeriodLength()),
+ getCurrentSponsorClientId(),
+ autorenewBillingEvent));
+ newLastEppUpdateTime = Optional.of(lastAutorenewTime);
+ }
+
+ // Remove any grace periods that have expired.
+ DomainBase almostBuilt = builder.build();
+ builder = almostBuilt.asBuilder();
+ for (GracePeriod gracePeriod : almostBuilt.getGracePeriods()) {
+ if (isBeforeOrAt(gracePeriod.getExpirationTime(), now)) {
+ builder.removeGracePeriod(gracePeriod);
+ if (!newLastEppUpdateTime.isPresent()
+ || isBeforeOrAt(newLastEppUpdateTime.get(), gracePeriod.getExpirationTime())) {
+ newLastEppUpdateTime = Optional.of(gracePeriod.getExpirationTime());
+ }
+ }
+ }
+
+ // It is possible that the lastEppUpdateClientId is different from current sponsor client
+ // id, so we have to do the comparison instead of having one variable just storing the most
+ // recent time.
+ if (newLastEppUpdateTime.isPresent()) {
+ if (getLastEppUpdateTime() == null
+ || newLastEppUpdateTime.get().isAfter(getLastEppUpdateTime())) {
+ builder
+ .setLastEppUpdateTime(newLastEppUpdateTime.get())
+ .setLastEppUpdateClientId(getCurrentSponsorClientId());
+ }
+ }
+
+ // Handle common properties like setting or unsetting linked status. This also handles the
+ // general case of pending transfers for other resource types, but since we've always handled
+ // a pending transfer by this point that's a no-op for domains.
+ projectResourceOntoBuilderAtTime(almostBuilt, builder, now);
+ return builder.build();
+ }
+
+ /** Return what the expiration time would be if the given number of years were added to it. */
+ public static DateTime extendRegistrationWithCap(
+ DateTime now,
+ DateTime currentExpirationTime,
+ @Nullable Integer extendedRegistrationYears) {
+ // We must cap registration at the max years (aka 10), even if that truncates the last year.
+ return earliestOf(
+ leapSafeAddYears(
+ currentExpirationTime,
+ Optional.ofNullable(extendedRegistrationYears).orElse(0)),
+ leapSafeAddYears(now, MAX_REGISTRATION_YEARS));
+ }
+
/** Loads and returns the fully qualified host names of all linked nameservers. */
public ImmutableSortedSet loadNameserverFullyQualifiedHostNames() {
return ofy()
@@ -185,21 +494,34 @@ public abstract class DomainBase extends EppResource {
/** An override of {@link EppResource#asBuilder} with tighter typing. */
@Override
- public abstract Builder, ?> asBuilder();
+ public Builder asBuilder() {
+ return new Builder(clone(this));
+ }
/** A builder for constructing {@link DomainBase}, since it is immutable. */
- public abstract static class Builder>
- extends EppResource.Builder {
+ public static class Builder extends EppResource.Builder
+ implements BuilderWithTransferData {
- protected Builder() {}
+ public Builder() {}
- protected Builder(T instance) {
+ Builder(DomainBase instance) {
super(instance);
}
@Override
- public T build() {
- T instance = getInstance();
+ public DomainBase build() {
+ DomainBase instance = getInstance();
+ // If TransferData is totally empty, set it to null.
+ if (TransferData.EMPTY.equals(getInstance().transferData)) {
+ setTransferData(null);
+ }
+ // A DomainBase has status INACTIVE if there are no nameservers.
+ if (getInstance().getNameservers().isEmpty()) {
+ addStatusValue(StatusValue.INACTIVE);
+ } else { // There are nameservers, so make sure INACTIVE isn't there.
+ removeStatusValue(StatusValue.INACTIVE);
+ }
+
checkArgumentNotNull(
emptyToNull(instance.fullyQualifiedDomainName), "Missing fullyQualifiedDomainName");
checkArgument(instance.allContacts.stream().anyMatch(IS_REGISTRANT), "Missing registrant");
@@ -207,7 +529,7 @@ public abstract class DomainBase extends EppResource {
return super.build();
}
- public B setFullyQualifiedDomainName(String fullyQualifiedDomainName) {
+ public Builder setFullyQualifiedDomainName(String fullyQualifiedDomainName) {
checkArgument(
fullyQualifiedDomainName.equals(canonicalizeDomainName(fullyQualifiedDomainName)),
"Domain name must be in puny-coded, lower-case form");
@@ -215,12 +537,12 @@ public abstract class DomainBase extends EppResource {
return thisCastToDerived();
}
- public B setDsData(ImmutableSet dsData) {
+ public Builder setDsData(ImmutableSet dsData) {
getInstance().dsData = dsData;
return thisCastToDerived();
}
- public B setRegistrant(Key registrant) {
+ public Builder setRegistrant(Key registrant) {
// Replace the registrant contact inside allContacts.
getInstance().allContacts = union(
getInstance().getContacts(),
@@ -228,44 +550,44 @@ public abstract class DomainBase extends EppResource {
return thisCastToDerived();
}
- public B setAuthInfo(DomainAuthInfo authInfo) {
+ public Builder setAuthInfo(DomainAuthInfo authInfo) {
getInstance().authInfo = authInfo;
return thisCastToDerived();
}
- public B setNameservers(Key nameserver) {
+ public Builder setNameservers(Key nameserver) {
getInstance().nsHosts = ImmutableSet.of(nameserver);
return thisCastToDerived();
}
- public B setNameservers(ImmutableSet> nameservers) {
+ public Builder setNameservers(ImmutableSet> nameservers) {
getInstance().nsHosts = forceEmptyToNull(nameservers);
return thisCastToDerived();
}
- public B addNameserver(Key nameserver) {
+ public Builder addNameserver(Key nameserver) {
return addNameservers(ImmutableSet.of(nameserver));
}
- public B addNameservers(ImmutableSet> nameservers) {
+ public Builder addNameservers(ImmutableSet> nameservers) {
return setNameservers(
ImmutableSet.copyOf(union(getInstance().getNameservers(), nameservers)));
}
- public B removeNameserver(Key nameserver) {
+ public Builder removeNameserver(Key nameserver) {
return removeNameservers(ImmutableSet.of(nameserver));
}
- public B removeNameservers(ImmutableSet> nameservers) {
+ public Builder removeNameservers(ImmutableSet> nameservers) {
return setNameservers(
ImmutableSet.copyOf(difference(getInstance().getNameservers(), nameservers)));
}
- public B setContacts(DesignatedContact contact) {
+ public Builder setContacts(DesignatedContact contact) {
return setContacts(ImmutableSet.of(contact));
}
- public B setContacts(ImmutableSet contacts) {
+ public Builder setContacts(ImmutableSet contacts) {
checkArgument(contacts.stream().noneMatch(IS_REGISTRANT), "Registrant cannot be a contact");
// Replace the non-registrant contacts inside allContacts.
getInstance().allContacts =
@@ -276,22 +598,92 @@ public abstract class DomainBase extends EppResource {
return thisCastToDerived();
}
- public B addContacts(ImmutableSet contacts) {
+ public Builder addContacts(ImmutableSet contacts) {
return setContacts(ImmutableSet.copyOf(union(getInstance().getContacts(), contacts)));
}
- public B removeContacts(ImmutableSet contacts) {
+ public Builder removeContacts(ImmutableSet contacts) {
return setContacts(ImmutableSet.copyOf(difference(getInstance().getContacts(), contacts)));
}
- public B setLaunchNotice(LaunchNotice launchNotice) {
+ public Builder setLaunchNotice(LaunchNotice launchNotice) {
getInstance().launchNotice = launchNotice;
return thisCastToDerived();
}
- public B setIdnTableName(String idnTableName) {
+ public Builder setIdnTableName(String idnTableName) {
getInstance().idnTableName = idnTableName;
return thisCastToDerived();
}
+
+ public Builder setSubordinateHosts(ImmutableSet subordinateHosts) {
+ getInstance().subordinateHosts = subordinateHosts;
+ return thisCastToDerived();
+ }
+
+ public Builder addSubordinateHost(String hostToAdd) {
+ return setSubordinateHosts(ImmutableSet.copyOf(
+ union(getInstance().getSubordinateHosts(), hostToAdd)));
+ }
+
+ public Builder removeSubordinateHost(String hostToRemove) {
+ return setSubordinateHosts(ImmutableSet.copyOf(
+ CollectionUtils.difference(getInstance().getSubordinateHosts(), hostToRemove)));
+ }
+
+ public Builder setRegistrationExpirationTime(DateTime registrationExpirationTime) {
+ getInstance().registrationExpirationTime = registrationExpirationTime;
+ return this;
+ }
+
+ public Builder setDeletePollMessage(Key deletePollMessage) {
+ getInstance().deletePollMessage = deletePollMessage;
+ return this;
+ }
+
+ public Builder setAutorenewBillingEvent(
+ Key autorenewBillingEvent) {
+ getInstance().autorenewBillingEvent = autorenewBillingEvent;
+ return this;
+ }
+
+ public Builder setAutorenewPollMessage(
+ Key autorenewPollMessage) {
+ getInstance().autorenewPollMessage = autorenewPollMessage;
+ return this;
+ }
+
+ public Builder setSmdId(String smdId) {
+ getInstance().smdId = smdId;
+ return this;
+ }
+
+ public Builder setGracePeriods(ImmutableSet gracePeriods) {
+ getInstance().gracePeriods = gracePeriods;
+ return this;
+ }
+
+ public Builder addGracePeriod(GracePeriod gracePeriod) {
+ getInstance().gracePeriods = union(getInstance().getGracePeriods(), gracePeriod);
+ return this;
+ }
+
+ public Builder removeGracePeriod(GracePeriod gracePeriod) {
+ getInstance().gracePeriods = CollectionUtils
+ .difference(getInstance().getGracePeriods(), gracePeriod);
+ return this;
+ }
+
+ @Override
+ public Builder setTransferData(TransferData transferData) {
+ getInstance().transferData = transferData;
+ return thisCastToDerived();
+ }
+
+ @Override
+ public Builder setLastTransferTime(DateTime lastTransferTime) {
+ getInstance().lastTransferTime = lastTransferTime;
+ return thisCastToDerived();
+ }
}
}
diff --git a/java/google/registry/model/domain/DomainCommand.java b/java/google/registry/model/domain/DomainCommand.java
index 47632377d..dd9764196 100644
--- a/java/google/registry/model/domain/DomainCommand.java
+++ b/java/google/registry/model/domain/DomainCommand.java
@@ -54,7 +54,7 @@ import javax.xml.bind.annotation.XmlValue;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
-/** A collection of {@link DomainResource} commands. */
+/** A collection of {@link DomainBase} commands. */
public class DomainCommand {
/** The default validity period (if not specified) is 1 year for all operations. */
@@ -72,7 +72,7 @@ public class DomainCommand {
/** The fields on "chgType" from {@link "http://tools.ietf.org/html/rfc5731"}. */
@XmlTransient
- public static class DomainCreateOrChange>
+ public static class DomainCreateOrChange
extends ImmutableObject implements ResourceCreateOrChange {
/** The contactId of the registrant who registered this domain. */
@@ -112,7 +112,7 @@ public class DomainCommand {
"foreignKeyedDesignatedContacts",
"authInfo"})
public static class Create
- extends DomainCreateOrChange>
+ extends DomainCreateOrChange
implements CreateOrUpdate {
/** Fully qualified domain name, which serves as a unique identifier for this domain. */
@@ -259,11 +259,11 @@ public class DomainCommand {
}
}
- /** A check request for {@link DomainResource}. */
+ /** A check request for {@link DomainBase}. */
@XmlRootElement
public static class Check extends ResourceCheck {}
- /** A renew command for a {@link DomainResource}. */
+ /** A renew command for a {@link DomainBase}. */
@XmlRootElement
public static class Renew extends AbstractSingleResourceCommand {
@XmlElement(name = "curExpDate")
@@ -281,7 +281,7 @@ public class DomainCommand {
}
}
- /** A transfer operation for a {@link DomainResource}. */
+ /** A transfer operation for a {@link DomainBase}. */
@XmlRootElement
public static class Transfer extends AbstractSingleResourceCommand {
/** The period to extend this domain's registration upon completion of the transfer. */
@@ -304,7 +304,7 @@ public class DomainCommand {
@XmlRootElement
@XmlType(propOrder = {"targetId", "innerAdd", "innerRemove", "innerChange"})
public static class Update
- extends ResourceUpdate, Update.Change>
+ extends ResourceUpdate
implements CreateOrUpdate {
@XmlElement(name = "chg")
@@ -384,7 +384,7 @@ public class DomainCommand {
/** The inner change type on a domain update command. */
@XmlType(propOrder = {"registrantContactId", "authInfo"})
- public static class Change extends DomainCreateOrChange> {
+ public static class Change extends DomainCreateOrChange {
/** Creates a copy of this {@link Change} with hard links to hosts and contacts. */
Change cloneAndLinkReferences(DateTime now) throws InvalidReferencesException {
Change clone = clone(this);
diff --git a/java/google/registry/model/domain/DomainResource.java b/java/google/registry/model/domain/DomainResource.java
deleted file mode 100644
index 054ff70e9..000000000
--- a/java/google/registry/model/domain/DomainResource.java
+++ /dev/null
@@ -1,436 +0,0 @@
-// Copyright 2017 The Nomulus Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
- package google.registry.model.domain;
-
-import static com.google.common.collect.Sets.intersection;
-import static google.registry.model.EppResourceUtils.projectResourceOntoBuilderAtTime;
-import static google.registry.model.EppResourceUtils.setAutomaticTransferSuccessProperties;
-import static google.registry.util.CollectionUtils.difference;
-import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
-import static google.registry.util.CollectionUtils.union;
-import static google.registry.util.DateTimeUtils.earliestOf;
-import static google.registry.util.DateTimeUtils.isBeforeOrAt;
-import static google.registry.util.DateTimeUtils.leapSafeAddYears;
-
-import com.google.common.collect.ImmutableSet;
-import com.googlecode.objectify.Key;
-import com.googlecode.objectify.annotation.EntitySubclass;
-import com.googlecode.objectify.annotation.IgnoreSave;
-import com.googlecode.objectify.condition.IfNull;
-import google.registry.model.EppResource.ForeignKeyedEppResource;
-import google.registry.model.EppResource.ResourceWithTransferData;
-import google.registry.model.annotations.ExternalMessagingName;
-import google.registry.model.billing.BillingEvent;
-import google.registry.model.domain.rgp.GracePeriodStatus;
-import google.registry.model.eppcommon.StatusValue;
-import google.registry.model.poll.PollMessage;
-import google.registry.model.registry.Registry;
-import google.registry.model.transfer.TransferData;
-import google.registry.model.transfer.TransferStatus;
-import java.util.HashSet;
-import java.util.Optional;
-import java.util.Set;
-import javax.annotation.Nullable;
-import org.joda.time.DateTime;
-import org.joda.time.Interval;
-
-/**
- * A persistable domain resource including mutable and non-mutable fields.
- *
- * @see RFC 5731
- */
-@EntitySubclass(index = true)
-@ExternalMessagingName("domain")
-public class DomainResource extends DomainBase
- implements ForeignKeyedEppResource, ResourceWithTransferData {
-
- /** The max number of years that a domain can be registered for, as set by ICANN policy. */
- public static final int MAX_REGISTRATION_YEARS = 10;
-
- /** Status values which prohibit DNS information from being published. */
- private static final ImmutableSet DNS_PUBLISHING_PROHIBITED_STATUSES =
- ImmutableSet.of(
- StatusValue.CLIENT_HOLD,
- StatusValue.INACTIVE,
- StatusValue.PENDING_DELETE,
- StatusValue.SERVER_HOLD);
-
- /** Fully qualified host names of this domain's active subordinate hosts. */
- Set subordinateHosts;
-
- /** When this domain's registration will expire. */
- DateTime registrationExpirationTime;
-
- /**
- * The poll message associated with this domain being deleted.
- *
- *
This field should be null if the domain is not in pending delete. If it is, the field should
- * refer to a {@link PollMessage} timed to when the domain is fully deleted. If the domain is
- * restored, the message should be deleted.
- */
- Key deletePollMessage;
-
- /**
- * The recurring billing event associated with this domain's autorenewals.
- *
- *
The recurrence should be open ended unless the domain is in pending delete or fully deleted,
- * in which case it should be closed at the time the delete was requested. Whenever the domain's
- * {@link #registrationExpirationTime} is changed the recurrence should be closed, a new one
- * should be created, and this field should be updated to point to the new one.
- */
- Key autorenewBillingEvent;
-
- /**
- * The recurring poll message associated with this domain's autorenewals.
- *
- *
The recurrence should be open ended unless the domain is in pending delete or fully deleted,
- * in which case it should be closed at the time the delete was requested. Whenever the domain's
- * {@link #registrationExpirationTime} is changed the recurrence should be closed, a new one
- * should be created, and this field should be updated to point to the new one.
- */
- Key autorenewPollMessage;
-
- /** The unexpired grace periods for this domain (some of which may not be active yet). */
- Set gracePeriods;
-
- /**
- * The id of the signed mark that was used to create this domain in sunrise.
- *
- *
Will only be populated for domains created in sunrise.
- */
- @IgnoreSave(IfNull.class)
- String smdId;
-
- /** Data about any pending or past transfers on this domain. */
- TransferData transferData;
-
- /**
- * The time that this resource was last transferred.
- *
- *
Can be null if the resource has never been transferred.
- */
- DateTime lastTransferTime;
-
- public ImmutableSet getSubordinateHosts() {
- return nullToEmptyImmutableCopy(subordinateHosts);
- }
-
- public DateTime getRegistrationExpirationTime() {
- return registrationExpirationTime;
- }
-
- public Key getDeletePollMessage() {
- return deletePollMessage;
- }
-
- public Key getAutorenewBillingEvent() {
- return autorenewBillingEvent;
- }
-
- public Key getAutorenewPollMessage() {
- return autorenewPollMessage;
- }
-
- public ImmutableSet getGracePeriods() {
- return nullToEmptyImmutableCopy(gracePeriods);
- }
-
- public String getSmdId() {
- return smdId;
- }
-
- @Override
- public final TransferData getTransferData() {
- return Optional.ofNullable(transferData).orElse(TransferData.EMPTY);
- }
-
- @Override
- public DateTime getLastTransferTime() {
- return lastTransferTime;
- }
-
- @Override
- public String getForeignKey() {
- return fullyQualifiedDomainName;
- }
-
- /** Returns true if DNS information should be published for the given domain. */
- public boolean shouldPublishToDns() {
- return intersection(getStatusValues(), DNS_PUBLISHING_PROHIBITED_STATUSES).isEmpty();
- }
-
- /**
- * Returns the Registry Grace Period Statuses for this domain.
- *
- *
This collects all statuses from the domain's {@link GracePeriod} entries and also adds the
- * PENDING_DELETE status if needed.
- */
- public ImmutableSet getGracePeriodStatuses() {
- Set gracePeriodStatuses = new HashSet<>();
- for (GracePeriod gracePeriod : getGracePeriods()) {
- gracePeriodStatuses.add(gracePeriod.getType());
- }
- if (getStatusValues().contains(StatusValue.PENDING_DELETE)
- && !gracePeriodStatuses.contains(GracePeriodStatus.REDEMPTION)) {
- gracePeriodStatuses.add(GracePeriodStatus.PENDING_DELETE);
- }
- return ImmutableSet.copyOf(gracePeriodStatuses);
- }
-
- /** Returns the subset of grace periods having the specified type. */
- public ImmutableSet getGracePeriodsOfType(GracePeriodStatus gracePeriodType) {
- ImmutableSet.Builder builder = new ImmutableSet.Builder<>();
- for (GracePeriod gracePeriod : getGracePeriods()) {
- if (gracePeriod.getType() == gracePeriodType) {
- builder.add(gracePeriod);
- }
- }
- return builder.build();
- }
-
- /**
- * The logic in this method, which handles implicit server approval of transfers, very closely
- * parallels the logic in {@code DomainTransferApproveFlow} which handles explicit client
- * approvals.
- */
- @Override
- public DomainResource cloneProjectedAtTime(final DateTime now) {
-
- TransferData transferData = getTransferData();
- DateTime transferExpirationTime = transferData.getPendingTransferExpirationTime();
-
- // If there's a pending transfer that has expired, handle it.
- if (TransferStatus.PENDING.equals(transferData.getTransferStatus())
- && isBeforeOrAt(transferExpirationTime, now)) {
- // Project until just before the transfer time. This will handle the case of an autorenew
- // before the transfer was even requested or during the request period.
- // If the transfer time is precisely the moment that the domain expires, there will not be an
- // autorenew billing event (since we end the recurrence at transfer time and recurrences are
- // exclusive of their ending), and we can just proceed with the transfer.
- DomainResource domainAtTransferTime =
- cloneProjectedAtTime(transferExpirationTime.minusMillis(1));
- // If we are within an autorenew grace period, the transfer will subsume the autorenew. There
- // will already be a cancellation written in advance by the transfer request flow, so we don't
- // need to worry about billing, but we do need to cancel out the expiration time increase.
- // The transfer period saved in the transfer data will be one year, unless the superuser
- // extension set the transfer period to zero.
- int extraYears = transferData.getTransferPeriod().getValue();
- if (domainAtTransferTime.getGracePeriodStatuses().contains(GracePeriodStatus.AUTO_RENEW)) {
- extraYears = 0;
- }
- // Set the expiration, autorenew events, and grace period for the transfer. (Transfer ends
- // all other graces).
- Builder builder = domainAtTransferTime.asBuilder()
- // Extend the registration by the correct number of years from the expiration time that
- // was current on the domain right before the transfer, capped at 10 years from the
- // moment of the transfer.
- .setRegistrationExpirationTime(extendRegistrationWithCap(
- transferExpirationTime,
- domainAtTransferTime.getRegistrationExpirationTime(),
- extraYears))
- // Set the speculatively-written new autorenew events as the domain's autorenew events.
- .setAutorenewBillingEvent(transferData.getServerApproveAutorenewEvent())
- .setAutorenewPollMessage(transferData.getServerApproveAutorenewPollMessage());
- if (transferData.getTransferPeriod().getValue() == 1) {
- // Set the grace period using a key to the prescheduled transfer billing event. Not using
- // GracePeriod.forBillingEvent() here in order to avoid the actual Datastore fetch.
- builder.setGracePeriods(
- ImmutableSet.of(
- GracePeriod.create(
- GracePeriodStatus.TRANSFER,
- transferExpirationTime.plus(
- Registry.get(getTld()).getTransferGracePeriodLength()),
- transferData.getGainingClientId(),
- transferData.getServerApproveBillingEvent())));
- } else {
- // There won't be a billing event, so we don't need a grace period
- builder.setGracePeriods(ImmutableSet.of());
- }
- // Set all remaining transfer properties.
- setAutomaticTransferSuccessProperties(builder, transferData);
- builder
- .setLastEppUpdateTime(transferExpirationTime)
- .setLastEppUpdateClientId(transferData.getGainingClientId());
- // Finish projecting to now.
- return builder.build().cloneProjectedAtTime(now);
- }
-
- Optional newLastEppUpdateTime = Optional.empty();
-
- // There is no transfer. Do any necessary autorenews.
-
- Builder builder = asBuilder();
- if (isBeforeOrAt(registrationExpirationTime, now)) {
- // Autorenew by the number of years between the old expiration time and now.
- DateTime lastAutorenewTime = leapSafeAddYears(
- registrationExpirationTime,
- new Interval(registrationExpirationTime, now).toPeriod().getYears());
- DateTime newExpirationTime = lastAutorenewTime.plusYears(1);
- builder
- .setRegistrationExpirationTime(newExpirationTime)
- .addGracePeriod(
- GracePeriod.createForRecurring(
- GracePeriodStatus.AUTO_RENEW,
- lastAutorenewTime.plus(Registry.get(getTld()).getAutoRenewGracePeriodLength()),
- getCurrentSponsorClientId(),
- autorenewBillingEvent));
- newLastEppUpdateTime = Optional.of(lastAutorenewTime);
- }
-
- // Remove any grace periods that have expired.
- DomainResource almostBuilt = builder.build();
- builder = almostBuilt.asBuilder();
- for (GracePeriod gracePeriod : almostBuilt.getGracePeriods()) {
- if (isBeforeOrAt(gracePeriod.getExpirationTime(), now)) {
- builder.removeGracePeriod(gracePeriod);
- if (!newLastEppUpdateTime.isPresent()
- || isBeforeOrAt(newLastEppUpdateTime.get(), gracePeriod.getExpirationTime())) {
- newLastEppUpdateTime = Optional.of(gracePeriod.getExpirationTime());
- }
- }
- }
-
- // It is possible that the lastEppUpdateClientId is different from current sponsor client
- // id, so we have to do the comparison instead of having one variable just storing the most
- // recent time.
- if (newLastEppUpdateTime.isPresent()) {
- if (getLastEppUpdateTime() == null
- || newLastEppUpdateTime.get().isAfter(getLastEppUpdateTime())) {
- builder
- .setLastEppUpdateTime(newLastEppUpdateTime.get())
- .setLastEppUpdateClientId(getCurrentSponsorClientId());
- }
- }
-
- // Handle common properties like setting or unsetting linked status. This also handles the
- // general case of pending transfers for other resource types, but since we've always handled
- // a pending transfer by this point that's a no-op for domains.
- projectResourceOntoBuilderAtTime(almostBuilt, builder, now);
- return builder.build();
- }
-
- /** Return what the expiration time would be if the given number of years were added to it. */
- public static DateTime extendRegistrationWithCap(
- DateTime now,
- DateTime currentExpirationTime,
- @Nullable Integer extendedRegistrationYears) {
- // We must cap registration at the max years (aka 10), even if that truncates the last year.
- return earliestOf(
- leapSafeAddYears(
- currentExpirationTime,
- Optional.ofNullable(extendedRegistrationYears).orElse(0)),
- leapSafeAddYears(now, MAX_REGISTRATION_YEARS));
- }
-
- @Override
- public Builder asBuilder() {
- return new Builder(clone(this));
- }
-
- /** A builder for constructing {@link DomainResource}, since it is immutable. */
- public static class Builder extends DomainBase.Builder
- implements BuilderWithTransferData {
-
- public Builder() {}
-
- private Builder(DomainResource instance) {
- super(instance);
- }
-
- @Override
- public DomainResource build() {
- // If TransferData is totally empty, set it to null.
- if (TransferData.EMPTY.equals(getInstance().transferData)) {
- setTransferData(null);
- }
- // A DomainResource has status INACTIVE if there are no nameservers.
- if (getInstance().getNameservers().isEmpty()) {
- addStatusValue(StatusValue.INACTIVE);
- } else { // There are nameservers, so make sure INACTIVE isn't there.
- removeStatusValue(StatusValue.INACTIVE);
- }
- // This must be called after we add or remove INACTIVE, since that affects whether we get OK.
- return super.build();
- }
-
- public Builder setSubordinateHosts(ImmutableSet subordinateHosts) {
- getInstance().subordinateHosts = subordinateHosts;
- return thisCastToDerived();
- }
-
- public Builder addSubordinateHost(String hostToAdd) {
- return setSubordinateHosts(ImmutableSet.copyOf(
- union(getInstance().getSubordinateHosts(), hostToAdd)));
- }
-
- public Builder removeSubordinateHost(String hostToRemove) {
- return setSubordinateHosts(ImmutableSet.copyOf(
- difference(getInstance().getSubordinateHosts(), hostToRemove)));
- }
-
- public Builder setRegistrationExpirationTime(DateTime registrationExpirationTime) {
- getInstance().registrationExpirationTime = registrationExpirationTime;
- return this;
- }
-
- public Builder setDeletePollMessage(Key deletePollMessage) {
- getInstance().deletePollMessage = deletePollMessage;
- return this;
- }
-
- public Builder setAutorenewBillingEvent(Key autorenewBillingEvent) {
- getInstance().autorenewBillingEvent = autorenewBillingEvent;
- return this;
- }
-
- public Builder setAutorenewPollMessage(Key autorenewPollMessage) {
- getInstance().autorenewPollMessage = autorenewPollMessage;
- return this;
- }
-
- public Builder setSmdId(String smdId) {
- getInstance().smdId = smdId;
- return this;
- }
-
- public Builder setGracePeriods(ImmutableSet gracePeriods) {
- getInstance().gracePeriods = gracePeriods;
- return this;
- }
-
- public Builder addGracePeriod(GracePeriod gracePeriod) {
- getInstance().gracePeriods = union(getInstance().getGracePeriods(), gracePeriod);
- return this;
- }
-
- public Builder removeGracePeriod(GracePeriod gracePeriod) {
- getInstance().gracePeriods = difference(getInstance().getGracePeriods(), gracePeriod);
- return this;
- }
-
- @Override
- public Builder setTransferData(TransferData transferData) {
- getInstance().transferData = transferData;
- return thisCastToDerived();
- }
-
- @Override
- public Builder setLastTransferTime(DateTime lastTransferTime) {
- getInstance().lastTransferTime = lastTransferTime;
- return thisCastToDerived();
- }
- }
-}
-
diff --git a/java/google/registry/model/domain/GracePeriod.java b/java/google/registry/model/domain/GracePeriod.java
index 03d5102bd..27cd16d08 100644
--- a/java/google/registry/model/domain/GracePeriod.java
+++ b/java/google/registry/model/domain/GracePeriod.java
@@ -28,7 +28,7 @@ import org.joda.time.DateTime;
/**
* A domain grace period with an expiration time.
*
- *
When a grace period expires, it is lazily removed from the {@link DomainResource} the next
+ *
When a grace period expires, it is lazily removed from the {@link DomainBase} the next
* time the resource is loaded from Datastore.
*/
@Embed
diff --git a/java/google/registry/model/eppcommon/StatusValue.java b/java/google/registry/model/eppcommon/StatusValue.java
index 6f0677aa8..e6584694f 100644
--- a/java/google/registry/model/eppcommon/StatusValue.java
+++ b/java/google/registry/model/eppcommon/StatusValue.java
@@ -21,7 +21,7 @@ import static com.google.common.base.Strings.nullToEmpty;
import com.google.common.collect.ImmutableSet;
import google.registry.model.EppResource;
import google.registry.model.contact.ContactResource;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.host.HostResource;
import google.registry.model.translators.EnumToAttributeAdapter.EppEnum;
import google.registry.model.translators.StatusValueAdapter;
@@ -127,9 +127,9 @@ public enum StatusValue implements EppEnum {
/** Enum to help clearly list which resource types a status value is allowed to be present on. */
private enum AllowedOn {
- ALL(ContactResource.class, DomainResource.class, HostResource.class),
+ ALL(ContactResource.class, DomainBase.class, HostResource.class),
NONE,
- DOMAINS(DomainResource.class);
+ DOMAINS(DomainBase.class);
private final ImmutableSet> classes;
diff --git a/java/google/registry/model/eppinput/EppInput.java b/java/google/registry/model/eppinput/EppInput.java
index 8f46d0854..6992e7cbc 100644
--- a/java/google/registry/model/eppinput/EppInput.java
+++ b/java/google/registry/model/eppinput/EppInput.java
@@ -110,8 +110,8 @@ public class EppInput extends ImmutableObject {
return Optional.empty();
}
- /** Returns whether this EppInput represents a command that operates on domain resources. */
- public boolean isDomainResourceType() {
+ /** Returns whether this EppInput represents a command that operates on domains. */
+ public boolean isDomainType() {
return getResourceType().orElse("").equals("domain");
}
diff --git a/java/google/registry/model/host/HostResource.java b/java/google/registry/model/host/HostResource.java
index 0ea9696c8..8e8d79ced 100644
--- a/java/google/registry/model/host/HostResource.java
+++ b/java/google/registry/model/host/HostResource.java
@@ -31,7 +31,7 @@ import google.registry.model.EppResource;
import google.registry.model.EppResource.ForeignKeyedEppResource;
import google.registry.model.annotations.ExternalMessagingName;
import google.registry.model.annotations.ReportedOn;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.transfer.TransferData;
import java.net.InetAddress;
import java.util.Optional;
@@ -70,7 +70,7 @@ public class HostResource extends EppResource implements ForeignKeyedEppResource
@Index
@IgnoreSave(IfNull.class)
@DoNotHydrate
- Key superordinateDomain;
+ Key superordinateDomain;
/**
* The time that this resource was last transferred.
@@ -92,7 +92,7 @@ public class HostResource extends EppResource implements ForeignKeyedEppResource
return fullyQualifiedHostName;
}
- public Key getSuperordinateDomain() {
+ public Key getSuperordinateDomain() {
return superordinateDomain;
}
@@ -137,7 +137,7 @@ public class HostResource extends EppResource implements ForeignKeyedEppResource
* the {@link #superordinateDomain} field. Passing it as a parameter allows the caller to
* control the degree of consistency used to load it.
*/
- public DateTime computeLastTransferTime(@Nullable DomainResource superordinateDomain) {
+ public DateTime computeLastTransferTime(@Nullable DomainBase superordinateDomain) {
if (!isSubordinate()) {
checkArgument(superordinateDomain == null);
return getLastTransferTime();
@@ -195,7 +195,7 @@ public class HostResource extends EppResource implements ForeignKeyedEppResource
difference(getInstance().getInetAddresses(), inetAddresses)));
}
- public Builder setSuperordinateDomain(Key superordinateDomain) {
+ public Builder setSuperordinateDomain(Key superordinateDomain) {
getInstance().superordinateDomain = superordinateDomain;
return this;
}
diff --git a/java/google/registry/model/index/ForeignKeyIndex.java b/java/google/registry/model/index/ForeignKeyIndex.java
index 710146eda..b98bc77c9 100644
--- a/java/google/registry/model/index/ForeignKeyIndex.java
+++ b/java/google/registry/model/index/ForeignKeyIndex.java
@@ -40,7 +40,7 @@ import google.registry.model.BackupGroupRoot;
import google.registry.model.EppResource;
import google.registry.model.annotations.ReportedOn;
import google.registry.model.contact.ContactResource;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.host.HostResource;
import google.registry.util.NonFinalForTesting;
import java.util.Map;
@@ -62,10 +62,10 @@ public abstract class ForeignKeyIndex extends BackupGroup
@Entity
public static class ForeignKeyContactIndex extends ForeignKeyIndex {}
- /** The {@link ForeignKeyIndex} type for {@link DomainResource} entities. */
+ /** The {@link ForeignKeyIndex} type for {@link DomainBase} entities. */
@ReportedOn
@Entity
- public static class ForeignKeyDomainIndex extends ForeignKeyIndex {}
+ public static class ForeignKeyDomainIndex extends ForeignKeyIndex {}
/** The {@link ForeignKeyIndex} type for {@link HostResource} entities. */
@ReportedOn
@@ -77,7 +77,7 @@ public abstract class ForeignKeyIndex extends BackupGroup
RESOURCE_CLASS_TO_FKI_CLASS =
ImmutableMap.of(
ContactResource.class, ForeignKeyContactIndex.class,
- DomainResource.class, ForeignKeyDomainIndex.class,
+ DomainBase.class, ForeignKeyDomainIndex.class,
HostResource.class, ForeignKeyHostIndex.class);
@Id
diff --git a/java/google/registry/model/package-info.java b/java/google/registry/model/package-info.java
index e3b1cbef8..47d864b88 100644
--- a/java/google/registry/model/package-info.java
+++ b/java/google/registry/model/package-info.java
@@ -32,12 +32,15 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* This package defines all entities which are managed via EPP XML and persisted to the Datastore
* via Objectify.
*
- *
All first class entities are represented as a "Resource" class - {@link DomainResource},
- * {@link HostResource}, {@link ContactResource}, and {@link RegistrarResource}. Resource objects
- * are written in a single shared entity group per TLD. All commands that operate on those entities
- * are grouped in a "Command" class- {@link DomainCommand}, {@link HostCommand},
- * {@link ContactCommand}. The Resource does double duty as both the persisted representation and as
- * the XML-marshallable object returned in respond to Info commands.
+ *
All first class entities are represented as a resource class - {@link
+ * google.registry.model.domain.DomainBase}, {@link google.registry.model.host.HostResource}, {@link
+ * google.registry.model.contact.ContactResource}, and {@link
+ * google.registry.model.registrar.Registrar}. Resource objects are written in a single shared
+ * entity group per TLD. All commands that operate on those entities are grouped in a "Command"
+ * class- {@link google.registry.model.domain.DomainCommand}, {@link
+ * google.registry.model.host.HostCommand}, {@link google.registry.model.contact.ContactCommand}.
+ * The Resource does double duty as both the persisted representation and as the XML-marshallable
+ * object returned in respond to Info commands.
*
*
Command classes are never persisted, and the Objectify annotations on the Create and Update
* classes are purely for the benefit of the derived Resource classes that inherit from them.
diff --git a/java/google/registry/rdap/RdapDomainAction.java b/java/google/registry/rdap/RdapDomainAction.java
index 01e6bee38..a84a25c3e 100644
--- a/java/google/registry/rdap/RdapDomainAction.java
+++ b/java/google/registry/rdap/RdapDomainAction.java
@@ -22,7 +22,7 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
import com.google.common.collect.ImmutableMap;
import google.registry.flows.EppException;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
import google.registry.rdap.RdapMetrics.EndpointType;
import google.registry.request.Action;
@@ -75,14 +75,14 @@ public class RdapDomainAction extends RdapActionBase {
pathSearchString, getHumanReadableObjectTypeName(), e.getMessage()));
}
// The query string is not used; the RDAP syntax is /rdap/domain/mydomain.com.
- Optional domainResource =
+ Optional domainBase =
loadByForeignKey(
- DomainResource.class, pathSearchString, shouldIncludeDeleted() ? START_OF_TIME : now);
- if (!shouldBeVisible(domainResource, now)) {
+ DomainBase.class, pathSearchString, shouldIncludeDeleted() ? START_OF_TIME : now);
+ if (!shouldBeVisible(domainBase, now)) {
throw new NotFoundException(pathSearchString + " not found");
}
return rdapJsonFormatter.makeRdapJsonForDomain(
- domainResource.get(),
+ domainBase.get(),
true,
fullServletPath,
rdapWhoisServer,
diff --git a/java/google/registry/rdap/RdapDomainSearchAction.java b/java/google/registry/rdap/RdapDomainSearchAction.java
index 7d82df32a..09a226ea4 100644
--- a/java/google/registry/rdap/RdapDomainSearchAction.java
+++ b/java/google/registry/rdap/RdapDomainSearchAction.java
@@ -31,7 +31,7 @@ import com.google.common.net.InetAddresses;
import com.google.common.primitives.Booleans;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.cmd.Query;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.host.HostResource;
import google.registry.rdap.RdapJsonFormatter.BoilerplateType;
import google.registry.rdap.RdapJsonFormatter.OutputDataType;
@@ -216,11 +216,11 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
*/
private RdapSearchResults searchByDomainNameWithoutWildcard(
final RdapSearchPattern partialStringQuery, final DateTime now) {
- Optional domainResource =
- loadByForeignKey(DomainResource.class, partialStringQuery.getInitialString(), now);
+ Optional domainBase =
+ loadByForeignKey(DomainBase.class, partialStringQuery.getInitialString(), now);
return makeSearchResults(
- shouldBeVisible(domainResource, now)
- ? ImmutableList.of(domainResource.get())
+ shouldBeVisible(domainBase, now)
+ ? ImmutableList.of(domainBase.get())
: ImmutableList.of(),
now);
}
@@ -238,10 +238,10 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
// domains directly, rather than the foreign keys, because then we have an index on TLD if we
// need it.
int querySizeLimit = RESULT_SET_SIZE_SCALING_FACTOR * rdapResultSetMaxSize;
- Query query =
+ Query query =
ofy()
.load()
- .type(DomainResource.class)
+ .type(DomainBase.class)
.filter("fullyQualifiedDomainName <", partialStringQuery.getNextInitialString())
.filter("fullyQualifiedDomainName >=", partialStringQuery.getInitialString());
if (cursorString.isPresent()) {
@@ -262,10 +262,10 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
// searchByDomainNameWithInitialString, unable to perform an inequality query on deletion time.
// Don't use queryItems, because it doesn't handle pending deletes.
int querySizeLimit = RESULT_SET_SIZE_SCALING_FACTOR * rdapResultSetMaxSize;
- Query query =
+ Query query =
ofy()
.load()
- .type(DomainResource.class)
+ .type(DomainBase.class)
.filter("tld", tld);
if (cursorString.isPresent()) {
query = query.filter("fullyQualifiedDomainName >", cursorString.get());
@@ -368,9 +368,9 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
// The suffix must be a domain that we manage. That way, we can look up the domain and search
// through the subordinate hosts. This is more efficient, and lets us permit wildcard searches
// with no initial string.
- DomainResource domainResource =
+ DomainBase domainBase =
loadByForeignKey(
- DomainResource.class,
+ DomainBase.class,
partialStringQuery.getSuffix(),
shouldIncludeDeleted() ? START_OF_TIME : now)
.orElseThrow(
@@ -380,7 +380,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
+ "must be a domain defined in the system"));
Optional desiredRegistrar = getDesiredRegistrar();
ImmutableList.Builder> builder = new ImmutableList.Builder<>();
- for (String fqhn : ImmutableSortedSet.copyOf(domainResource.getSubordinateHosts())) {
+ for (String fqhn : ImmutableSortedSet.copyOf(domainBase.getSubordinateHosts())) {
// We can't just check that the host name starts with the initial query string, because
// then the query ns.exam*.example.com would match against nameserver ns.example.com.
if (partialStringQuery.matches(fqhn)) {
@@ -451,17 +451,17 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
// We must break the query up into chunks, because the in operator is limited to 30 subqueries.
// Since it is possible for the same domain to show up more than once in our result list (if
// we do a wildcard nameserver search that returns multiple nameservers used by the same
- // domain), we must create a set of resulting {@link DomainResource} objects. Use a sorted set,
+ // domain), we must create a set of resulting {@link DomainBase} objects. Use a sorted set,
// and fetch all domains, to make sure that we can return the first domains in alphabetical
// order.
- ImmutableSortedSet.Builder domainSetBuilder =
+ ImmutableSortedSet.Builder domainSetBuilder =
ImmutableSortedSet.orderedBy(
- Comparator.comparing(DomainResource::getFullyQualifiedDomainName));
+ Comparator.comparing(DomainBase::getFullyQualifiedDomainName));
int numHostKeysSearched = 0;
for (List> chunk : Iterables.partition(hostKeys, 30)) {
numHostKeysSearched += chunk.size();
- Query query = ofy().load()
- .type(DomainResource.class)
+ Query query = ofy().load()
+ .type(DomainBase.class)
.filter("nsHosts in", chunk);
if (!shouldIncludeDeleted()) {
query = query.filter("deletionTime >", now);
@@ -470,7 +470,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
} else if (cursorString.isPresent()) {
query = query.filter("fullyQualifiedDomainName >", cursorString.get());
}
- Stream stream =
+ Stream stream =
Streams.stream(query).filter(domain -> isAuthorized(domain, now));
if (cursorString.isPresent()) {
stream =
@@ -479,7 +479,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
}
stream.forEach(domainSetBuilder::add);
}
- List domains = domainSetBuilder.build().asList();
+ List domains = domainSetBuilder.build().asList();
metricInformationBuilder.setNumHostsRetrieved(numHostKeysSearched);
if (domains.size() > rdapResultSetMaxSize) {
return makeSearchResults(
@@ -502,14 +502,14 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
}
/** Output JSON for a list of domains, with no incompleteness warnings. */
- private RdapSearchResults makeSearchResults(List domains, DateTime now) {
+ private RdapSearchResults makeSearchResults(List domains, DateTime now) {
return makeSearchResults(
domains, IncompletenessWarningType.COMPLETE, Optional.of((long) domains.size()), now);
}
/** Output JSON from data in an {@link RdapResultSet} object. */
private RdapSearchResults makeSearchResults(
- RdapResultSet resultSet, DateTime now) {
+ RdapResultSet resultSet, DateTime now) {
return makeSearchResults(
resultSet.resources(),
resultSet.incompletenessWarningType(),
@@ -525,7 +525,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
* maximum number of nameservers in the first stage query.
*/
private RdapSearchResults makeSearchResults(
- List domains,
+ List domains,
IncompletenessWarningType incompletenessWarningType,
Optional numDomainsRetrieved,
DateTime now) {
@@ -535,7 +535,7 @@ public class RdapDomainSearchAction extends RdapSearchActionBase {
RdapAuthorization authorization = getAuthorization();
List> jsonList = new ArrayList<>();
Optional newCursor = Optional.empty();
- for (DomainResource domain : domains) {
+ for (DomainBase domain : domains) {
newCursor = Optional.of(domain.getFullyQualifiedDomainName());
jsonList.add(
rdapJsonFormatter.makeRdapJsonForDomain(
diff --git a/java/google/registry/rdap/RdapJsonFormatter.java b/java/google/registry/rdap/RdapJsonFormatter.java
index d64dfaf5b..b72f22245 100644
--- a/java/google/registry/rdap/RdapJsonFormatter.java
+++ b/java/google/registry/rdap/RdapJsonFormatter.java
@@ -39,7 +39,7 @@ import google.registry.model.contact.ContactResource;
import google.registry.model.contact.PostalInfo;
import google.registry.model.domain.DesignatedContact;
import google.registry.model.domain.DesignatedContact.Type;
-import google.registry.model.domain.DomainResource;
+import google.registry.model.domain.DomainBase;
import google.registry.model.eppcommon.Address;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.host.HostResource;
@@ -455,9 +455,9 @@ public class RdapJsonFormatter {
}
/**
- * Creates a JSON object for a {@link DomainResource}.
+ * Creates a JSON object for a {@link DomainBase}.
*
- * @param domainResource the domain resource object from which the JSON object should be created
+ * @param domainBase the domain resource object from which the JSON object should be created
* @param isTopLevel if true, the top-level boilerplate will be added
* @param linkBase the URL base to be used when creating links
* @param whoisServer the fully-qualified domain name of the WHOIS server to be listed in the
@@ -468,7 +468,7 @@ public class RdapJsonFormatter {
* registrar owning the domain, no contact information is included
*/
ImmutableMap makeRdapJsonForDomain(
- DomainResource domainResource,
+ DomainBase domainBase,
boolean isTopLevel,
@Nullable String linkBase,
@Nullable String whoisServer,
@@ -478,22 +478,22 @@ public class RdapJsonFormatter {
// Start with the domain-level information.
ImmutableMap.Builder jsonBuilder = new ImmutableMap.Builder<>();
jsonBuilder.put("objectClassName", "domain");
- jsonBuilder.put("handle", domainResource.getRepoId());
- jsonBuilder.put("ldhName", domainResource.getFullyQualifiedDomainName());
+ jsonBuilder.put("handle", domainBase.getRepoId());
+ jsonBuilder.put("ldhName", domainBase.getFullyQualifiedDomainName());
// Only include the unicodeName field if there are unicode characters.
- if (hasUnicodeComponents(domainResource.getFullyQualifiedDomainName())) {
- jsonBuilder.put("unicodeName", Idn.toUnicode(domainResource.getFullyQualifiedDomainName()));
+ if (hasUnicodeComponents(domainBase.getFullyQualifiedDomainName())) {
+ jsonBuilder.put("unicodeName", Idn.toUnicode(domainBase.getFullyQualifiedDomainName()));
}
jsonBuilder.put(
"status",
makeStatusValueList(
- domainResource.getStatusValues(),
+ domainBase.getStatusValues(),
false, // isRedacted
- domainResource.getDeletionTime().isBefore(now)));
+ domainBase.getDeletionTime().isBefore(now)));
jsonBuilder.put("links", ImmutableList.of(
- makeLink("domain", domainResource.getFullyQualifiedDomainName(), linkBase)));
+ makeLink("domain", domainBase.getFullyQualifiedDomainName(), linkBase)));
boolean displayContacts =
- authorization.isAuthorizedForClientId(domainResource.getCurrentSponsorClientId());
+ authorization.isAuthorizedForClientId(domainBase.getCurrentSponsorClientId());
// If we are outputting all data (not just summary data), also add information about hosts,
// contacts and events (history entries). If we are outputting summary data, instead add a
// remark indicating that fact.
@@ -504,26 +504,26 @@ public class RdapJsonFormatter {
remarks = displayContacts
? ImmutableList.of()
: ImmutableList.of(RdapIcannStandardInformation.DOMAIN_CONTACTS_HIDDEN_DATA_REMARK);
- ImmutableList