Flatten the domain info flows

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133955573
This commit is contained in:
cgoldfeder 2016-09-22 08:20:06 -07:00 committed by Ben McIlwain
parent 1b34f1e326
commit a69fc769af
6 changed files with 157 additions and 66 deletions

View file

@ -15,6 +15,7 @@
package google.registry.flows;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Strings.nullToEmpty;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
@ -22,6 +23,7 @@ import dagger.Module;
import dagger.Provides;
import google.registry.flows.exceptions.OnlyToolCanPassMetadataException;
import google.registry.flows.picker.FlowPicker;
import google.registry.model.domain.launch.ApplicationIdTargetExtension;
import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.eppcommon.AuthInfo;
import google.registry.model.eppcommon.Trid;
@ -194,6 +196,15 @@ public class FlowModule {
return ((SingleResourceCommand) resourceCommand).getTargetId();
}
@Provides
@FlowScope
@ApplicationId
static String provideApplicationId(EppInput eppInput) {
// Treat a missing application id as empty so we can always inject a non-null value.
return nullToEmpty(
eppInput.getSingleExtension(ApplicationIdTargetExtension.class).getApplicationId());
}
@Provides
@FlowScope
@PollMessageId
@ -254,6 +265,11 @@ public class FlowModule {
@Documented
public @interface TargetId {}
/** Dagger qualifier for the application id for domain application flows. */
@Qualifier
@Documented
public @interface ApplicationId {}
/** Dagger qualifier for the message id for poll flows. */
@Qualifier
@Documented