mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 03:30:46 +02:00
Remove duplicate version of lookupSuperordinateDomain() function
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=148657943
This commit is contained in:
parent
90114858fa
commit
64bfbea324
4 changed files with 7 additions and 34 deletions
|
@ -96,8 +96,8 @@ 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<DomainResource> superordinateDomain = Optional.fromNullable(
|
||||
lookupSuperordinateDomain(validateHostName(targetId), now));
|
||||
Optional<DomainResource> superordinateDomain =
|
||||
lookupSuperordinateDomain(validateHostName(targetId), now);
|
||||
verifyDomainIsSameRegistrar(superordinateDomain.orNull(), clientId);
|
||||
boolean willBeSubordinate = superordinateDomain.isPresent();
|
||||
boolean hasIpAddresses = !isNullOrEmpty(command.getInetAddresses());
|
||||
|
|
|
@ -86,12 +86,12 @@ public class HostFlowUtils {
|
|||
}
|
||||
|
||||
/** Return the {@link DomainResource} this host is subordinate to, or null for external hosts. */
|
||||
static DomainResource lookupSuperordinateDomain(
|
||||
public static Optional<DomainResource> lookupSuperordinateDomain(
|
||||
InternetDomainName hostName, DateTime now) throws EppException {
|
||||
Optional<InternetDomainName> tld = findTldForName(hostName);
|
||||
if (!tld.isPresent()) {
|
||||
// This is an host on a TLD we don't run, therefore obviously external, so we are done.
|
||||
return null;
|
||||
return Optional.absent();
|
||||
}
|
||||
// This is a subordinate host
|
||||
String domainName = Joiner.on('.').join(Iterables.skip(
|
||||
|
@ -100,7 +100,7 @@ public class HostFlowUtils {
|
|||
if (superordinateDomain == null || !isActive(superordinateDomain, now)) {
|
||||
throw new SuperordinateDomainDoesNotExistException(domainName);
|
||||
}
|
||||
return superordinateDomain;
|
||||
return Optional.of(superordinateDomain);
|
||||
}
|
||||
|
||||
/** Superordinate domain for this hostname does not exist. */
|
||||
|
|
|
@ -130,7 +130,7 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
|||
String newHostName = firstNonNull(suppliedNewHostName, oldHostName);
|
||||
// Note that lookupSuperordinateDomain calls cloneProjectedAtTime on the domain for us.
|
||||
Optional<DomainResource> newSuperordinateDomain =
|
||||
Optional.fromNullable(lookupSuperordinateDomain(validateHostName(newHostName), now));
|
||||
lookupSuperordinateDomain(validateHostName(newHostName), now);
|
||||
verifyUpdateAllowed(command, existingHost, newSuperordinateDomain.orNull());
|
||||
if (isHostRename && loadAndGetKey(HostResource.class, newHostName, now) != null) {
|
||||
throw new HostAlreadyExistsException(newHostName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue