Add extra flow logic hooks for info and update

This CL adds the hooks necessary to implement TLD-specific flow info and update flow logic. Usage of the hooks follows in a separate CL.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130108832
This commit is contained in:
mountford 2016-08-12 09:41:48 -07:00 committed by Ben McIlwain
parent e55ed209c5
commit 0066a03709
18 changed files with 397 additions and 16 deletions

View file

@ -16,6 +16,7 @@ package google.registry.flows.domain;
import static google.registry.flows.domain.DomainFlowUtils.handleFeeRequest;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException;
@ -23,9 +24,11 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.domain.DomainResource.Builder;
import google.registry.model.domain.fee06.FeeInfoCommandExtensionV06;
import google.registry.model.domain.fee06.FeeInfoResponseExtensionV06;
import google.registry.model.domain.flags.FlagsInfoResponseExtension;
import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.domain.rgp.RgpInfoExtension;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import java.util.List;
import javax.inject.Inject;
/**
@ -100,6 +103,17 @@ public class DomainInfoFlow extends BaseDomainInfoFlow<DomainResource, Builder>
now);
extensions.add(builder.build());
}
// If the TLD uses the flags extension, add it to the info response.
Optional<RegistryExtraFlowLogic> extraLogicManager =
RegistryExtraFlowLogicProxy.newInstanceForTld(existingResource.getTld());
if (extraLogicManager.isPresent()) {
List<String> flags = extraLogicManager.get().getFlags(
existingResource, this.getClientId(), now); // As-of date is always now for info commands.
if (!flags.isEmpty()) {
extensions.add(FlagsInfoResponseExtension.create(flags));
}
}
return extensions.build();
}
}