mirror of
https://github.com/google/nomulus.git
synced 2025-06-28 23:33:36 +02:00
Remove LoggedInFlow
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137444791
This commit is contained in:
parent
8b068250d6
commit
b84d7f1fb5
50 changed files with 763 additions and 429 deletions
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyTargetIdCount;
|
||||
import static google.registry.model.EppResourceUtils.checkResourcesExist;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
||||
|
@ -21,7 +22,9 @@ import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.config.ConfigModule.Config;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.LoggedInFlow;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
import google.registry.model.eppoutput.CheckData.HostCheck;
|
||||
import google.registry.model.eppoutput.CheckData.HostCheckData;
|
||||
|
@ -39,14 +42,18 @@ import javax.inject.Inject;
|
|||
*
|
||||
* @error {@link google.registry.flows.exceptions.TooManyResourceChecksException}
|
||||
*/
|
||||
public final class HostCheckFlow extends LoggedInFlow {
|
||||
public final class HostCheckFlow extends Flow {
|
||||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @Config("maxChecks") int maxChecks;
|
||||
@Inject HostCheckFlow() {}
|
||||
|
||||
@Override
|
||||
protected final EppOutput run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
List<String> targetIds = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(targetIds, maxChecks);
|
||||
Set<String> existingIds = checkResourcesExist(HostResource.class, targetIds, now);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceDoesNotExist;
|
||||
import static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain;
|
||||
import static google.registry.flows.host.HostFlowUtils.validateHostName;
|
||||
|
@ -31,9 +32,10 @@ import google.registry.dns.DnsQueue;
|
|||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.EppException.ParameterValueRangeErrorException;
|
||||
import google.registry.flows.EppException.RequiredParameterMissingException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.LoggedInFlow;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
|
@ -68,23 +70,21 @@ import javax.inject.Inject;
|
|||
* @error {@link SubordinateHostMustHaveIpException}
|
||||
* @error {@link UnexpectedExternalHostIpException}
|
||||
*/
|
||||
public final class HostCreateFlow extends LoggedInFlow implements TransactionalFlow {
|
||||
public final class HostCreateFlow extends Flow implements TransactionalFlow {
|
||||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject HistoryEntry.Builder historyBuilder;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject HostCreateFlow() {}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected final void initLoggedInFlow() throws EppException {
|
||||
registerExtensions(MetadataExtension.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final EppOutput run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
Create command = (Create) resourceCommand;
|
||||
verifyResourceDoesNotExist(HostResource.class, targetId, now);
|
||||
// The superordinate domain of the host object if creating an in-bailiwick host, or null if
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.failfastForAsyncDelete;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
|
||||
|
@ -27,9 +28,10 @@ import com.google.common.base.Optional;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.LoggedInFlow;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.async.AsyncFlowEnqueuer;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
|
@ -55,7 +57,7 @@ import javax.inject.Inject;
|
|||
* @error {@link google.registry.flows.exceptions.ResourceStatusProhibitsOperationException}
|
||||
* @error {@link google.registry.flows.exceptions.ResourceToDeleteIsReferencedException}
|
||||
*/
|
||||
public final class HostDeleteFlow extends LoggedInFlow implements TransactionalFlow {
|
||||
public final class HostDeleteFlow extends Flow implements TransactionalFlow {
|
||||
|
||||
private static final ImmutableSet<StatusValue> DISALLOWED_STATUSES = ImmutableSet.of(
|
||||
StatusValue.LINKED,
|
||||
|
@ -70,20 +72,19 @@ public final class HostDeleteFlow extends LoggedInFlow implements TransactionalF
|
|||
return domain.getNameservers();
|
||||
}};
|
||||
|
||||
@Inject AsyncFlowEnqueuer asyncFlowEnqueuer;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject HistoryEntry.Builder historyBuilder;
|
||||
@Inject AsyncFlowEnqueuer asyncFlowEnqueuer;
|
||||
@Inject HostDeleteFlow() {}
|
||||
|
||||
@Override
|
||||
protected final void initLoggedInFlow() throws EppException {
|
||||
registerExtensions(MetadataExtension.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
failfastForAsyncDelete(targetId, now, HostResource.class, GET_NAMESERVERS);
|
||||
HostResource existingHost = loadAndVerifyExistence(HostResource.class, targetId, now);
|
||||
verifyNoDisallowedStatuses(existingHost, DISALLOWED_STATUSES);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus;
|
||||
|
@ -21,8 +22,10 @@ import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
|||
|
||||
import com.google.common.base.Optional;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.LoggedInFlow;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.model.host.HostResource;
|
||||
|
@ -36,14 +39,18 @@ import javax.inject.Inject;
|
|||
*
|
||||
* @error {@link google.registry.flows.ResourceFlowUtils.ResourceDoesNotExistException}
|
||||
*/
|
||||
public final class HostInfoFlow extends LoggedInFlow {
|
||||
public final class HostInfoFlow extends Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject HostInfoFlow() {}
|
||||
|
||||
@Override
|
||||
public EppOutput run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, host);
|
||||
return createOutput(SUCCESS, cloneResourceWithLinkedStatus(host, now));
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
package google.registry.flows.host;
|
||||
|
||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static google.registry.flows.FlowUtils.validateClientIsLoggedIn;
|
||||
import static google.registry.flows.ResourceFlowUtils.loadAndVerifyExistence;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyNoDisallowedStatuses;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
|
@ -37,9 +38,10 @@ import google.registry.flows.EppException.ObjectAlreadyExistsException;
|
|||
import google.registry.flows.EppException.ParameterValueRangeErrorException;
|
||||
import google.registry.flows.EppException.RequiredParameterMissingException;
|
||||
import google.registry.flows.EppException.StatusProhibitsOperationException;
|
||||
import google.registry.flows.ExtensionManager;
|
||||
import google.registry.flows.Flow;
|
||||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.LoggedInFlow;
|
||||
import google.registry.flows.TransactionalFlow;
|
||||
import google.registry.flows.async.AsyncFlowEnqueuer;
|
||||
import google.registry.flows.exceptions.AddRemoveSameValueEppException;
|
||||
|
@ -88,7 +90,7 @@ import javax.inject.Inject;
|
|||
* @error {@link RenameHostToExternalRemoveIpException}
|
||||
* @error {@link RenameHostToSubordinateRequiresIpException}
|
||||
*/
|
||||
public final class HostUpdateFlow extends LoggedInFlow implements TransactionalFlow {
|
||||
public final class HostUpdateFlow extends Flow implements TransactionalFlow {
|
||||
|
||||
/**
|
||||
* Note that CLIENT_UPDATE_PROHIBITED is intentionally not in this list. This is because it
|
||||
|
@ -100,6 +102,7 @@ public final class HostUpdateFlow extends LoggedInFlow implements TransactionalF
|
|||
StatusValue.SERVER_UPDATE_PROHIBITED);
|
||||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
|
@ -108,13 +111,11 @@ public final class HostUpdateFlow extends LoggedInFlow implements TransactionalF
|
|||
@Inject DnsQueue dnsQueue;
|
||||
@Inject HostUpdateFlow() {}
|
||||
|
||||
@Override
|
||||
protected final void initLoggedInFlow() throws EppException {
|
||||
registerExtensions(MetadataExtension.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateClientIsLoggedIn(clientId);
|
||||
Update command = (Update) resourceCommand;
|
||||
String suppliedNewHostName = command.getInnerChange().getFullyQualifiedHostName();
|
||||
HostResource existingHost = loadAndVerifyExistence(HostResource.class, targetId, now);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue