mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 10:16:07 +02:00
Dagger, meet Flows. Flows, meet Dagger.
Daggerizes all of the EPP flows. This does not change anything yet about the flows themselves, just how they are invoked, but after this CL it's safe to @Inject things into flow classes. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125382478
This commit is contained in:
parent
116bf1f4d6
commit
c9a16f7f11
69 changed files with 973 additions and 292 deletions
|
@ -27,12 +27,17 @@ import google.registry.model.eppoutput.CheckData.ContactCheckData;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that checks whether a contact can be provisioned.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceCheckFlow.TooManyResourceChecksException}
|
||||
*/
|
||||
public class ContactCheckFlow extends ResourceCheckFlow<ContactResource, Check> {
|
||||
|
||||
@Inject ContactCheckFlow() {}
|
||||
|
||||
@Override
|
||||
protected CheckData getCheckData() {
|
||||
Set<String> existingIds = checkResourcesExist(resourceClass, targetIds, now);
|
||||
|
|
|
@ -29,6 +29,8 @@ import google.registry.model.eppoutput.EppOutput;
|
|||
import google.registry.model.ofy.ObjectifyService;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that creates a new contact resource.
|
||||
*
|
||||
|
@ -37,6 +39,9 @@ import google.registry.model.reporting.HistoryEntry;
|
|||
* @error {@link ContactFlowUtils.DeclineContactDisclosureFieldDisallowedPolicyException}
|
||||
*/
|
||||
public class ContactCreateFlow extends ResourceCreateFlow<ContactResource, Builder, Create> {
|
||||
|
||||
@Inject ContactCreateFlow() {}
|
||||
|
||||
@Override
|
||||
protected EppOutput getOutput() {
|
||||
return createOutput(Success, ContactCreateData.create(newResource.getContactId(), now));
|
||||
|
|
|
@ -36,6 +36,8 @@ import google.registry.model.contact.ContactResource.Builder;
|
|||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that deletes a contact resource.
|
||||
*
|
||||
|
@ -49,6 +51,8 @@ public class ContactDeleteFlow extends ResourceAsyncDeleteFlow<ContactResource,
|
|||
/** In {@link #isLinkedForFailfast}, check this (arbitrary) number of resources from the query. */
|
||||
private static final int FAILFAST_CHECK_COUNT = 5;
|
||||
|
||||
@Inject ContactDeleteFlow() {}
|
||||
|
||||
@Override
|
||||
protected boolean isLinkedForFailfast(final Ref<ContactResource> ref) {
|
||||
// Query for the first few linked domains, and if found, actually load them. The query is
|
||||
|
|
|
@ -18,10 +18,14 @@ import google.registry.flows.ResourceInfoFlow;
|
|||
import google.registry.model.contact.ContactCommand.Info;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that reads a contact.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceQueryFlow.ResourceToQueryDoesNotExistException}
|
||||
*/
|
||||
public class ContactInfoFlow extends ResourceInfoFlow<ContactResource, Info> {}
|
||||
public class ContactInfoFlow extends ResourceInfoFlow<ContactResource, Info> {
|
||||
@Inject ContactInfoFlow() {}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import google.registry.model.contact.ContactResource;
|
|||
import google.registry.model.contact.ContactResource.Builder;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that approves a pending transfer on a {@link ContactResource}.
|
||||
*
|
||||
|
@ -30,6 +32,9 @@ import google.registry.model.reporting.HistoryEntry;
|
|||
*/
|
||||
public class ContactTransferApproveFlow
|
||||
extends ResourceTransferApproveFlow<ContactResource, Builder, Transfer> {
|
||||
|
||||
@Inject ContactTransferApproveFlow() {}
|
||||
|
||||
@Override
|
||||
protected final HistoryEntry.Type getHistoryEntryType() {
|
||||
return HistoryEntry.Type.CONTACT_TRANSFER_APPROVE;
|
||||
|
|
|
@ -20,6 +20,8 @@ import google.registry.model.contact.ContactResource;
|
|||
import google.registry.model.contact.ContactResource.Builder;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that cancels a pending transfer on a {@link ContactResource}.
|
||||
*
|
||||
|
@ -30,6 +32,9 @@ import google.registry.model.reporting.HistoryEntry;
|
|||
*/
|
||||
public class ContactTransferCancelFlow
|
||||
extends ResourceTransferCancelFlow<ContactResource, Builder, Transfer> {
|
||||
|
||||
@Inject ContactTransferCancelFlow() {}
|
||||
|
||||
@Override
|
||||
protected final HistoryEntry.Type getHistoryEntryType() {
|
||||
return HistoryEntry.Type.CONTACT_TRANSFER_CANCEL;
|
||||
|
|
|
@ -18,6 +18,8 @@ import google.registry.flows.ResourceTransferQueryFlow;
|
|||
import google.registry.model.contact.ContactCommand.Transfer;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that queries a pending transfer on a {@link ContactResource}.
|
||||
*
|
||||
|
@ -27,4 +29,5 @@ import google.registry.model.contact.ContactResource;
|
|||
* @error {@link google.registry.flows.ResourceTransferQueryFlow.NotAuthorizedToViewTransferException}
|
||||
*/
|
||||
public class ContactTransferQueryFlow extends ResourceTransferQueryFlow<ContactResource, Transfer> {
|
||||
@Inject ContactTransferQueryFlow() {}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ import google.registry.model.contact.ContactResource;
|
|||
import google.registry.model.contact.ContactResource.Builder;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that rejects a pending transfer on a {@link ContactResource}.
|
||||
*
|
||||
|
@ -30,6 +32,9 @@ import google.registry.model.reporting.HistoryEntry;
|
|||
*/
|
||||
public class ContactTransferRejectFlow
|
||||
extends ResourceTransferRejectFlow<ContactResource, Builder, Transfer> {
|
||||
|
||||
@Inject ContactTransferRejectFlow() {}
|
||||
|
||||
@Override
|
||||
protected final HistoryEntry.Type getHistoryEntryType() {
|
||||
return HistoryEntry.Type.CONTACT_TRANSFER_REJECT;
|
||||
|
|
|
@ -22,6 +22,8 @@ import google.registry.model.reporting.HistoryEntry;
|
|||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that requests a transfer on a {@link ContactResource}.
|
||||
*
|
||||
|
@ -34,6 +36,8 @@ import org.joda.time.Duration;
|
|||
public class ContactTransferRequestFlow
|
||||
extends ResourceTransferRequestFlow<ContactResource, Transfer> {
|
||||
|
||||
@Inject ContactTransferRequestFlow() {}
|
||||
|
||||
@Override
|
||||
protected final HistoryEntry.Type getHistoryEntryType() {
|
||||
return HistoryEntry.Type.CONTACT_TRANSFER_REQUEST;
|
||||
|
|
|
@ -24,6 +24,8 @@ import google.registry.model.contact.ContactResource;
|
|||
import google.registry.model.contact.ContactResource.Builder;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that updates a contact resource.
|
||||
*
|
||||
|
@ -36,6 +38,9 @@ import google.registry.model.reporting.HistoryEntry;
|
|||
* @error {@link ContactFlowUtils.DeclineContactDisclosureFieldDisallowedPolicyException}
|
||||
*/
|
||||
public class ContactUpdateFlow extends ResourceUpdateFlow<ContactResource, Builder, Update> {
|
||||
|
||||
@Inject ContactUpdateFlow() {}
|
||||
|
||||
@Override
|
||||
protected void verifyNewUpdatedStateIsAllowed() throws EppException {
|
||||
validateAsciiPostalInfo(newResource.getInternationalizedPostalInfo());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue