mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +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
|
@ -30,7 +30,7 @@ import com.google.common.collect.Sets;
|
|||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.template.soy.data.SoyMapData;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.tools.params.NameserversParameter;
|
||||
import google.registry.tools.soy.DomainUpdateSoyInfo;
|
||||
|
@ -173,18 +173,18 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand {
|
|||
|
||||
if (!nameservers.isEmpty() || !admins.isEmpty() || !techs.isEmpty() || !statuses.isEmpty()) {
|
||||
DateTime now = DateTime.now(UTC);
|
||||
Optional<DomainResource> domainOptional =
|
||||
loadByForeignKey(DomainResource.class, domain, now);
|
||||
Optional<DomainBase> domainOptional =
|
||||
loadByForeignKey(DomainBase.class, domain, now);
|
||||
checkArgumentPresent(domainOptional, "Domain '%s' does not exist or is deleted", domain);
|
||||
DomainResource domainResource = domainOptional.get();
|
||||
DomainBase domainBase = domainOptional.get();
|
||||
checkArgument(
|
||||
!domainResource.getStatusValues().contains(SERVER_UPDATE_PROHIBITED),
|
||||
!domainBase.getStatusValues().contains(SERVER_UPDATE_PROHIBITED),
|
||||
"The domain '%s' has status SERVER_UPDATE_PROHIBITED. Verify that you are allowed "
|
||||
+ "to make updates, and if so, use the domain_unlock command to enable updates.",
|
||||
domain);
|
||||
if (!nameservers.isEmpty()) {
|
||||
ImmutableSortedSet<String> existingNameservers =
|
||||
domainResource.loadNameserverFullyQualifiedHostNames();
|
||||
domainBase.loadNameserverFullyQualifiedHostNames();
|
||||
populateAddRemoveLists(
|
||||
ImmutableSet.copyOf(nameservers),
|
||||
existingNameservers,
|
||||
|
@ -201,9 +201,9 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand {
|
|||
}
|
||||
if (!admins.isEmpty() || !techs.isEmpty()) {
|
||||
ImmutableSet<String> existingAdmins =
|
||||
getContactsOfType(domainResource, DesignatedContact.Type.ADMIN);
|
||||
getContactsOfType(domainBase, DesignatedContact.Type.ADMIN);
|
||||
ImmutableSet<String> existingTechs =
|
||||
getContactsOfType(domainResource, DesignatedContact.Type.TECH);
|
||||
getContactsOfType(domainBase, DesignatedContact.Type.TECH);
|
||||
|
||||
if (!admins.isEmpty()) {
|
||||
populateAddRemoveLists(
|
||||
|
@ -222,7 +222,7 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand {
|
|||
}
|
||||
if (!statuses.isEmpty()) {
|
||||
Set<String> currentStatusValues = new HashSet<>();
|
||||
for (StatusValue statusValue : domainResource.getStatusValues()) {
|
||||
for (StatusValue statusValue : domainBase.getStatusValues()) {
|
||||
currentStatusValues.add(statusValue.getXmlName());
|
||||
}
|
||||
populateAddRemoveLists(
|
||||
|
@ -290,8 +290,8 @@ final class UpdateDomainCommand extends CreateOrUpdateDomainCommand {
|
|||
}
|
||||
|
||||
ImmutableSet<String> getContactsOfType(
|
||||
DomainResource domainResource, final DesignatedContact.Type contactType) {
|
||||
return domainResource
|
||||
DomainBase domainBase, final DesignatedContact.Type contactType) {
|
||||
return domainBase
|
||||
.getContacts()
|
||||
.stream()
|
||||
.filter(contact -> contact.getType().equals(contactType))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue