mirror of
https://github.com/google/nomulus.git
synced 2025-08-11 03:59:37 +02:00
Make EppInput.getSingleExtension() return Optional, not @Nullable
This makes it harder to use it incorrectly by accident. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=181795813
This commit is contained in:
parent
fbdb148540
commit
315e6d57bf
21 changed files with 290 additions and 239 deletions
|
@ -94,6 +94,7 @@ import google.registry.model.registry.Registry.TldState;
|
|||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||
import google.registry.model.smd.EncodedSignedMark;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
|
@ -216,10 +217,9 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
|
|||
int years = command.getPeriod().getValue();
|
||||
validateRegistrationPeriod(years);
|
||||
validateCreateCommandContactsAndNameservers(command, registry, domainName);
|
||||
LaunchCreateExtension launchCreate = eppInput.getSingleExtension(LaunchCreateExtension.class);
|
||||
if (launchCreate != null) {
|
||||
validateLaunchCreateExtension(launchCreate, registry, domainName, now);
|
||||
}
|
||||
LaunchCreateExtension launchCreate =
|
||||
eppInput.getSingleExtension(LaunchCreateExtension.class).get();
|
||||
validateLaunchCreateExtension(launchCreate, registry, domainName, now);
|
||||
boolean isAnchorTenant =
|
||||
matchesAnchorTenantReservation(domainName, authInfo.getPw().getValue());
|
||||
// Superusers can create reserved domains, force creations on domains that require a claims
|
||||
|
@ -232,10 +232,10 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
|
|||
verifyNotReserved(domainName, isSunriseApplication);
|
||||
}
|
||||
}
|
||||
FeeCreateCommandExtension feeCreate =
|
||||
Optional<FeeCreateCommandExtension> feeCreate =
|
||||
eppInput.getSingleExtension(FeeCreateCommandExtension.class);
|
||||
validateFeeChallenge(targetId, tld, now, feeCreate, feesAndCredits);
|
||||
SecDnsCreateExtension secDnsCreate =
|
||||
Optional<SecDnsCreateExtension> secDnsCreate =
|
||||
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));
|
||||
customLogic.afterValidation(
|
||||
AfterValidationParameters.newBuilder()
|
||||
|
@ -254,7 +254,7 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
|
|||
.setPeriod(command.getPeriod())
|
||||
.setApplicationStatus(ApplicationStatus.VALIDATED)
|
||||
.addStatusValue(StatusValue.PENDING_CREATE)
|
||||
.setDsData(secDnsCreate == null ? null : secDnsCreate.getDsData())
|
||||
.setDsData(secDnsCreate.isPresent() ? secDnsCreate.get().getDsData() : null)
|
||||
.setRegistrant(command.getRegistrant())
|
||||
.setAuthInfo(command.getAuthInfo())
|
||||
.setFullyQualifiedDomainName(targetId)
|
||||
|
@ -377,7 +377,7 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
|
|||
private static ImmutableList<ResponseExtension> createResponseExtensions(
|
||||
String applicationId,
|
||||
LaunchPhase launchPhase,
|
||||
FeeTransformCommandExtension feeCreate,
|
||||
Optional<? extends FeeTransformCommandExtension> feeCreate,
|
||||
FeesAndCredits feesAndCredits) {
|
||||
ImmutableList.Builder<ResponseExtension> responseExtensionsBuilder =
|
||||
new ImmutableList.Builder<>();
|
||||
|
@ -385,8 +385,8 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
|
|||
.setPhase(launchPhase)
|
||||
.setApplicationId(applicationId)
|
||||
.build());
|
||||
if (feeCreate != null) {
|
||||
responseExtensionsBuilder.add(createFeeCreateResponse(feeCreate, feesAndCredits));
|
||||
if (feeCreate.isPresent()) {
|
||||
responseExtensionsBuilder.add(createFeeCreateResponse(feeCreate.get(), feesAndCredits));
|
||||
}
|
||||
return responseExtensionsBuilder.build();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue