mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Inject targetId into contact flows
Other flows to come. This removes the need for most of the flows to inject the command at all. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133163030
This commit is contained in:
parent
8c39e10dec
commit
65ef712f35
10 changed files with 38 additions and 39 deletions
|
@ -186,6 +186,13 @@ public class FlowModule {
|
||||||
return Optional.fromNullable(((SingleResourceCommand) resourceCommand).getAuthInfo());
|
return Optional.fromNullable(((SingleResourceCommand) resourceCommand).getAuthInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@FlowScope
|
||||||
|
@TargetId
|
||||||
|
static String provideTargetId(ResourceCommand resourceCommand) {
|
||||||
|
return ((SingleResourceCommand) resourceCommand).getTargetId();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a partially filled in {@link HistoryEntry} builder.
|
* Provides a partially filled in {@link HistoryEntry} builder.
|
||||||
*
|
*
|
||||||
|
@ -234,6 +241,11 @@ public class FlowModule {
|
||||||
@Documented
|
@Documented
|
||||||
public @interface ClientId {}
|
public @interface ClientId {}
|
||||||
|
|
||||||
|
/** Dagger qualifier for the target id (foreign key) for single resource flows. */
|
||||||
|
@Qualifier
|
||||||
|
@Documented
|
||||||
|
public @interface TargetId {}
|
||||||
|
|
||||||
/** Dagger qualifier for whether a flow is in dry run mode. */
|
/** Dagger qualifier for whether a flow is in dry run mode. */
|
||||||
@Qualifier
|
@Qualifier
|
||||||
@Documented
|
@Documented
|
||||||
|
|
|
@ -24,6 +24,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.exceptions.ResourceAlreadyExistsException;
|
import google.registry.flows.exceptions.ResourceAlreadyExistsException;
|
||||||
|
@ -51,6 +52,7 @@ public class ContactCreateFlow extends LoggedInFlow implements TransactionalFlow
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject ResourceCommand resourceCommand;
|
||||||
@Inject @ClientId String clientId;
|
@Inject @ClientId String clientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject HistoryEntry.Builder historyBuilder;
|
@Inject HistoryEntry.Builder historyBuilder;
|
||||||
@Inject ContactCreateFlow() {}
|
@Inject ContactCreateFlow() {}
|
||||||
|
|
||||||
|
@ -62,8 +64,8 @@ public class ContactCreateFlow extends LoggedInFlow implements TransactionalFlow
|
||||||
@Override
|
@Override
|
||||||
protected final EppOutput run() throws EppException {
|
protected final EppOutput run() throws EppException {
|
||||||
Create command = (Create) resourceCommand;
|
Create command = (Create) resourceCommand;
|
||||||
if (loadByUniqueId(ContactResource.class, command.getTargetId(), now) != null) {
|
if (loadByUniqueId(ContactResource.class, targetId, now) != null) {
|
||||||
throw new ResourceAlreadyExistsException(command.getTargetId());
|
throw new ResourceAlreadyExistsException(targetId);
|
||||||
}
|
}
|
||||||
Builder builder = new Builder();
|
Builder builder = new Builder();
|
||||||
command.applyTo(builder);
|
command.applyTo(builder);
|
||||||
|
|
|
@ -30,19 +30,18 @@ import com.googlecode.objectify.Key;
|
||||||
import google.registry.config.ConfigModule.Config;
|
import google.registry.config.ConfigModule.Config;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.async.AsyncFlowUtils;
|
import google.registry.flows.async.AsyncFlowUtils;
|
||||||
import google.registry.flows.async.DeleteContactResourceAction;
|
import google.registry.flows.async.DeleteContactResourceAction;
|
||||||
import google.registry.flows.async.DeleteEppResourceAction;
|
import google.registry.flows.async.DeleteEppResourceAction;
|
||||||
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
||||||
import google.registry.model.contact.ContactCommand.Delete;
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.DomainBase;
|
import google.registry.model.domain.DomainBase;
|
||||||
import google.registry.model.domain.metadata.MetadataExtension;
|
import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppcommon.AuthInfo;
|
import google.registry.model.eppcommon.AuthInfo;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
|
||||||
import google.registry.model.eppoutput.EppOutput;
|
import google.registry.model.eppoutput.EppOutput;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -64,8 +63,8 @@ public class ContactDeleteFlow extends LoggedInFlow implements TransactionalFlow
|
||||||
StatusValue.PENDING_DELETE,
|
StatusValue.PENDING_DELETE,
|
||||||
StatusValue.SERVER_DELETE_PROHIBITED);
|
StatusValue.SERVER_DELETE_PROHIBITED);
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
|
||||||
@Inject @ClientId String clientId;
|
@Inject @ClientId String clientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject Optional<AuthInfo> authInfo;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject @Config("asyncDeleteFlowMapreduceDelay") Duration mapreduceDelay;
|
@Inject @Config("asyncDeleteFlowMapreduceDelay") Duration mapreduceDelay;
|
||||||
@Inject HistoryEntry.Builder historyBuilder;
|
@Inject HistoryEntry.Builder historyBuilder;
|
||||||
|
@ -78,8 +77,6 @@ public class ContactDeleteFlow extends LoggedInFlow implements TransactionalFlow
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final EppOutput run() throws EppException {
|
public final EppOutput run() throws EppException {
|
||||||
Delete command = (Delete) resourceCommand;
|
|
||||||
String targetId = command.getTargetId();
|
|
||||||
failfastForAsyncDelete(
|
failfastForAsyncDelete(
|
||||||
targetId,
|
targetId,
|
||||||
now,
|
now,
|
||||||
|
|
|
@ -21,12 +21,11 @@ import static google.registry.model.eppoutput.Result.Code.Success;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
|
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
|
||||||
import google.registry.model.contact.ContactCommand.Info;
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.eppcommon.AuthInfo;
|
import google.registry.model.eppcommon.AuthInfo;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
|
||||||
import google.registry.model.eppoutput.EppOutput;
|
import google.registry.model.eppoutput.EppOutput;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
@ -37,14 +36,12 @@ import javax.inject.Inject;
|
||||||
*/
|
*/
|
||||||
public class ContactInfoFlow extends LoggedInFlow {
|
public class ContactInfoFlow extends LoggedInFlow {
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject @TargetId String targetId;
|
||||||
@Inject Optional<AuthInfo> authInfo;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject ContactInfoFlow() {}
|
@Inject ContactInfoFlow() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final EppOutput run() throws EppException {
|
public final EppOutput run() throws EppException {
|
||||||
Info command = (Info) resourceCommand;
|
|
||||||
String targetId = command.getTargetId();
|
|
||||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||||
if (existingResource == null) {
|
if (existingResource == null) {
|
||||||
throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId);
|
throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId);
|
||||||
|
|
|
@ -26,11 +26,11 @@ import com.google.common.base.Optional;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.exceptions.NotPendingTransferException;
|
import google.registry.flows.exceptions.NotPendingTransferException;
|
||||||
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
||||||
import google.registry.model.contact.ContactCommand.Transfer;
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.metadata.MetadataExtension;
|
import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppcommon.AuthInfo;
|
import google.registry.model.eppcommon.AuthInfo;
|
||||||
|
@ -53,6 +53,7 @@ public class ContactTransferApproveFlow extends LoggedInFlow implements Transact
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject ResourceCommand resourceCommand;
|
||||||
@Inject @ClientId String clientId;
|
@Inject @ClientId String clientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject Optional<AuthInfo> authInfo;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject HistoryEntry.Builder historyBuilder;
|
@Inject HistoryEntry.Builder historyBuilder;
|
||||||
@Inject ContactTransferApproveFlow() {}
|
@Inject ContactTransferApproveFlow() {}
|
||||||
|
@ -64,8 +65,6 @@ public class ContactTransferApproveFlow extends LoggedInFlow implements Transact
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final EppOutput run() throws EppException {
|
public final EppOutput run() throws EppException {
|
||||||
Transfer command = (Transfer) resourceCommand;
|
|
||||||
String targetId = command.getTargetId();
|
|
||||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||||
if (existingResource == null) {
|
if (existingResource == null) {
|
||||||
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
||||||
|
|
|
@ -25,12 +25,12 @@ import com.google.common.base.Optional;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.exceptions.NotPendingTransferException;
|
import google.registry.flows.exceptions.NotPendingTransferException;
|
||||||
import google.registry.flows.exceptions.NotTransferInitiatorException;
|
import google.registry.flows.exceptions.NotTransferInitiatorException;
|
||||||
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
||||||
import google.registry.model.contact.ContactCommand.Transfer;
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.metadata.MetadataExtension;
|
import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppcommon.AuthInfo;
|
import google.registry.model.eppcommon.AuthInfo;
|
||||||
|
@ -54,6 +54,7 @@ public class ContactTransferCancelFlow extends LoggedInFlow implements Transacti
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject ResourceCommand resourceCommand;
|
||||||
@Inject Optional<AuthInfo> authInfo;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject @ClientId String clientId;
|
@Inject @ClientId String clientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject HistoryEntry.Builder historyBuilder;
|
@Inject HistoryEntry.Builder historyBuilder;
|
||||||
@Inject ContactTransferCancelFlow() {}
|
@Inject ContactTransferCancelFlow() {}
|
||||||
|
|
||||||
|
@ -64,8 +65,6 @@ public class ContactTransferCancelFlow extends LoggedInFlow implements Transacti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final EppOutput run() throws EppException {
|
protected final EppOutput run() throws EppException {
|
||||||
Transfer command = (Transfer) resourceCommand;
|
|
||||||
String targetId = command.getTargetId();
|
|
||||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||||
// Fail if the object doesn't exist or was deleted.
|
// Fail if the object doesn't exist or was deleted.
|
||||||
if (existingResource == null) {
|
if (existingResource == null) {
|
||||||
|
|
|
@ -22,14 +22,13 @@ import static google.registry.model.eppoutput.Result.Code.Success;
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
|
import google.registry.flows.exceptions.NoTransferHistoryToQueryException;
|
||||||
import google.registry.flows.exceptions.NotAuthorizedToViewTransferException;
|
import google.registry.flows.exceptions.NotAuthorizedToViewTransferException;
|
||||||
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
|
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
|
||||||
import google.registry.model.contact.ContactCommand.Transfer;
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.eppcommon.AuthInfo;
|
import google.registry.model.eppcommon.AuthInfo;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
|
||||||
import google.registry.model.eppoutput.EppOutput;
|
import google.registry.model.eppoutput.EppOutput;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
@ -43,15 +42,13 @@ import javax.inject.Inject;
|
||||||
*/
|
*/
|
||||||
public class ContactTransferQueryFlow extends LoggedInFlow {
|
public class ContactTransferQueryFlow extends LoggedInFlow {
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
|
||||||
@Inject Optional<AuthInfo> authInfo;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject @ClientId String clientId;
|
@Inject @ClientId String clientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject ContactTransferQueryFlow() {}
|
@Inject ContactTransferQueryFlow() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final EppOutput run() throws EppException {
|
public final EppOutput run() throws EppException {
|
||||||
Transfer command = (Transfer) resourceCommand;
|
|
||||||
String targetId = command.getTargetId();
|
|
||||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||||
if (existingResource == null) {
|
if (existingResource == null) {
|
||||||
throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId);
|
throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId);
|
||||||
|
@ -64,7 +61,7 @@ public class ContactTransferQueryFlow extends LoggedInFlow {
|
||||||
}
|
}
|
||||||
// Note that the authorization info on the command (if present) has already been verified. If
|
// Note that the authorization info on the command (if present) has already been verified. If
|
||||||
// it's present, then the other checks are unnecessary.
|
// it's present, then the other checks are unnecessary.
|
||||||
if (command.getAuthInfo() == null
|
if (!authInfo.isPresent()
|
||||||
&& !clientId.equals(existingResource.getTransferData().getGainingClientId())
|
&& !clientId.equals(existingResource.getTransferData().getGainingClientId())
|
||||||
&& !clientId.equals(existingResource.getTransferData().getLosingClientId())) {
|
&& !clientId.equals(existingResource.getTransferData().getLosingClientId())) {
|
||||||
throw new NotAuthorizedToViewTransferException();
|
throw new NotAuthorizedToViewTransferException();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
package google.registry.flows.contact;
|
package google.registry.flows.contact;
|
||||||
|
|
||||||
import static google.registry.flows.ResourceFlowUtils.verifyAuthInfoForResource;
|
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||||
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
import static google.registry.flows.ResourceFlowUtils.verifyResourceOwnership;
|
||||||
import static google.registry.flows.contact.ContactFlowUtils.createGainingTransferPollMessage;
|
import static google.registry.flows.contact.ContactFlowUtils.createGainingTransferPollMessage;
|
||||||
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
|
import static google.registry.flows.contact.ContactFlowUtils.createTransferResponse;
|
||||||
|
@ -22,17 +22,18 @@ import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||||
import static google.registry.model.eppoutput.Result.Code.Success;
|
import static google.registry.model.eppoutput.Result.Code.Success;
|
||||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.exceptions.NotPendingTransferException;
|
import google.registry.flows.exceptions.NotPendingTransferException;
|
||||||
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
||||||
import google.registry.model.contact.ContactCommand.Transfer;
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.metadata.MetadataExtension;
|
import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
import google.registry.model.eppcommon.AuthInfo;
|
||||||
import google.registry.model.eppoutput.EppOutput;
|
import google.registry.model.eppoutput.EppOutput;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -49,8 +50,9 @@ import javax.inject.Inject;
|
||||||
*/
|
*/
|
||||||
public class ContactTransferRejectFlow extends LoggedInFlow implements TransactionalFlow {
|
public class ContactTransferRejectFlow extends LoggedInFlow implements TransactionalFlow {
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject @ClientId String clientId;
|
@Inject @ClientId String clientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject HistoryEntry.Builder historyBuilder;
|
@Inject HistoryEntry.Builder historyBuilder;
|
||||||
@Inject ContactTransferRejectFlow() {}
|
@Inject ContactTransferRejectFlow() {}
|
||||||
|
|
||||||
|
@ -61,15 +63,11 @@ public class ContactTransferRejectFlow extends LoggedInFlow implements Transacti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final EppOutput run() throws EppException {
|
protected final EppOutput run() throws EppException {
|
||||||
Transfer command = (Transfer) resourceCommand;
|
|
||||||
String targetId = command.getTargetId();
|
|
||||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||||
if (existingResource == null) {
|
if (existingResource == null) {
|
||||||
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
||||||
}
|
}
|
||||||
if (command.getAuthInfo() != null) {
|
verifyOptionalAuthInfoForResource(authInfo, existingResource);
|
||||||
verifyAuthInfoForResource(command.getAuthInfo(), existingResource);
|
|
||||||
}
|
|
||||||
if (existingResource.getTransferData().getTransferStatus() != TransferStatus.PENDING) {
|
if (existingResource.getTransferData().getTransferStatus() != TransferStatus.PENDING) {
|
||||||
throw new NotPendingTransferException(targetId);
|
throw new NotPendingTransferException(targetId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,18 +29,17 @@ import com.googlecode.objectify.Key;
|
||||||
import google.registry.config.ConfigModule.Config;
|
import google.registry.config.ConfigModule.Config;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.exceptions.AlreadyPendingTransferException;
|
import google.registry.flows.exceptions.AlreadyPendingTransferException;
|
||||||
import google.registry.flows.exceptions.MissingTransferRequestAuthInfoException;
|
import google.registry.flows.exceptions.MissingTransferRequestAuthInfoException;
|
||||||
import google.registry.flows.exceptions.ObjectAlreadySponsoredException;
|
import google.registry.flows.exceptions.ObjectAlreadySponsoredException;
|
||||||
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
import google.registry.flows.exceptions.ResourceToMutateDoesNotExistException;
|
||||||
import google.registry.model.contact.ContactCommand.Transfer;
|
|
||||||
import google.registry.model.contact.ContactResource;
|
import google.registry.model.contact.ContactResource;
|
||||||
import google.registry.model.domain.metadata.MetadataExtension;
|
import google.registry.model.domain.metadata.MetadataExtension;
|
||||||
import google.registry.model.eppcommon.AuthInfo;
|
import google.registry.model.eppcommon.AuthInfo;
|
||||||
import google.registry.model.eppcommon.StatusValue;
|
import google.registry.model.eppcommon.StatusValue;
|
||||||
import google.registry.model.eppinput.ResourceCommand;
|
|
||||||
import google.registry.model.eppoutput.EppOutput;
|
import google.registry.model.eppoutput.EppOutput;
|
||||||
import google.registry.model.poll.PollMessage;
|
import google.registry.model.poll.PollMessage;
|
||||||
import google.registry.model.reporting.HistoryEntry;
|
import google.registry.model.reporting.HistoryEntry;
|
||||||
|
@ -66,9 +65,9 @@ public class ContactTransferRequestFlow extends LoggedInFlow implements Transact
|
||||||
StatusValue.PENDING_DELETE,
|
StatusValue.PENDING_DELETE,
|
||||||
StatusValue.SERVER_TRANSFER_PROHIBITED);
|
StatusValue.SERVER_TRANSFER_PROHIBITED);
|
||||||
|
|
||||||
@Inject ResourceCommand resourceCommand;
|
|
||||||
@Inject Optional<AuthInfo> authInfo;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject @ClientId String gainingClientId;
|
@Inject @ClientId String gainingClientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject @Config("contactAutomaticTransferLength") Duration automaticTransferLength;
|
@Inject @Config("contactAutomaticTransferLength") Duration automaticTransferLength;
|
||||||
@Inject HistoryEntry.Builder historyBuilder;
|
@Inject HistoryEntry.Builder historyBuilder;
|
||||||
@Inject ContactTransferRequestFlow() {}
|
@Inject ContactTransferRequestFlow() {}
|
||||||
|
@ -80,8 +79,6 @@ public class ContactTransferRequestFlow extends LoggedInFlow implements Transact
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected final EppOutput run() throws EppException {
|
protected final EppOutput run() throws EppException {
|
||||||
Transfer command = (Transfer) resourceCommand;
|
|
||||||
String targetId = command.getTargetId();
|
|
||||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||||
if (existingResource == null) {
|
if (existingResource == null) {
|
||||||
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.google.common.collect.Sets;
|
||||||
import com.googlecode.objectify.Key;
|
import com.googlecode.objectify.Key;
|
||||||
import google.registry.flows.EppException;
|
import google.registry.flows.EppException;
|
||||||
import google.registry.flows.FlowModule.ClientId;
|
import google.registry.flows.FlowModule.ClientId;
|
||||||
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
import google.registry.flows.LoggedInFlow;
|
import google.registry.flows.LoggedInFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.exceptions.AddRemoveSameValueEppException;
|
import google.registry.flows.exceptions.AddRemoveSameValueEppException;
|
||||||
|
@ -73,6 +74,7 @@ public class ContactUpdateFlow extends LoggedInFlow implements TransactionalFlow
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject ResourceCommand resourceCommand;
|
||||||
@Inject Optional<AuthInfo> authInfo;
|
@Inject Optional<AuthInfo> authInfo;
|
||||||
@Inject @ClientId String clientId;
|
@Inject @ClientId String clientId;
|
||||||
|
@Inject @TargetId String targetId;
|
||||||
@Inject HistoryEntry.Builder historyBuilder;
|
@Inject HistoryEntry.Builder historyBuilder;
|
||||||
@Inject ContactUpdateFlow() {}
|
@Inject ContactUpdateFlow() {}
|
||||||
|
|
||||||
|
@ -84,7 +86,6 @@ public class ContactUpdateFlow extends LoggedInFlow implements TransactionalFlow
|
||||||
@Override
|
@Override
|
||||||
public final EppOutput run() throws EppException {
|
public final EppOutput run() throws EppException {
|
||||||
Update command = (Update) resourceCommand;
|
Update command = (Update) resourceCommand;
|
||||||
String targetId = command.getTargetId();
|
|
||||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||||
if (existingResource == null) {
|
if (existingResource == null) {
|
||||||
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue