mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Merge DomainResource into DomainBase
This eliminates the use of Objectify polymorphism for EPP resources entirely (yay!), which makes the Registry 3.0 database migration easier. It is unfortunate that the naming parallelism of EppResources is lost between ContactResource, HostResource, and DomainResource, but the actual type as far as Datastore was concerned was DomainBase all along, and it would be a much more substantial data migration to allow us to continue using the class name DomainResource now that we're no longer using Objectify polymorphism. This simply isn't worth it. This also removes the polymorphic Datastore indexes (which will no longer function as of this change). The non-polymorphic replacement indexes were added in [] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=230930546
This commit is contained in:
parent
97c2049669
commit
e2528875b2
166 changed files with 1525 additions and 1666 deletions
|
@ -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<DomainResource> lookupSuperordinateDomain(
|
||||
/** Return the {@link DomainBase} this host is subordinate to, or null for external hosts. */
|
||||
public static Optional<DomainBase> lookupSuperordinateDomain(
|
||||
InternetDomainName hostName, DateTime now) throws EppException {
|
||||
Optional<InternetDomainName> 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<DomainResource> superordinateDomain =
|
||||
loadByForeignKey(DomainResource.class, domainName, now);
|
||||
Optional<DomainBase> 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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue