mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Turn Flow into an interface and inject all its fields
This concludes your flow flattening experience. Please fill out a flow flattening satisfaction survey before exiting. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137903095
This commit is contained in:
parent
82b0bff9b5
commit
053538b1b5
49 changed files with 630 additions and 569 deletions
|
@ -19,7 +19,6 @@ import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
|||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.addSecDnsExtensionIfPresent;
|
||||
import static google.registry.flows.domain.DomainFlowUtils.handleFeeRequest;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
||||
import static google.registry.util.CollectionUtils.forceEmptyToNull;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
@ -41,11 +40,14 @@ import google.registry.model.domain.flags.FlagsInfoResponseExtension;
|
|||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
import google.registry.model.domain.rgp.RgpInfoExtension;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
import google.registry.util.Clock;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* An EPP flow that returns information about a domain.
|
||||
|
@ -61,26 +63,30 @@ import javax.inject.Inject;
|
|||
* @error {@link DomainFlowUtils.FeeChecksDontSupportPhasesException}
|
||||
* @error {@link DomainFlowUtils.RestoresAreAlwaysForOneYearException}
|
||||
*/
|
||||
public final class DomainInfoFlow extends Flow {
|
||||
public final class DomainInfoFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject EppInput eppInput;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject Clock clock;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
@Inject DomainInfoFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(FeeInfoCommandExtensionV06.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
DateTime now = clock.nowUtc();
|
||||
DomainResource domain = loadAndVerifyExistence(DomainResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, domain);
|
||||
return createOutput(
|
||||
SUCCESS,
|
||||
getResourceInfo(domain),
|
||||
getDomainResponseExtensions(domain));
|
||||
return responseBuilder
|
||||
.setResData(getResourceInfo(domain))
|
||||
.setExtensions(getDomainResponseExtensions(domain, now))
|
||||
.build();
|
||||
}
|
||||
|
||||
private DomainResource getResourceInfo(DomainResource domain) {
|
||||
|
@ -111,8 +117,8 @@ public final class DomainInfoFlow extends Flow {
|
|||
return info.build();
|
||||
}
|
||||
|
||||
private ImmutableList<ResponseExtension> getDomainResponseExtensions(DomainResource domain)
|
||||
throws EppException {
|
||||
private ImmutableList<ResponseExtension> getDomainResponseExtensions(
|
||||
DomainResource domain, DateTime now) throws EppException {
|
||||
ImmutableList.Builder<ResponseExtension> extensions = new ImmutableList.Builder<>();
|
||||
addSecDnsExtensionIfPresent(extensions, domain.getDsData());
|
||||
ImmutableSet<GracePeriodStatus> gracePeriodStatuses = domain.getGracePeriodStatuses();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue