Inject two fields into flows.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125453450
This commit is contained in:
cgoldfeder 2016-06-21 08:23:37 -07:00 committed by Ben McIlwain
parent c9a16f7f11
commit 317e92d88c
3 changed files with 9 additions and 10 deletions

View file

@ -43,10 +43,8 @@ public abstract class Flow {
protected EppInput eppInput; protected EppInput eppInput;
protected SessionMetadata sessionMetadata; protected SessionMetadata sessionMetadata;
protected TransportCredentials credentials; protected TransportCredentials credentials;
protected EppRequestSource eppRequestSource;
protected Trid trid; protected Trid trid;
protected DateTime now; protected DateTime now;
protected byte[] inputXmlBytes;
/** Whether this flow is being run in a superuser mode that can skip some checks. */ /** Whether this flow is being run in a superuser mode that can skip some checks. */
protected boolean isSuperuser; protected boolean isSuperuser;
@ -104,18 +102,14 @@ public abstract class Flow {
Trid trid, Trid trid,
SessionMetadata sessionMetadata, SessionMetadata sessionMetadata,
TransportCredentials credentials, TransportCredentials credentials,
EppRequestSource eppRequestSource,
boolean isSuperuser, boolean isSuperuser,
DateTime now, DateTime now) throws EppException {
byte[] inputXmlBytes) throws EppException {
this.eppInput = eppInput; this.eppInput = eppInput;
this.trid = trid; this.trid = trid;
this.sessionMetadata = sessionMetadata; this.sessionMetadata = sessionMetadata;
this.credentials = credentials; this.credentials = credentials;
this.eppRequestSource = eppRequestSource;
this.now = now; this.now = now;
this.isSuperuser = isSuperuser; this.isSuperuser = isSuperuser;
this.inputXmlBytes = inputXmlBytes;
initFlow(); initFlow();
validExtensions = ImmutableSet.copyOf(validExtensions); validExtensions = ImmutableSet.copyOf(validExtensions);
return this; return this;

View file

@ -65,6 +65,7 @@ public class FlowRunner {
public EppOutput run() throws EppException { public EppOutput run() throws EppException {
String clientId = sessionMetadata.getClientId(); String clientId = sessionMetadata.getClientId();
// This log is very fragile since it's used for ICANN reporting.
logger.infofmt( logger.infofmt(
COMMAND_LOG_FORMAT, COMMAND_LOG_FORMAT,
trid.getServerTransactionId(), trid.getServerTransactionId(),
@ -123,10 +124,8 @@ public class FlowRunner {
trid, trid,
sessionMetadata, sessionMetadata,
credentials, credentials,
eppRequestSource,
isSuperuser, isSuperuser,
now, now);
inputXmlBytes);
} }
/** /**

View file

@ -20,6 +20,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
import com.googlecode.objectify.Key; import com.googlecode.objectify.Key;
import google.registry.flows.EppException.AuthorizationErrorException; import google.registry.flows.EppException.AuthorizationErrorException;
import google.registry.flows.FlowModule.InputXml;
import google.registry.model.EppResource; import google.registry.model.EppResource;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.metadata.MetadataExtension; 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.model.reporting.HistoryEntry;
import google.registry.util.TypeUtils.TypeInstantiator; import google.registry.util.TypeUtils.TypeInstantiator;
import javax.inject.Inject;
/** /**
* An EPP flow that creates or mutates a single stored resource. * An EPP flow that creates or mutates a single stored resource.
* *
@ -40,6 +43,9 @@ public abstract class ResourceCreateOrMutateFlow
<R extends EppResource, C extends SingleResourceCommand> extends SingleResourceFlow<R, C> <R extends EppResource, C extends SingleResourceCommand> extends SingleResourceFlow<R, C>
implements TransactionalFlow { implements TransactionalFlow {
@Inject EppRequestSource eppRequestSource;
@Inject @InputXml byte[] inputXmlBytes;
String repoId; String repoId;
protected R newResource; protected R newResource;
protected HistoryEntry historyEntry; protected HistoryEntry historyEntry;