From 317e92d88c0df2ad9ecced9360c4e14808fa0c51 Mon Sep 17 00:00:00 2001 From: cgoldfeder Date: Tue, 21 Jun 2016 08:23:37 -0700 Subject: [PATCH] Inject two fields into flows. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125453450 --- java/google/registry/flows/Flow.java | 8 +------- java/google/registry/flows/FlowRunner.java | 5 ++--- .../google/registry/flows/ResourceCreateOrMutateFlow.java | 6 ++++++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/java/google/registry/flows/Flow.java b/java/google/registry/flows/Flow.java index b56325c50..d3380138b 100644 --- a/java/google/registry/flows/Flow.java +++ b/java/google/registry/flows/Flow.java @@ -43,10 +43,8 @@ public abstract class Flow { protected EppInput eppInput; protected SessionMetadata sessionMetadata; protected TransportCredentials credentials; - protected EppRequestSource eppRequestSource; protected Trid trid; protected DateTime now; - protected byte[] inputXmlBytes; /** Whether this flow is being run in a superuser mode that can skip some checks. */ protected boolean isSuperuser; @@ -104,18 +102,14 @@ public abstract class Flow { Trid trid, SessionMetadata sessionMetadata, TransportCredentials credentials, - EppRequestSource eppRequestSource, boolean isSuperuser, - DateTime now, - byte[] inputXmlBytes) throws EppException { + DateTime now) throws EppException { this.eppInput = eppInput; this.trid = trid; this.sessionMetadata = sessionMetadata; this.credentials = credentials; - this.eppRequestSource = eppRequestSource; this.now = now; this.isSuperuser = isSuperuser; - this.inputXmlBytes = inputXmlBytes; initFlow(); validExtensions = ImmutableSet.copyOf(validExtensions); return this; diff --git a/java/google/registry/flows/FlowRunner.java b/java/google/registry/flows/FlowRunner.java index 6d6c8778e..fc758fb15 100644 --- a/java/google/registry/flows/FlowRunner.java +++ b/java/google/registry/flows/FlowRunner.java @@ -65,6 +65,7 @@ public class FlowRunner { public EppOutput run() throws EppException { String clientId = sessionMetadata.getClientId(); + // This log is very fragile since it's used for ICANN reporting. logger.infofmt( COMMAND_LOG_FORMAT, trid.getServerTransactionId(), @@ -123,10 +124,8 @@ public class FlowRunner { trid, sessionMetadata, credentials, - eppRequestSource, isSuperuser, - now, - inputXmlBytes); + now); } /** diff --git a/java/google/registry/flows/ResourceCreateOrMutateFlow.java b/java/google/registry/flows/ResourceCreateOrMutateFlow.java index 02c196c89..c6ad331d0 100644 --- a/java/google/registry/flows/ResourceCreateOrMutateFlow.java +++ b/java/google/registry/flows/ResourceCreateOrMutateFlow.java @@ -20,6 +20,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy; import com.googlecode.objectify.Key; import google.registry.flows.EppException.AuthorizationErrorException; +import google.registry.flows.FlowModule.InputXml; import google.registry.model.EppResource; import google.registry.model.domain.Period; import google.registry.model.domain.metadata.MetadataExtension; @@ -28,6 +29,8 @@ import google.registry.model.eppoutput.EppOutput; import google.registry.model.reporting.HistoryEntry; import google.registry.util.TypeUtils.TypeInstantiator; +import javax.inject.Inject; + /** * An EPP flow that creates or mutates a single stored resource. * @@ -40,6 +43,9 @@ public abstract class ResourceCreateOrMutateFlow extends SingleResourceFlow implements TransactionalFlow { + @Inject EppRequestSource eppRequestSource; + @Inject @InputXml byte[] inputXmlBytes; + String repoId; protected R newResource; protected HistoryEntry historyEntry;