Simplify the fee extensions.

I added shared base classes to all of the Fee extension types that
make it possible to fully ignore the version in the flows. (You
ask for a FeeCreateCommandExtension, for example, and you get one
without having to worry about which). This is an improvement over
the old code that asked you to provide a list of possible fee
extensions and then ask for the first one in preference order.

As part of this I was able to make the Fee implementation a bit
simpler as well.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137992390
This commit is contained in:
cgoldfeder 2016-11-02 14:18:47 -07:00 committed by Ben McIlwain
parent 2dd703ef3a
commit 8256120b3a
66 changed files with 786 additions and 954 deletions

View file

@ -14,12 +14,16 @@
package google.registry.flows; package google.registry.flows;
import static com.google.common.collect.Iterables.any;
import static com.google.common.collect.Sets.difference; import static com.google.common.collect.Sets.difference;
import static com.google.common.collect.Sets.intersection; import static com.google.common.collect.Sets.intersection;
import static google.registry.model.domain.fee.Fee.FEE_EXTENSION_URIS; import static google.registry.model.domain.fee.Fee.FEE_EXTENSION_URIS;
import static google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension.getCommandExtensionUri; import static google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension.getCommandExtensionUri;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import google.registry.flows.EppException.CommandUseErrorException; import google.registry.flows.EppException.CommandUseErrorException;
import google.registry.flows.EppException.SyntaxErrorException; import google.registry.flows.EppException.SyntaxErrorException;
@ -30,7 +34,6 @@ import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.eppinput.EppInput; import google.registry.model.eppinput.EppInput;
import google.registry.model.eppinput.EppInput.CommandExtension; import google.registry.model.eppinput.EppInput.CommandExtension;
import google.registry.util.FormattingLogger; import google.registry.util.FormattingLogger;
import java.util.Collection;
import java.util.Set; import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
@ -49,8 +52,6 @@ public final class ExtensionManager {
private final ImmutableSet.Builder<Class<? extends CommandExtension>> implementedBuilder = private final ImmutableSet.Builder<Class<? extends CommandExtension>> implementedBuilder =
new ImmutableSet.Builder<>(); new ImmutableSet.Builder<>();
private final ImmutableSet.Builder<ImmutableSet<?>> implementedGroupsBuilder =
new ImmutableSet.Builder<>();
@Inject EppInput eppInput; @Inject EppInput eppInput;
@Inject SessionMetadata sessionMetadata; @Inject SessionMetadata sessionMetadata;
@ -64,12 +65,6 @@ public final class ExtensionManager {
implementedBuilder.add(extension); implementedBuilder.add(extension);
} }
public <T extends CommandExtension> void registerAsGroup(
Collection<Class<? extends T>> extensions) {
implementedBuilder.addAll(extensions);
implementedGroupsBuilder.add(ImmutableSet.copyOf(extensions));
}
public void validate() throws EppException { public void validate() throws EppException {
ImmutableSet.Builder<Class<? extends CommandExtension>> suppliedBuilder = ImmutableSet.Builder<Class<? extends CommandExtension>> suppliedBuilder =
new ImmutableSet.Builder<>(); new ImmutableSet.Builder<>();
@ -79,27 +74,12 @@ public final class ExtensionManager {
ImmutableSet<Class<? extends CommandExtension>> suppliedExtensions = suppliedBuilder.build(); ImmutableSet<Class<? extends CommandExtension>> suppliedExtensions = suppliedBuilder.build();
ImmutableSet<Class<? extends CommandExtension>> implementedExtensions = ImmutableSet<Class<? extends CommandExtension>> implementedExtensions =
implementedBuilder.build(); implementedBuilder.build();
ImmutableSet<ImmutableSet<?>> implementedExtensionGroups = ImmutableList<CommandExtension> suppliedExtensionInstances =
implementedGroupsBuilder.build(); eppInput.getCommandWrapper().getExtensions();
checkForDuplicateExtensions(suppliedExtensions, implementedExtensionGroups);
checkForUndeclaredExtensions(suppliedExtensions); checkForUndeclaredExtensions(suppliedExtensions);
checkForRestrictedExtensions(suppliedExtensions); checkForRestrictedExtensions(suppliedExtensions);
checkForUnimplementedExtensions(suppliedExtensions, implementedExtensions); checkForDuplicateExtensions(suppliedExtensionInstances, suppliedExtensions);
} checkForUnimplementedExtensions(suppliedExtensionInstances, implementedExtensions);
private void checkForDuplicateExtensions(
ImmutableSet<Class<? extends CommandExtension>> suppliedExtensions,
ImmutableSet<ImmutableSet<?>> implementedExtensionGroups)
throws UnsupportedRepeatedExtensionException {
if (suppliedExtensions.size() < eppInput.getCommandWrapper().getExtensions().size()) {
throw new UnsupportedRepeatedExtensionException();
}
// No more than one extension in an extension group can be present.
for (ImmutableSet<?> group : implementedExtensionGroups) {
if (intersection(suppliedExtensions, group).size() > 1) {
throw new UnsupportedRepeatedExtensionException();
}
}
} }
private void checkForUndeclaredExtensions( private void checkForUndeclaredExtensions(
@ -134,22 +114,39 @@ public final class ExtensionManager {
} }
} }
private void checkForUnimplementedExtensions( private static void checkForDuplicateExtensions(
ImmutableSet<Class<? extends CommandExtension>> suppliedExtensions, ImmutableList<CommandExtension> suppliedExtensionInstances,
ImmutableSet<Class<? extends CommandExtension>> implementedExtensions) ImmutableSet<Class<? extends CommandExtension>> implementedExtensions)
throws UnimplementedExtensionException { throws UnsupportedRepeatedExtensionException {
Set<Class<? extends CommandExtension>> unimplementedExtensions = for (Class<? extends CommandExtension> implemented : implementedExtensions) {
difference(suppliedExtensions, implementedExtensions); if (FluentIterable.from(suppliedExtensionInstances).filter(implemented).size() > 1) {
if (!unimplementedExtensions.isEmpty()) { throw new UnsupportedRepeatedExtensionException();
logger.infofmt("Unimplemented extensions: %s", unimplementedExtensions); }
throw new UnimplementedExtensionException();
} }
} }
/** Unsupported repetition of an extension. */ private static void checkForUnimplementedExtensions(
static class UnsupportedRepeatedExtensionException extends SyntaxErrorException { ImmutableList<CommandExtension> suppliedExtensionInstances,
public UnsupportedRepeatedExtensionException() { ImmutableSet<Class<? extends CommandExtension>> implementedExtensionClasses)
super("Unsupported repetition of an extension"); throws UnimplementedExtensionException {
ImmutableSet.Builder<Class<? extends CommandExtension>> unimplementedExtensionsBuilder =
new ImmutableSet.Builder<>();
for (final CommandExtension instance : suppliedExtensionInstances) {
if (!any(
implementedExtensionClasses,
new Predicate<Class<? extends CommandExtension>>() {
@Override
public boolean apply(Class<? extends CommandExtension> implementedExtensionClass) {
return implementedExtensionClass.isInstance(instance);
}})) {
unimplementedExtensionsBuilder.add(instance.getClass());
}
}
ImmutableSet<Class<? extends CommandExtension>> unimplementedExtensions =
unimplementedExtensionsBuilder.build();
if (!unimplementedExtensions.isEmpty()) {
logger.infofmt("Unimplemented extensions: %s", unimplementedExtensions);
throw new UnimplementedExtensionException();
} }
} }
@ -160,4 +157,11 @@ public final class ExtensionManager {
Joiner.on(", ").join(undeclaredUris))); Joiner.on(", ").join(undeclaredUris)));
} }
} }
/** Unsupported repetition of an extension. */
static class UnsupportedRepeatedExtensionException extends SyntaxErrorException {
public UnsupportedRepeatedExtensionException() {
super("Unsupported repetition of an extension");
}
}
} }

View file

@ -30,7 +30,6 @@ import static google.registry.flows.domain.DomainFlowUtils.validateSecDnsExtensi
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears; import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
import static google.registry.model.EppResourceUtils.createDomainRoid; import static google.registry.model.EppResourceUtils.createDomainRoid;
import static google.registry.model.EppResourceUtils.loadDomainApplication; import static google.registry.model.EppResourceUtils.loadDomainApplication;
import static google.registry.model.domain.fee.Fee.FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation; import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
import static google.registry.pricing.PricingEngineProxy.getDomainCreateCost; import static google.registry.pricing.PricingEngineProxy.getDomainCreateCost;
@ -63,7 +62,7 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod; import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.allocate.AllocateCreateExtension; import google.registry.model.domain.allocate.AllocateCreateExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeCreateCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.flags.FlagsCreateCommandExtension; import google.registry.model.domain.flags.FlagsCreateCommandExtension;
import google.registry.model.domain.launch.ApplicationStatus; import google.registry.model.domain.launch.ApplicationStatus;
@ -118,11 +117,11 @@ public class DomainAllocateFlow implements TransactionalFlow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register( extensionManager.register(
FeeCreateCommandExtension.class,
SecDnsCreateExtension.class, SecDnsCreateExtension.class,
FlagsCreateCommandExtension.class, FlagsCreateCommandExtension.class,
MetadataExtension.class, MetadataExtension.class,
AllocateCreateExtension.class); AllocateCreateExtension.class);
extensionManager.registerAsGroup(FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
verifyIsSuperuser(); verifyIsSuperuser();
@ -374,8 +373,8 @@ public class DomainAllocateFlow implements TransactionalFlow {
DateTime now, Registry registry, int years) throws EppException { DateTime now, Registry registry, int years) throws EppException {
EppCommandOperations commandOperations = TldSpecificLogicProxy.getCreatePrice( EppCommandOperations commandOperations = TldSpecificLogicProxy.getCreatePrice(
registry, targetId, clientId, now, years, eppInput); registry, targetId, clientId, now, years, eppInput);
FeeTransformCommandExtension feeCreate = FeeCreateCommandExtension feeCreate =
eppInput.getFirstExtensionOfClasses(FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeCreateCommandExtension.class);
return (feeCreate == null) return (feeCreate == null)
? null ? null
: ImmutableList.of(createFeeCreateResponse(feeCreate, commandOperations)); : ImmutableList.of(createFeeCreateResponse(feeCreate, commandOperations));

View file

@ -38,7 +38,6 @@ import static google.registry.flows.domain.DomainFlowUtils.verifyRegistryStateAl
import static google.registry.flows.domain.DomainFlowUtils.verifySignedMarks; import static google.registry.flows.domain.DomainFlowUtils.verifySignedMarks;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears; import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
import static google.registry.model.EppResourceUtils.createDomainRoid; import static google.registry.model.EppResourceUtils.createDomainRoid;
import static google.registry.model.domain.fee.Fee.FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName; import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation; import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
@ -65,6 +64,7 @@ import google.registry.model.domain.DomainApplication;
import google.registry.model.domain.DomainCommand.Create; import google.registry.model.domain.DomainCommand.Create;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeCreateCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.flags.FlagsCreateCommandExtension; import google.registry.model.domain.flags.FlagsCreateCommandExtension;
import google.registry.model.domain.launch.ApplicationStatus; import google.registry.model.domain.launch.ApplicationStatus;
@ -172,11 +172,11 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register( extensionManager.register(
FeeCreateCommandExtension.class,
SecDnsCreateExtension.class, SecDnsCreateExtension.class,
FlagsCreateCommandExtension.class, FlagsCreateCommandExtension.class,
MetadataExtension.class, MetadataExtension.class,
LaunchCreateExtension.class); LaunchCreateExtension.class);
extensionManager.registerAsGroup(FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();
@ -212,8 +212,8 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
verifyNotReserved(domainName, isSunriseApplication); verifyNotReserved(domainName, isSunriseApplication);
} }
} }
FeeTransformCommandExtension feeCreate = FeeCreateCommandExtension feeCreate =
eppInput.getFirstExtensionOfClasses(FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeCreateCommandExtension.class);
validateFeeChallenge(targetId, tld, now, feeCreate, commandOperations.getTotalCost()); validateFeeChallenge(targetId, tld, now, feeCreate, commandOperations.getTotalCost());
SecDnsCreateExtension secDnsCreate = SecDnsCreateExtension secDnsCreate =
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class)); validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));

View file

@ -39,7 +39,6 @@ import static google.registry.flows.domain.DomainFlowUtils.verifyApplicationDoma
import static google.registry.flows.domain.DomainFlowUtils.verifyClientUpdateNotProhibited; import static google.registry.flows.domain.DomainFlowUtils.verifyClientUpdateNotProhibited;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete; import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete;
import static google.registry.model.EppResourceUtils.loadDomainApplication; import static google.registry.model.EppResourceUtils.loadDomainApplication;
import static google.registry.model.domain.fee.Fee.FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Optional; import com.google.common.base.Optional;
@ -138,7 +137,6 @@ public class DomainApplicationUpdateFlow implements TransactionalFlow {
LaunchUpdateExtension.class, LaunchUpdateExtension.class,
MetadataExtension.class, MetadataExtension.class,
SecDnsUpdateExtension.class); SecDnsUpdateExtension.class);
extensionManager.registerAsGroup(FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();

View file

@ -23,7 +23,6 @@ import static google.registry.flows.domain.DomainFlowUtils.validateDomainName;
import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables; import static google.registry.flows.domain.DomainFlowUtils.validateDomainNameWithIdnTables;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPredelegation; import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPredelegation;
import static google.registry.model.EppResourceUtils.checkResourcesExist; import static google.registry.model.EppResourceUtils.checkResourcesExist;
import static google.registry.model.domain.fee.Fee.FEE_CHECK_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName; import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.registry.label.ReservationType.UNRESERVED; import static google.registry.model.registry.label.ReservationType.UNRESERVED;
import static google.registry.pricing.PricingEngineProxy.isDomainPremium; import static google.registry.pricing.PricingEngineProxy.isDomainPremium;
@ -111,8 +110,7 @@ public final class DomainCheckFlow implements Flow {
@Override @Override
public EppResponse run() throws EppException { public EppResponse run() throws EppException {
extensionManager.register(LaunchCheckExtension.class); extensionManager.register(FeeCheckCommandExtension.class, LaunchCheckExtension.class);
extensionManager.registerAsGroup(FEE_CHECK_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
List<String> targetIds = ((Check) resourceCommand).getTargetIds(); List<String> targetIds = ((Check) resourceCommand).getTargetIds();
@ -177,7 +175,7 @@ public final class DomainCheckFlow implements Flow {
private ImmutableList<? extends ResponseExtension> getResponseExtensions( private ImmutableList<? extends ResponseExtension> getResponseExtensions(
ImmutableMap<String, InternetDomainName> domainNames, DateTime now) throws EppException { ImmutableMap<String, InternetDomainName> domainNames, DateTime now) throws EppException {
FeeCheckCommandExtension<?, ?> feeCheck = FeeCheckCommandExtension<?, ?> feeCheck =
eppInput.getFirstExtensionOfClasses(FEE_CHECK_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeCheckCommandExtension.class);
if (feeCheck == null) { if (feeCheck == null) {
return null; // No fee checks were requested. return null; // No fee checks were requested.
} }
@ -185,7 +183,7 @@ public final class DomainCheckFlow implements Flow {
new ImmutableList.Builder<>(); new ImmutableList.Builder<>();
for (FeeCheckCommandExtensionItem feeCheckItem : feeCheck.getItems()) { for (FeeCheckCommandExtensionItem feeCheckItem : feeCheck.getItems()) {
for (String domainName : getDomainNamesToCheckForFee(feeCheckItem, domainNames.keySet())) { for (String domainName : getDomainNamesToCheckForFee(feeCheckItem, domainNames.keySet())) {
FeeCheckResponseExtensionItem.Builder builder = feeCheckItem.createResponseBuilder(); FeeCheckResponseExtensionItem.Builder<?> builder = feeCheckItem.createResponseBuilder();
handleFeeRequest( handleFeeRequest(
feeCheckItem, feeCheckItem,
builder, builder,

View file

@ -36,7 +36,6 @@ import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNo
import static google.registry.flows.domain.DomainFlowUtils.verifySignedMarks; import static google.registry.flows.domain.DomainFlowUtils.verifySignedMarks;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears; import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
import static google.registry.model.EppResourceUtils.createDomainRoid; import static google.registry.model.EppResourceUtils.createDomainRoid;
import static google.registry.model.domain.fee.Fee.FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName; import static google.registry.model.index.DomainApplicationIndex.loadActiveApplicationsByDomainName;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation; import static google.registry.model.registry.label.ReservedList.matchesAnchorTenantReservation;
@ -70,7 +69,7 @@ import google.registry.model.domain.DomainCommand.Create;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod; import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeCreateCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.flags.FlagsCreateCommandExtension; import google.registry.model.domain.flags.FlagsCreateCommandExtension;
import google.registry.model.domain.launch.LaunchCreateExtension; import google.registry.model.domain.launch.LaunchCreateExtension;
@ -168,11 +167,11 @@ public class DomainCreateFlow implements TransactionalFlow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register( extensionManager.register(
FeeCreateCommandExtension.class,
SecDnsCreateExtension.class, SecDnsCreateExtension.class,
FlagsCreateCommandExtension.class, FlagsCreateCommandExtension.class,
MetadataExtension.class, MetadataExtension.class,
LaunchCreateExtension.class); LaunchCreateExtension.class);
extensionManager.registerAsGroup(FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();
@ -199,8 +198,8 @@ public class DomainCreateFlow implements TransactionalFlow {
if (hasSignedMarks) { if (hasSignedMarks) {
verifySignedMarksAllowed(tldState, isAnchorTenant); verifySignedMarksAllowed(tldState, isAnchorTenant);
} }
FeeTransformCommandExtension feeCreate = FeeCreateCommandExtension feeCreate =
eppInput.getFirstExtensionOfClasses(FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeCreateCommandExtension.class);
EppCommandOperations commandOperations = TldSpecificLogicProxy.getCreatePrice( EppCommandOperations commandOperations = TldSpecificLogicProxy.getCreatePrice(
registry, targetId, clientId, now, years, eppInput); registry, targetId, clientId, now, years, eppInput);
validateFeeChallenge( validateFeeChallenge(
@ -423,7 +422,7 @@ public class DomainCreateFlow implements TransactionalFlow {
} }
private ImmutableList<FeeTransformResponseExtension> createResponseExtensions( private ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
FeeTransformCommandExtension feeCreate, EppCommandOperations commandOperations) { FeeCreateCommandExtension feeCreate, EppCommandOperations commandOperations) {
return (feeCreate == null) return (feeCreate == null)
? null ? null
: ImmutableList.of(createFeeCreateResponse(feeCreate, commandOperations)); : ImmutableList.of(createFeeCreateResponse(feeCreate, commandOperations));

View file

@ -584,7 +584,7 @@ public class DomainFlowUtils {
*/ */
static void handleFeeRequest( static void handleFeeRequest(
FeeQueryCommandExtensionItem feeRequest, FeeQueryCommandExtensionItem feeRequest,
FeeQueryResponseExtensionItem.Builder builder, FeeQueryResponseExtensionItem.Builder<?, ?> builder,
InternetDomainName domain, InternetDomainName domain,
String clientId, String clientId,
@Nullable CurrencyUnit topLevelCurrency, @Nullable CurrencyUnit topLevelCurrency,
@ -617,7 +617,7 @@ public class DomainFlowUtils {
.setPeriod(feeRequest.getPeriod()) .setPeriod(feeRequest.getPeriod())
.setClass(TldSpecificLogicProxy.getFeeClass(domainNameString, now).orNull()); .setClass(TldSpecificLogicProxy.getFeeClass(domainNameString, now).orNull());
List<Fee> fees = ImmutableList.of(); ImmutableList<Fee> fees = ImmutableList.of();
switch (feeRequest.getCommandName()) { switch (feeRequest.getCommandName()) {
case CREATE: case CREATE:
if (isReserved(domain, isSunrise)) { // Don't return a create price for reserved names. if (isReserved(domain, isSunrise)) { // Don't return a create price for reserved names.

View file

@ -27,7 +27,6 @@ import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears; import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
import static google.registry.model.domain.DomainResource.MAX_REGISTRATION_YEARS; import static google.registry.model.domain.DomainResource.MAX_REGISTRATION_YEARS;
import static google.registry.model.domain.DomainResource.extendRegistrationWithCap; import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
import static google.registry.model.domain.fee.Fee.FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.DateTimeUtils.leapSafeAddYears; import static google.registry.util.DateTimeUtils.leapSafeAddYears;
@ -53,7 +52,7 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod; import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.fee.BaseFee.FeeType; import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeRenewCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
@ -117,8 +116,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class); extensionManager.register(FeeRenewCommandExtension.class, MetadataExtension.class);
extensionManager.registerAsGroup(FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();
@ -127,8 +125,8 @@ public final class DomainRenewFlow implements TransactionalFlow {
DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now); DomainResource existingDomain = loadAndVerifyExistence(DomainResource.class, targetId, now);
verifyRenewAllowed(authInfo, existingDomain, command); verifyRenewAllowed(authInfo, existingDomain, command);
int years = command.getPeriod().getValue(); int years = command.getPeriod().getValue();
FeeTransformCommandExtension feeRenew = FeeRenewCommandExtension feeRenew =
eppInput.getFirstExtensionOfClasses(FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeRenewCommandExtension.class);
EppCommandOperations commandOperations = TldSpecificLogicProxy.getRenewPrice( EppCommandOperations commandOperations = TldSpecificLogicProxy.getRenewPrice(
Registry.get(existingDomain.getTld()), targetId, clientId, now, years, eppInput); Registry.get(existingDomain.getTld()), targetId, clientId, now, years, eppInput);
validateFeeChallenge( validateFeeChallenge(
@ -217,7 +215,7 @@ public final class DomainRenewFlow implements TransactionalFlow {
} }
private ImmutableList<FeeTransformResponseExtension> createResponseExtensions( private ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
Money renewCost, FeeTransformCommandExtension feeRenew) { Money renewCost, FeeRenewCommandExtension feeRenew) {
return (feeRenew == null) ? null : ImmutableList.of(feeRenew return (feeRenew == null) ? null : ImmutableList.of(feeRenew
.createResponseBuilder() .createResponseBuilder()
.setCurrency(renewCost.getCurrencyUnit()) .setCurrency(renewCost.getCurrencyUnit())

View file

@ -25,7 +25,6 @@ import static google.registry.flows.domain.DomainFlowUtils.newAutorenewPollMessa
import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge; import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotReserved; import static google.registry.flows.domain.DomainFlowUtils.verifyNotReserved;
import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked; import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked;
import static google.registry.model.domain.fee.Fee.FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
@ -53,8 +52,8 @@ import google.registry.model.domain.DomainCommand.Update;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.domain.fee.BaseFee.FeeType; import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.fee.FeeUpdateCommandExtension;
import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
import google.registry.model.domain.rgp.RgpUpdateExtension; import google.registry.model.domain.rgp.RgpUpdateExtension;
@ -119,8 +118,10 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(MetadataExtension.class, RgpUpdateExtension.class); extensionManager.register(
extensionManager.registerAsGroup(FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); FeeUpdateCommandExtension.class,
MetadataExtension.class,
RgpUpdateExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
Update command = (Update) resourceCommand; Update command = (Update) resourceCommand;
@ -129,8 +130,8 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
Money restoreCost = Registry.get(existingDomain.getTld()).getStandardRestoreCost(); Money restoreCost = Registry.get(existingDomain.getTld()).getStandardRestoreCost();
EppCommandOperations renewCommandOperations = TldSpecificLogicProxy.getRenewPrice( EppCommandOperations renewCommandOperations = TldSpecificLogicProxy.getRenewPrice(
Registry.get(existingDomain.getTld()), targetId, clientId, now, 1, eppInput); Registry.get(existingDomain.getTld()), targetId, clientId, now, 1, eppInput);
FeeTransformCommandExtension feeUpdate = eppInput.getFirstExtensionOfClasses( FeeUpdateCommandExtension feeUpdate =
FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
Money totalCost = renewCommandOperations.getTotalCost(); Money totalCost = renewCommandOperations.getTotalCost();
verifyRestoreAllowed(command, existingDomain, restoreCost, totalCost, feeUpdate, now); verifyRestoreAllowed(command, existingDomain, restoreCost, totalCost, feeUpdate, now);
HistoryEntry historyEntry = buildHistory(existingDomain, now); HistoryEntry historyEntry = buildHistory(existingDomain, now);
@ -184,7 +185,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
DomainResource existingDomain, DomainResource existingDomain,
Money restoreCost, Money restoreCost,
Money renewCost, Money renewCost,
FeeTransformCommandExtension feeUpdate, FeeUpdateCommandExtension feeUpdate,
DateTime now) throws EppException { DateTime now) throws EppException {
verifyOptionalAuthInfo(authInfo, existingDomain); verifyOptionalAuthInfo(authInfo, existingDomain);
if (!isSuperuser) { if (!isSuperuser) {
@ -258,7 +259,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
} }
private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions( private static ImmutableList<FeeTransformResponseExtension> createResponseExtensions(
Money restoreCost, Money renewCost, FeeTransformCommandExtension feeUpdate) { Money restoreCost, Money renewCost, FeeUpdateCommandExtension feeUpdate) {
return (feeUpdate == null) ? null : ImmutableList.of( return (feeUpdate == null) ? null : ImmutableList.of(
feeUpdate.createResponseBuilder() feeUpdate.createResponseBuilder()
.setCurrency(restoreCost.getCurrencyUnit()) .setCurrency(restoreCost.getCurrencyUnit())

View file

@ -30,7 +30,6 @@ import static google.registry.flows.domain.DomainFlowUtils.validateFeeChallenge;
import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked; import static google.registry.flows.domain.DomainFlowUtils.verifyPremiumNameIsNotBlocked;
import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears; import static google.registry.flows.domain.DomainFlowUtils.verifyUnitIsYears;
import static google.registry.model.domain.DomainResource.extendRegistrationWithCap; import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
import static google.registry.model.domain.fee.Fee.FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING; import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost; import static google.registry.pricing.PricingEngineProxy.getDomainRenewCost;
@ -56,7 +55,7 @@ import google.registry.model.domain.DomainResource;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.BaseFee.FeeType; import google.registry.model.domain.fee.BaseFee.FeeType;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeTransferCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.flags.FlagsTransferCommandExtension; import google.registry.model.domain.flags.FlagsTransferCommandExtension;
import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.domain.metadata.MetadataExtension;
@ -130,8 +129,10 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
@Override @Override
public final EppResponse run() throws EppException { public final EppResponse run() throws EppException {
extensionManager.register(FlagsTransferCommandExtension.class, MetadataExtension.class); extensionManager.register(
extensionManager.registerAsGroup(FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); FeeTransferCommandExtension.class,
FlagsTransferCommandExtension.class,
MetadataExtension.class);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(gainingClientId); validateClientIsLoggedIn(gainingClientId);
Period period = ((Transfer) resourceCommand).getPeriod(); Period period = ((Transfer) resourceCommand).getPeriod();
@ -144,8 +145,8 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
// The cost of the renewal implied by a transfer. // The cost of the renewal implied by a transfer.
Money renewCost = getDomainRenewCost(targetId, now, years); Money renewCost = getDomainRenewCost(targetId, now, years);
// An optional extension from the client specifying what they think the transfer should cost. // An optional extension from the client specifying what they think the transfer should cost.
FeeTransformCommandExtension feeTransfer = eppInput.getFirstExtensionOfClasses( FeeTransferCommandExtension feeTransfer =
FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeTransferCommandExtension.class);
validateFeeChallenge(targetId, tld, now, feeTransfer, renewCost); validateFeeChallenge(targetId, tld, now, feeTransfer, renewCost);
HistoryEntry historyEntry = buildHistory(period, existingDomain, now); HistoryEntry historyEntry = buildHistory(period, existingDomain, now);
DateTime automaticTransferTime = now.plus(registry.getAutomaticTransferLength()); DateTime automaticTransferTime = now.plus(registry.getAutomaticTransferLength());
@ -405,7 +406,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
} }
private ImmutableList<FeeTransformResponseExtension> createResponseExtensions(Money renewCost, private ImmutableList<FeeTransformResponseExtension> createResponseExtensions(Money renewCost,
FeeTransformCommandExtension feeTransfer) { FeeTransferCommandExtension feeTransfer) {
return feeTransfer == null return feeTransfer == null
? null ? null
: ImmutableList.of(feeTransfer.createResponseBuilder() : ImmutableList.of(feeTransfer.createResponseBuilder()

View file

@ -37,7 +37,6 @@ import static google.registry.flows.domain.DomainFlowUtils.validateRegistrantAll
import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent; import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresent;
import static google.registry.flows.domain.DomainFlowUtils.verifyClientUpdateNotProhibited; import static google.registry.flows.domain.DomainFlowUtils.verifyClientUpdateNotProhibited;
import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete; import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete;
import static google.registry.model.domain.fee.Fee.FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.DateTimeUtils.earliestOf; import static google.registry.util.DateTimeUtils.earliestOf;
@ -63,6 +62,7 @@ import google.registry.model.domain.DomainCommand.Update.Change;
import google.registry.model.domain.DomainResource; import google.registry.model.domain.DomainResource;
import google.registry.model.domain.GracePeriod; import google.registry.model.domain.GracePeriod;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeUpdateCommandExtension;
import google.registry.model.domain.flags.FlagsUpdateCommandExtension; import google.registry.model.domain.flags.FlagsUpdateCommandExtension;
import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.domain.metadata.MetadataExtension;
import google.registry.model.domain.rgp.GracePeriodStatus; import google.registry.model.domain.rgp.GracePeriodStatus;
@ -147,10 +147,10 @@ public final class DomainUpdateFlow implements TransactionalFlow {
@Override @Override
public EppResponse run() throws EppException { public EppResponse run() throws EppException {
extensionManager.register( extensionManager.register(
FeeUpdateCommandExtension.class,
FlagsUpdateCommandExtension.class, FlagsUpdateCommandExtension.class,
MetadataExtension.class, MetadataExtension.class,
SecDnsUpdateExtension.class); SecDnsUpdateExtension.class);
extensionManager.registerAsGroup(FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER);
extensionManager.validate(); extensionManager.validate();
validateClientIsLoggedIn(clientId); validateClientIsLoggedIn(clientId);
DateTime now = ofy().getTransactionTime(); DateTime now = ofy().getTransactionTime();
@ -201,7 +201,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
Registry.get(tld), targetId, clientId, now, eppInput); Registry.get(tld), targetId, clientId, now, eppInput);
FeeTransformCommandExtension feeUpdate = FeeTransformCommandExtension feeUpdate =
eppInput.getFirstExtensionOfClasses(FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER); eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
// If the fee extension is present, validate it (even if the cost is zero, to check for price // If the fee extension is present, validate it (even if the cost is zero, to check for price
// mismatches). Don't rely on the the validateFeeChallenge check for feeUpdate nullness, because // mismatches). Don't rely on the the validateFeeChallenge check for feeUpdate nullness, because
// it throws an error if the name is premium, and we don't want to do that here. // it throws an error if the name is premium, and we don't want to do that here.

View file

@ -17,24 +17,8 @@ package google.registry.model.domain.fee;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Range; import com.google.common.collect.Range;
import google.registry.model.domain.fee06.FeeCheckCommandExtensionV06;
import google.registry.model.domain.fee06.FeeCreateCommandExtensionV06;
import google.registry.model.domain.fee06.FeeRenewCommandExtensionV06;
import google.registry.model.domain.fee06.FeeTransferCommandExtensionV06;
import google.registry.model.domain.fee06.FeeUpdateCommandExtensionV06;
import google.registry.model.domain.fee11.FeeCheckCommandExtensionV11;
import google.registry.model.domain.fee11.FeeCreateCommandExtensionV11;
import google.registry.model.domain.fee11.FeeRenewCommandExtensionV11;
import google.registry.model.domain.fee11.FeeTransferCommandExtensionV11;
import google.registry.model.domain.fee11.FeeUpdateCommandExtensionV11;
import google.registry.model.domain.fee12.FeeCheckCommandExtensionV12;
import google.registry.model.domain.fee12.FeeCreateCommandExtensionV12;
import google.registry.model.domain.fee12.FeeRenewCommandExtensionV12;
import google.registry.model.domain.fee12.FeeTransferCommandExtensionV12;
import google.registry.model.domain.fee12.FeeUpdateCommandExtensionV12;
import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension; import google.registry.model.eppcommon.ProtocolDefinition.ServiceExtension;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@ -60,48 +44,7 @@ public class Fee extends BaseFee {
return instance; return instance;
} }
public static final ImmutableList< public static final ImmutableSet<String> FEE_EXTENSION_URIS = ImmutableSet.of(
Class<? extends FeeCheckCommandExtension<
? extends FeeCheckCommandExtensionItem, ? extends FeeCheckResponseExtension<?>>>>
FEE_CHECK_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
ImmutableList.<
Class<? extends FeeCheckCommandExtension<
? extends FeeCheckCommandExtensionItem,
? extends FeeCheckResponseExtension<?>>>>of(
FeeCheckCommandExtensionV12.class,
FeeCheckCommandExtensionV11.class,
FeeCheckCommandExtensionV06.class);
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
FeeCreateCommandExtensionV12.class,
FeeCreateCommandExtensionV11.class,
FeeCreateCommandExtensionV06.class);
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
FEE_RENEW_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
FeeRenewCommandExtensionV12.class,
FeeRenewCommandExtensionV11.class,
FeeRenewCommandExtensionV06.class);
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
FEE_TRANSFER_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
FeeTransferCommandExtensionV12.class,
FeeTransferCommandExtensionV11.class,
FeeTransferCommandExtensionV06.class);
public static final ImmutableList<Class<? extends FeeTransformCommandExtension>>
FEE_UPDATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER =
ImmutableList.<Class<? extends FeeTransformCommandExtension>>of(
FeeUpdateCommandExtensionV12.class,
FeeUpdateCommandExtensionV11.class,
FeeUpdateCommandExtensionV06.class);
public static final ImmutableSet<String> FEE_EXTENSION_URIS =
ImmutableSet.<String>of(
ServiceExtension.FEE_0_12.getUri(), ServiceExtension.FEE_0_12.getUri(),
ServiceExtension.FEE_0_11.getUri(), ServiceExtension.FEE_0_11.getUri(),
ServiceExtension.FEE_0_6.getUri()); ServiceExtension.FEE_0_6.getUri());

View file

@ -14,19 +14,22 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
import javax.xml.bind.annotation.XmlTransient;
/** /**
* Interface for individual fee extension items in Check commands. These are derived from the more * Interface for individual fee extension items in Check commands. These are derived from the more
* general query items (which cover Info commands as well), but may also contain a domain name, * general query items (which cover Info commands as well), but may also contain a domain name,
* depending on the version of the fee extension. * depending on the version of the fee extension.
*/ */
public interface FeeCheckCommandExtensionItem extends FeeQueryCommandExtensionItem { @XmlTransient
public abstract class FeeCheckCommandExtensionItem extends FeeQueryCommandExtensionItem {
/** True if this version of the fee extension supports domain names in Check items. */ /** True if this version of the fee extension supports domain names in Check items. */
public boolean isDomainNameSupported(); public abstract boolean isDomainNameSupported();
/** The domain name being checked; throws an exception if domain names are not supported. */ /** The domain name being checked; throws an exception if domain names are not supported. */
public String getDomainName() throws UnsupportedOperationException; public abstract String getDomainName();
/** Create a builder for a matching fee check response item. */ /** Create a builder for a matching fee check response item. */
public FeeCheckResponseExtensionItem.Builder createResponseBuilder(); public abstract FeeCheckResponseExtensionItem.Builder<?> createResponseBuilder();
} }

View file

@ -14,20 +14,24 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
/** import javax.xml.bind.annotation.XmlTransient;
* Interface for individual fee extension items in Check responses. These are derived from the more
* general query items (which cover Info responses as well), but may also contain a domain name,
* depending on the version of the fee extension.
*/
public interface FeeCheckResponseExtensionItem extends FeeQueryResponseExtensionItem {
/** Builder for {@link FeeCheckResponseExtensionItem}. */ /**
public interface Builder extends FeeQueryResponseExtensionItem.Builder { * Abstract class for individual fee extension items in Check responses. These are derived from the
* more general query items (which cover Info responses as well), but may also contain a domain
* name, depending on the version of the fee extension.
*/
@XmlTransient
public abstract class FeeCheckResponseExtensionItem extends FeeQueryResponseExtensionItem {
/** Abstract builder for {@link FeeCheckResponseExtensionItem}. */
public abstract static class Builder<T extends FeeCheckResponseExtensionItem>
extends FeeQueryResponseExtensionItem.Builder<T, Builder<T>> {
/** The name associated with the item. Has no effect if domain names are not supported. */ /** The name associated with the item. Has no effect if domain names are not supported. */
public Builder setDomainNameIfSupported(String name); public Builder<T> setDomainNameIfSupported(@SuppressWarnings("unused") String name) {
return this; // Default impl is a noop.
public FeeCheckResponseExtensionItem build(); }
} }
} }

View file

@ -0,0 +1,21 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import javax.xml.bind.annotation.XmlTransient;
/** A fee extension that may be present on domain create commands. */
@XmlTransient
public abstract class FeeCreateCommandExtension extends FeeTransformCommandExtension {}

View file

@ -15,17 +15,20 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime; import org.joda.time.DateTime;
/** /**
* Interface for individual query items in Check and Info commands. Each item indicates the command * Abstract base class for the fee request query items used in Check and Info commands. It handles
* to be checked, and the number of years for which the prices is requested. It may also contain the * the period, which is always present. Derived classes must handle the command, which may be
* currency, but some versions of the fee extension specify the currency at the top level of the * implemented in different ways, and the currency, which may or may not be present, depending on
* extension. * the version of the extension being used.
*/ */
public interface FeeQueryCommandExtensionItem { @XmlTransient
public abstract class FeeQueryCommandExtensionItem extends ImmutableObject {
/** The name of a command that might have an associated fee. */ /** The name of a command that might have an associated fee. */
public enum CommandName { public enum CommandName {
@ -37,28 +40,35 @@ public interface FeeQueryCommandExtensionItem {
UPDATE UPDATE
} }
/** The default validity period (if not specified) is 1 year for all operations. */
static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS);
/** The period for the command being checked. */
Period period;
/** /**
* Three-character ISO4217 currency code. * Three-character ISO4217 currency code.
* *
* <p>Returns null if this version of the fee extension doesn't specify currency at the top level. * <p>Returns null if this version of the fee extension doesn't specify currency at the top level.
*/ */
public CurrencyUnit getCurrency(); public abstract CurrencyUnit getCurrency();
/** The as-of date for the fee extension to run. */ /** The as-of date for the fee extension to run. */
public Optional<DateTime> getEffectiveDate(); public abstract Optional<DateTime> getEffectiveDate();
/** The name of the command being checked. */ /** The name of the command being checked. */
public CommandName getCommandName(); public abstract CommandName getCommandName();
/** The unparse name of the command being checked, for use in error strings. */ /** The command name before being parsed into an enum, for use in error strings. */
public String getUnparsedCommandName(); public abstract String getUnparsedCommandName();
/** The phase of the command being checked. */ /** The phase of the command being checked. */
public String getPhase(); public abstract String getPhase();
/** The subphase of the command being checked. */ /** The subphase of the command being checked. */
public String getSubphase(); public abstract String getSubphase();
/** The period for the command being checked. */ public Period getPeriod() {
public Period getPeriod(); return Optional.fromNullable(period).or(DEFAULT_PERIOD);
}
} }

View file

@ -1,68 +0,0 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import com.google.common.base.Optional;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.Period;
import javax.xml.bind.annotation.XmlTransient;
/**
* Abstract base class for the fee request query items used in Check and Info commands. It handles
* command and period, which are always present. Derived classes must handle currency, which may or
* may not be present, depending on the version of the extension being used.
*/
@XmlTransient
public abstract class FeeQueryCommandExtensionItemImpl
extends ImmutableObject implements FeeQueryCommandExtensionItem {
/** The default validity period (if not specified) is 1 year for all operations. */
static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS);
/** The command being checked. */
FeeExtensionCommandDescriptor command;
/** The period for the command being checked. */
Period period;
/** The name of the command being checked. */
@Override
public CommandName getCommandName() {
return command.getCommand();
}
/** The command name before being parsed into an enum, for use in error strings. */
@Override
public String getUnparsedCommandName() {
return command.getUnparsedCommandName();
}
/** The phase of the command being checked. */
@Override
public String getPhase() {
return command.getPhase();
}
/** The subphase of the command being checked. */
@Override
public String getSubphase() {
return command.getSubphase();
}
@Override
public Period getPeriod() {
return Optional.fromNullable(period).or(DEFAULT_PERIOD);
}
}

View file

@ -14,56 +14,112 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
import static google.registry.util.CollectionUtils.forceEmptyToNull;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import com.google.common.collect.ImmutableList;
import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime; import org.joda.time.DateTime;
/** /**
* Interface for individual query items in Check and Info response. Each item indicates the fees and * Abstract base class for the fee request query items used in Check and Info responses. It handles
* class associated with a particular command and period. The currency may also be listed, but some * command, period, fees and class, which are always present. Derived classes must handle currency,
* versions of the fee extension specify the currency at the top level of the extension. * which may or may not be present, depending on the version of the extension being used.
*/ */
@XmlTransient
public interface FeeQueryResponseExtensionItem { public class FeeQueryResponseExtensionItem extends ImmutableObject {
/** /**
* The type of the fee. We will use "premium" for fees on premium names, and omit the field * The period that was checked.
* otherwise. *
* <p>This field is exposed to JAXB only via the getter so that subclasses can override it.
*/ */
public String getFeeClass(); @XmlTransient
Period period;
/** Builder for {@link FeeCheckResponseExtensionItem}. */
public interface Builder {
/** /**
* If currency is not supported in this type of query response item for this version of the fee * The magnitude of the fee, in the specified units, with an optional description.
* extension, this function has no effect. *
* <p>This is a list because a single operation can involve multiple fees.
*
* <p>This field is exposed to JAXB only via the getter so that subclasses can override it.
*/ */
public Builder setCurrencyIfSupported(CurrencyUnit currency); @XmlTransient
List<Fee> fees;
/** Whether this check item can be calculated. If so, reason should be null. If not, fees /**
* should not be set. * The type of the fee.
*
* <p>We will use "premium" for fees on premium names, and omit the field otherwise.
*
* <p>This field is exposed to JAXB only via the getter so that subclasses can override it.
*/ */
public Builder setAvailIfSupported(boolean avail); @XmlTransient
String feeClass;
/** The reason that the check item cannot be calculated. */ @XmlElement(name = "period")
public Builder setReasonIfSupported(String reason); public Period getPeriod() {
return period;
/** The effective date that the check is run on. */
public Builder setEffectiveDateIfSupported(DateTime effectiveDate);
/** The date after which the quoted fees are no longer valid. */
public Builder setNotAfterDateIfSupported(DateTime notAfterDate);
public Builder setCommand(CommandName commandName, String phase, String subphase);
public Builder setPeriod(Period period);
public Builder setFees(List<Fee> fees);
public Builder setClass(String feeClass);
}
} }
@XmlElement(name = "fee")
public ImmutableList<Fee> getFees() {
return nullToEmptyImmutableCopy(fees);
}
@XmlElement(name = "class")
public String getFeeClass() {
return feeClass;
}
/** Abstract builder for {@link FeeQueryResponseExtensionItemImpl}. */
public abstract static class
Builder<T extends FeeQueryResponseExtensionItem, B extends Builder<?, ?>>
extends GenericBuilder<T, B> {
public abstract B setCommand(CommandName commandName, String phase, String subphase);
public B setPeriod(Period period) {
getInstance().period = period;
return thisCastToDerived();
}
public B setFees(ImmutableList<Fee> fees) {
// If there are no fees, set the field to null to suppress the 'fee' section in the xml.
getInstance().fees = forceEmptyToNull(ImmutableList.copyOf(fees));
return thisCastToDerived();
}
public B setClass(String feeClass) {
getInstance().feeClass = feeClass;
return thisCastToDerived();
}
public B setAvailIfSupported(@SuppressWarnings("unused") boolean avail) {
return thisCastToDerived(); // Default impl is a noop.
}
public B setReasonIfSupported(@SuppressWarnings("unused") String reason) {
return thisCastToDerived(); // Default impl is a noop.
}
public B setEffectiveDateIfSupported(@SuppressWarnings("unused") DateTime effectiveDate) {
return thisCastToDerived(); // Default impl is a noop.
}
public B setNotAfterDateIfSupported(@SuppressWarnings("unused") DateTime notAfterDate) {
return thisCastToDerived(); // Default impl is a noop.
}
public B setCurrencyIfSupported(@SuppressWarnings("unused") CurrencyUnit currency) {
return thisCastToDerived(); // Default impl is a noop.
}
}
}

View file

@ -1,98 +0,0 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import static google.registry.util.CollectionUtils.forceEmptyToNull;
import com.google.common.collect.ImmutableList;
import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
/**
* Abstract base class for the fee request query items used in Check and Info responses. It handles
* command, period, fees and class, which are always present. Derived classes must handle currency,
* which may or may not be present, depending on the version of the extension being used.
*/
@XmlTransient
public class FeeQueryResponseExtensionItemImpl
extends ImmutableObject implements FeeQueryResponseExtensionItem {
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** The period that was checked. */
Period period;
/**
* The magnitude of the fee, in the specified units, with an optional description.
*
* <p>This is a list because a single operation can involve multiple fees.
*/
List<Fee> fee;
/**
* The type of the fee.
*
* <p>We will use "premium" for fees on premium names, and omit the field otherwise.
*/
@XmlElement(name = "class")
String feeClass;
@Override
public String getFeeClass() {
return feeClass;
}
/** Abstract builder for {@link FeeQueryResponseExtensionItemImpl}. */
public abstract static class
Builder<T extends FeeQueryResponseExtensionItemImpl, B extends Builder<?, ?>>
extends GenericBuilder<T, B> implements FeeQueryResponseExtensionItem.Builder {
@Override
public B setCommand(CommandName commandName, String phase, String subphase) {
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return thisCastToDerived();
}
@Override
public B setPeriod(Period period) {
getInstance().period = period;
return thisCastToDerived();
}
@Override
public B setFees(List<Fee> fees) {
// If there are no fees, set the field to null to suppress the 'fee' section in the xml.
getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fees));
return thisCastToDerived();
}
public B setFee(List<Fee> fees) {
getInstance().fee = forceEmptyToNull(ImmutableList.copyOf(fees));
return thisCastToDerived();
}
@Override
public B setClass(String feeClass) {
getInstance().feeClass = feeClass;
return thisCastToDerived();
}
}
}

View file

@ -0,0 +1,21 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import javax.xml.bind.annotation.XmlTransient;
/** A fee extension that may be present on domain renew commands. */
@XmlTransient
public abstract class FeeRenewCommandExtension extends FeeTransformCommandExtension {}

View file

@ -0,0 +1,21 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import javax.xml.bind.annotation.XmlTransient;
/** A fee extension that may be present on domain transfer commands. */
@XmlTransient
public abstract class FeeTransferCommandExtension extends FeeTransformCommandExtension {}

View file

@ -14,14 +14,41 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import com.google.common.collect.ImmutableList;
import google.registry.model.ImmutableObject;
import google.registry.model.eppinput.EppInput.CommandExtension; import google.registry.model.eppinput.EppInput.CommandExtension;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
/** Interface for fee extensions in Create, Renew, Transfer and Update commands. */ /** Base class for general transform commands with fees (create, renew, update, transfer). */
public interface FeeTransformCommandExtension extends CommandExtension { @XmlTransient
CurrencyUnit getCurrency(); public abstract class FeeTransformCommandExtension
List<Fee> getFees(); extends ImmutableObject implements CommandExtension {
List<Credit> getCredits();
FeeTransformResponseExtension.Builder createResponseBuilder(); /** The currency of the fee. */
CurrencyUnit currency;
/**
* The magnitude of the fee, in the specified units, with an optional description.
*
* <p>This is a list because a single operation can involve multiple fees.
*/
@XmlElement(name = "fee")
List<Fee> fees;
public CurrencyUnit getCurrency() {
return currency;
}
public ImmutableList<Fee> getFees() {
return nullToEmptyImmutableCopy(fees);
}
public abstract ImmutableList<Credit> getCredits();
public abstract FeeTransformResponseExtension.Builder createResponseBuilder();
} }

View file

@ -1,58 +0,0 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import static google.registry.util.CollectionUtils.nullToEmpty;
import google.registry.model.ImmutableObject;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
/** Base class for general transform commands with fees (create, renew, update, transfer). */
@XmlTransient
public abstract class FeeTransformCommandExtensionImpl
extends ImmutableObject implements FeeTransformCommandExtension {
/** The currency of the fee. */
CurrencyUnit currency;
/**
* The magnitude of the fee, in the specified units, with an optional description.
*
* <p>This is a list because a single operation can involve multiple fees.
*/
@XmlElement(name = "fee")
List<Fee> fees;
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public CurrencyUnit getCurrency() {
return currency;
}
@Override
public List<Fee> getFees() {
return fees;
}
@Override
public List<Credit> getCredits() {
return nullToEmpty(credits);
}
}

View file

@ -1,58 +0,0 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import com.google.common.collect.ImmutableList;
import google.registry.model.ImmutableObject;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
/**
* Base class for general transform commands with fees (create, renew, update, transfer). This
* version of the class is for fee extensions that do not support credits (certain older versions
* allow credits only for some commands).
*/
@XmlTransient
public abstract class FeeTransformCommandExtensionImplNoCredits
extends ImmutableObject implements FeeTransformCommandExtension {
/** The currency of the fee. */
CurrencyUnit currency;
/**
* The magnitude of the fee, in the specified units, with an optional description.
*
* <p>This is a list because a single operation can involve multiple fees.
*/
@XmlElement(name = "fee")
List<Fee> fees;
@Override
public CurrencyUnit getCurrency() {
return currency;
}
@Override
public List<Fee> getFees() {
return fees;
}
@Override
public List<Credit> getCredits() {
return ImmutableList.of();
}
}

View file

@ -14,18 +14,62 @@
package google.registry.model.domain.fee; package google.registry.model.domain.fee;
import static google.registry.util.CollectionUtils.forceEmptyToNull;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import com.google.common.collect.ImmutableList;
import google.registry.model.Buildable;
import google.registry.model.ImmutableObject;
import google.registry.model.eppoutput.EppResponse.ResponseExtension; import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
/** Interface for fee extensions in Create, Renew, Transfer and Update responses. */ /** Base class for fee responses on general transform commands (create, update, renew, transfer). */
public interface FeeTransformResponseExtension extends ResponseExtension { @XmlTransient
public class FeeTransformResponseExtension extends ImmutableObject implements ResponseExtension {
/** Builder for {@link FeeTransformResponseExtension}. */ /** The currency of the fee. */
public interface Builder { CurrencyUnit currency;
Builder setCurrency(CurrencyUnit currency);
Builder setFees(List<Fee> fees); /**
Builder setCredits(List<Credit> credits); * The magnitude of the fee, in the specified units, with an optional description.
FeeTransformResponseExtension build(); *
* <p>This is a list because a single operation can involve multiple fees.
*/
@XmlElement(name = "fee")
List<Fee> fees;
/** This field is exposed to JAXB only via the getter so that subclasses can override it. */
@XmlTransient
List<Credit> credits;
@XmlElement(name = "credit")
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
/** Abstract builder for {@link FeeTransformResponseExtensionImpl}. */
public static class Builder extends Buildable.Builder<FeeTransformResponseExtension> {
public Builder(FeeTransformResponseExtension instance) {
super(instance);
}
public Builder setCurrency(CurrencyUnit currency) {
getInstance().currency = currency;
return this;
}
public Builder setFees(List<Fee> fees) {
getInstance().fees = fees;
return this;
}
public Builder setCredits(List<Credit> credits) {
getInstance().credits = forceEmptyToNull(credits);
return this;
}
} }
} }

View file

@ -1,68 +0,0 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import static google.registry.util.CollectionUtils.forceEmptyToNull;
import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
/** Base class for fee responses on general transform commands (create, update, renew, transfer). */
@XmlTransient
public class FeeTransformResponseExtensionImpl extends ImmutableObject
implements FeeTransformResponseExtension {
/** The currency of the fee. */
CurrencyUnit currency;
/**
* The magnitude of the fee, in the specified units, with an optional description.
*
* <p>This is a list because a single operation can involve multiple fees.
*/
@XmlElement(name = "fee")
List<Fee> fees;
@XmlElement(name = "credit")
List<Credit> credits;
/** Abstract builder for {@link FeeTransformResponseExtensionImpl}. */
public abstract static class
Builder<T extends FeeTransformResponseExtensionImpl, B extends Builder<?, ?>>
extends GenericBuilder<T, B> implements FeeTransformResponseExtension.Builder {
@Override
public B setCurrency(CurrencyUnit currency) {
getInstance().currency = currency;
return thisCastToDerived();
}
@Override
public B setFees(List<Fee> fees) {
getInstance().fees = fees;
return thisCastToDerived();
}
@Override
public B setCredits(List<Credit> credits) {
getInstance().credits = forceEmptyToNull(credits);
return thisCastToDerived();
}
}
}

View file

@ -1,66 +0,0 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
/**
* Base class for fee responses on general transform commands (create, update, renew, transfer).
* This version of the class is for fee extensions that do not support credits (certain older
* versions allow credits only for some commands).
*/
@XmlTransient
public class FeeTransformResponseExtensionImplNoCredits extends ImmutableObject
implements FeeTransformResponseExtension {
/** The currency of the fee. */
CurrencyUnit currency;
/**
* The magnitude of the fee, in the specified units, with an optional description.
*
* <p>This is a list because a single operation can involve multiple fees.
*/
@XmlElement(name = "fee")
List<Fee> fees;
/** Abstract builder for {@link FeeTransformResponseExtensionImplNoCredits}. */
public abstract static class
Builder<T extends FeeTransformResponseExtensionImplNoCredits, B extends Builder<?, ?>>
extends GenericBuilder<T, B> implements FeeTransformResponseExtension.Builder {
@Override
public B setCurrency(CurrencyUnit currency) {
getInstance().currency = currency;
return thisCastToDerived();
}
@Override
public B setFees(List<Fee> fees) {
getInstance().fees = fees;
return thisCastToDerived();
}
@Override
public B setCredits(List<Credit> credits) {
return thisCastToDerived();
}
}
}

View file

@ -0,0 +1,21 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.model.domain.fee;
import javax.xml.bind.annotation.XmlTransient;
/** A fee extension that may be present on domain update commands. */
@XmlTransient
public abstract class FeeUpdateCommandExtension extends FeeTransformCommandExtension {}

View file

@ -16,22 +16,47 @@ package google.registry.model.domain.fee06;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem; import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem; import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItemImpl;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime; import org.joda.time.DateTime;
/** An individual price check item in version 0.6 of the fee extension on Check commands. */ /** An individual price check item in version 0.6 of the fee extension on Check commands. */
@XmlType(propOrder = {"name", "currency", "command", "period"}) @XmlType(propOrder = {"name", "currency", "command", "period"})
public class FeeCheckCommandExtensionItemV06 public class FeeCheckCommandExtensionItemV06 extends FeeCheckCommandExtensionItem {
extends FeeQueryCommandExtensionItemImpl implements FeeCheckCommandExtensionItem {
/** The fully qualified domain name being checked. */ /** The fully qualified domain name being checked. */
String name; String name;
CurrencyUnit currency; CurrencyUnit currency;
/** The command being checked. */
FeeExtensionCommandDescriptor command;
/** The name of the command being checked. */
@Override
public CommandName getCommandName() {
return command.getCommand();
}
/** The command name before being parsed into an enum, for use in error strings. */
@Override
public String getUnparsedCommandName() {
return command.getUnparsedCommandName();
}
/** The phase of the command being checked. */
@Override
public String getPhase() {
return command.getPhase();
}
/** The subphase of the command being checked. */
@Override
public String getSubphase() {
return command.getSubphase();
}
@Override @Override
public boolean isDomainNameSupported() { public boolean isDomainNameSupported() {
return true; return true;
@ -48,7 +73,7 @@ public class FeeCheckCommandExtensionItemV06
} }
@Override @Override
public FeeCheckResponseExtensionItem.Builder createResponseBuilder() { public FeeCheckResponseExtensionItemV06.Builder createResponseBuilder() {
return new FeeCheckResponseExtensionItemV06.Builder(); return new FeeCheckResponseExtensionItemV06.Builder();
} }

View file

@ -15,24 +15,31 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem; import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryResponseExtensionItemImpl; import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** The version 0.6 response for a domain check on a single resource. */ /** The version 0.6 response for a domain check on a single resource. */
@XmlType(propOrder = {"name", "currency", "command", "period", "fee", "feeClass"}) @XmlType(propOrder = {"name", "currency", "command", "period", "fees", "feeClass"})
public class FeeCheckResponseExtensionItemV06 public class FeeCheckResponseExtensionItemV06 extends FeeCheckResponseExtensionItem {
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
/** The name of the domain that was checked, with an attribute indicating if it is premium. */ /** The name of the domain that was checked, with an attribute indicating if it is premium. */
String name; String name;
CurrencyUnit currency; CurrencyUnit currency;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeCheckResponseExtensionItemV06}. */ /** Builder for {@link FeeCheckResponseExtensionItemV06}. */
public static class Builder public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV06, Builder> extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV06> {
implements FeeCheckResponseExtensionItem.Builder {
@Override
public Builder setCommand(CommandName commandName, String phase, String subphase) {
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return this;
}
@Override @Override
public Builder setDomainNameIfSupported(String name) { public Builder setDomainNameIfSupported(String name) {
@ -45,26 +52,5 @@ public class FeeCheckResponseExtensionItemV06
getInstance().currency = currency; getInstance().currency = currency;
return this; return this;
} }
@Override
public Builder setAvailIfSupported(boolean avail) {
return this;
}
@Override
public Builder setReasonIfSupported(String reason) {
return this;
}
@Override
public Builder setEffectiveDateIfSupported(DateTime effectiveDate) {
return this;
}
@Override
public Builder setNotAfterDateIfSupported(DateTime notAfterDate) {
return this;
}
} }
} }

View file

@ -14,8 +14,9 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits; import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeCreateCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -23,11 +24,19 @@ import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain create commands. */ /** A fee extension that may be present on domain create commands. */
@XmlRootElement(name = "create") @XmlRootElement(name = "create")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeCreateCommandExtensionV06 public class FeeCreateCommandExtensionV06 extends FeeCreateCommandExtension {
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeCreateResponseExtensionV06.Builder(); return new FeeTransformResponseExtension.Builder(new FeeCreateResponseExtensionV06());
}
/**
* This method is overridden and not annotated for JAXB because this version of the extension
* doesn't support the "credit" field.
*/
@Override
public ImmutableList<Credit> getCredits() {
return ImmutableList.of();
} }
} }

View file

@ -14,7 +14,9 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +26,11 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "creData") @XmlRootElement(name = "creData")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeCreateResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits { public class FeeCreateResponseExtensionV06 extends FeeTransformResponseExtension {
/** A builder for {@link FeeCreateResponseExtensionV06}. */
public static class Builder extends /** This version of the extension doesn't support the "credit" field. */
FeeTransformResponseExtensionImplNoCredits.Builder<FeeCreateResponseExtensionV06, Builder> {} @Override
public ImmutableList<Credit> getCredits() {
return ImmutableList.of();
}
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,9 +24,12 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "delData") @XmlRootElement(name = "delData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeDeleteResponseExtensionV06 extends FeeTransformResponseExtensionImpl { public class FeeDeleteResponseExtensionV06 extends FeeTransformResponseExtension {
/** Builder for {@link FeeDeleteResponseExtensionV06}. */ /** Builder for {@link FeeDeleteResponseExtensionV06}. */
public static class Builder public static class Builder extends FeeTransformResponseExtension.Builder {
extends FeeTransformResponseExtensionImpl.Builder<FeeDeleteResponseExtensionV06, Builder> {} public Builder() {
super(new FeeDeleteResponseExtensionV06());
}
}
} }

View file

@ -15,7 +15,8 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItemImpl; import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem;
import google.registry.model.eppinput.EppInput.CommandExtension; import google.registry.model.eppinput.EppInput.CommandExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -26,11 +27,38 @@ import org.joda.time.DateTime;
@XmlRootElement(name = "info") @XmlRootElement(name = "info")
@XmlType(propOrder = {"currency", "command", "period"}) @XmlType(propOrder = {"currency", "command", "period"})
public class FeeInfoCommandExtensionV06 public class FeeInfoCommandExtensionV06
extends FeeQueryCommandExtensionItemImpl implements CommandExtension { extends FeeQueryCommandExtensionItem implements CommandExtension {
/** A three-character ISO4217 currency code. */ /** A three-character ISO4217 currency code. */
CurrencyUnit currency; CurrencyUnit currency;
/** The command being checked. */
FeeExtensionCommandDescriptor command;
/** The name of the command being checked. */
@Override
public CommandName getCommandName() {
return command.getCommand();
}
/** The command name before being parsed into an enum, for use in error strings. */
@Override
public String getUnparsedCommandName() {
return command.getUnparsedCommandName();
}
/** The phase of the command being checked. */
@Override
public String getPhase() {
return command.getPhase();
}
/** The subphase of the command being checked. */
@Override
public String getSubphase() {
return command.getSubphase();
}
@Override @Override
public CurrencyUnit getCurrency() { public CurrencyUnit getCurrency() {
return currency; return currency;

View file

@ -14,54 +14,43 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import google.registry.model.domain.fee.FeeQueryResponseExtensionItem; import google.registry.model.domain.fee.FeeQueryResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryResponseExtensionItemImpl;
import google.registry.model.eppoutput.EppResponse.ResponseExtension; import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** /**
* An XML data object that represents a fee extension that may be present on the response to EPP * An XML data object that represents a fee extension that may be present on the response to EPP
* domain info commands. * domain info commands.
*/ */
@XmlRootElement(name = "infData") @XmlRootElement(name = "infData")
@XmlType(propOrder = {"currency", "command", "period", "fee", "feeClass"}) @XmlType(propOrder = {"currency", "command", "period", "fees", "feeClass"})
public class FeeInfoResponseExtensionV06 public class FeeInfoResponseExtensionV06
extends FeeQueryResponseExtensionItemImpl implements ResponseExtension { extends FeeQueryResponseExtensionItem implements ResponseExtension {
CurrencyUnit currency; CurrencyUnit currency;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeInfoResponseExtensionV06}. */ /** Builder for {@link FeeInfoResponseExtensionV06}. */
public static class Builder public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeInfoResponseExtensionV06, Builder> { extends FeeQueryResponseExtensionItem.Builder<FeeInfoResponseExtensionV06, Builder> {
@Override @Override
public Builder setAvailIfSupported(boolean avail) { public Builder setCommand(CommandName commandName, String phase, String subphase) {
return this; getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return thisCastToDerived();
} }
@Override @Override
public Builder setReasonIfSupported(String reason) { public Builder setCurrencyIfSupported(CurrencyUnit currency) {
return this;
}
@Override
public FeeQueryResponseExtensionItem.Builder
setCurrencyIfSupported(CurrencyUnit currency) {
getInstance().currency = currency; getInstance().currency = currency;
return this; return this;
} }
@Override
public Builder setEffectiveDateIfSupported(DateTime effectiveDate) {
return this;
}
@Override
public Builder setNotAfterDateIfSupported(DateTime notAfterDate) {
return this;
}
} }
} }

View file

@ -14,8 +14,9 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits; import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeRenewCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -23,11 +24,16 @@ import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain renew commands. */ /** A fee extension that may be present on domain renew commands. */
@XmlRootElement(name = "renew") @XmlRootElement(name = "renew")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeRenewCommandExtensionV06 public class FeeRenewCommandExtensionV06 extends FeeRenewCommandExtension {
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeRenewResponseExtensionV06.Builder(); return new FeeTransformResponseExtension.Builder(new FeeRenewResponseExtensionV06());
}
/** This version of the extension doesn't support the "credit" field. */
@Override
public ImmutableList<Credit> getCredits() {
return ImmutableList.of();
} }
} }

View file

@ -14,7 +14,9 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +26,11 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "renData") @XmlRootElement(name = "renData")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeRenewResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits { public class FeeRenewResponseExtensionV06 extends FeeTransformResponseExtension {
/** A builder for {@link FeeRenewResponseExtensionV06}. */
public static class Builder extends /** This version of the extension doesn't support the "credit" field. */
FeeTransformResponseExtensionImplNoCredits.Builder<FeeRenewResponseExtensionV06, Builder> {} @Override
public ImmutableList<Credit> getCredits() {
return super.getCredits();
}
} }

View file

@ -14,8 +14,9 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits; import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransferCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -23,11 +24,16 @@ import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain transfer requests. */ /** A fee extension that may be present on domain transfer requests. */
@XmlRootElement(name = "transfer") @XmlRootElement(name = "transfer")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeTransferCommandExtensionV06 public class FeeTransferCommandExtensionV06 extends FeeTransferCommandExtension {
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeTransferResponseExtensionV06.Builder(); return new FeeTransformResponseExtension.Builder(new FeeTransferResponseExtensionV06());
}
/** This version of the extension doesn't support the "credit" field. */
@Override
public ImmutableList<Credit> getCredits() {
return ImmutableList.of();
} }
} }

View file

@ -14,7 +14,9 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,9 +26,11 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "trnData") @XmlRootElement(name = "trnData")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeTransferResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits { public class FeeTransferResponseExtensionV06 extends FeeTransformResponseExtension {
/** A builder for {@link FeeTransferResponseExtensionV06}. */
public static class Builder /** This version of the extension doesn't support the "credit" field. */
extends FeeTransformResponseExtensionImplNoCredits @Override
.Builder<FeeTransferResponseExtensionV06, Builder> {} public ImmutableList<Credit> getCredits() {
return super.getCredits();
}
} }

View file

@ -14,20 +14,26 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits; import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.fee.FeeUpdateCommandExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain update commands. */ /** A fee extension that may be present on domain update commands. */
@XmlRootElement(name = "update") @XmlRootElement(name = "update")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeUpdateCommandExtensionV06 public class FeeUpdateCommandExtensionV06 extends FeeUpdateCommandExtension {
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeUpdateResponseExtensionV06.Builder(); return new FeeTransformResponseExtension.Builder(new FeeUpdateResponseExtensionV06());
}
/** This version of the extension doesn't support the "credit" field. */
@Override
public ImmutableList<Credit> getCredits() {
return ImmutableList.of();
} }
} }

View file

@ -14,7 +14,9 @@
package google.registry.model.domain.fee06; package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImplNoCredits; import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,9 +26,11 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "updData") @XmlRootElement(name = "updData")
@XmlType(propOrder = {"currency", "fees"}) @XmlType(propOrder = {"currency", "fees"})
public class FeeUpdateResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits { public class FeeUpdateResponseExtensionV06 extends FeeTransformResponseExtension {
/** A builder for {@link FeeUpdateResponseExtensionV06}. */
public static class Builder /** This version of the extension doesn't support the "credit" field. */
extends FeeTransformResponseExtensionImplNoCredits @Override
.Builder<FeeUpdateResponseExtensionV06, Builder> {} public ImmutableList<Credit> getCredits() {
return super.getCredits();
}
} }

View file

@ -24,7 +24,6 @@ import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeCheckCommandExtension; import google.registry.model.domain.fee.FeeCheckCommandExtension;
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem; import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem; import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem.Builder;
import google.registry.model.domain.fee.FeeExtensionCommandDescriptor; import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import google.registry.model.domain.fee11.FeeCheckCommandExtensionV11.FeeCheckCommandExtensionItemV11; import google.registry.model.domain.fee11.FeeCheckCommandExtensionV11.FeeCheckCommandExtensionItemV11;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -88,7 +87,7 @@ public class FeeCheckCommandExtensionV11 extends ImmutableObject
} }
/** Implementation of the item interface, returning values of the single "item". */ /** Implementation of the item interface, returning values of the single "item". */
class FeeCheckCommandExtensionItemV11 implements FeeCheckCommandExtensionItem { class FeeCheckCommandExtensionItemV11 extends FeeCheckCommandExtensionItem {
/** The name of the command being checked. */ /** The name of the command being checked. */
@Override @Override
@ -135,7 +134,7 @@ public class FeeCheckCommandExtensionV11 extends ImmutableObject
} }
@Override @Override
public Builder createResponseBuilder() { public FeeCheckResponseExtensionItemV11.Builder createResponseBuilder() {
return new FeeCheckResponseExtensionItemV11.Builder(); return new FeeCheckResponseExtensionItemV11.Builder();
} }

View file

@ -16,16 +16,15 @@ package google.registry.model.domain.fee11;
import google.registry.model.domain.DomainObjectSpec; import google.registry.model.domain.DomainObjectSpec;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem; import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryResponseExtensionItemImpl; import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit; import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** The version 0.11 response for a domain check on a single resource. */ /** The version 0.11 response for a domain check on a single resource. */
@XmlType(propOrder = {"object", "command", "currency", "period", "fee", "feeClass", "reason"}) @XmlType(propOrder = {"object", "command", "currency", "period", "fees", "feeClass", "reason"})
public class FeeCheckResponseExtensionItemV11 public class FeeCheckResponseExtensionItemV11 extends FeeCheckResponseExtensionItem {
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
/** Whether the domain is available. */ /** Whether the domain is available. */
@XmlAttribute @XmlAttribute
@ -39,10 +38,18 @@ public class FeeCheckResponseExtensionItemV11
/** The reason that the check item cannot be calculated. */ /** The reason that the check item cannot be calculated. */
String reason; String reason;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeCheckResponseExtensionItemV11}. */ /** Builder for {@link FeeCheckResponseExtensionItemV11}. */
public static class Builder public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV11, Builder> extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV11> {
implements FeeCheckResponseExtensionItem.Builder {
@Override
public Builder setCommand(CommandName commandName, String phase, String subphase) {
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return this;
}
@Override @Override
public Builder setDomainNameIfSupported(String name) { public Builder setDomainNameIfSupported(String name) {
@ -67,15 +74,5 @@ public class FeeCheckResponseExtensionItemV11
getInstance().reason = reason; getInstance().reason = reason;
return this; return this;
} }
@Override
public Builder setEffectiveDateIfSupported(DateTime effectiveDate) {
return this;
}
@Override
public Builder setNotAfterDateIfSupported(DateTime notAfterDate) {
return this;
}
} }
} }

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeCreateCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain create commands. */ /** A fee extension that may be present on domain create commands. */
@XmlRootElement(name = "create") @XmlRootElement(name = "create")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateCommandExtensionV11 public class FeeCreateCommandExtensionV11 extends FeeCreateCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeCreateResponseExtensionV11.Builder(); return new FeeTransformResponseExtension.Builder(new FeeCreateResponseExtensionV11());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "creData") @XmlRootElement(name = "creData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateResponseExtensionV11 extends FeeTransformResponseExtensionImpl { public class FeeCreateResponseExtensionV11 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeCreateResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeCreateResponseExtensionV11, Builder> {}
}

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,9 +24,12 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "delData") @XmlRootElement(name = "delData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeDeleteResponseExtensionV11 extends FeeTransformResponseExtensionImpl { public class FeeDeleteResponseExtensionV11 extends FeeTransformResponseExtension {
/** Builder for {@link FeeDeleteResponseExtensionV11}. */ /** Builder for {@link FeeDeleteResponseExtensionV11}. */
public static class Builder public static class Builder extends FeeTransformResponseExtension.Builder {
extends FeeTransformResponseExtensionImpl.Builder<FeeDeleteResponseExtensionV11, Builder> {} public Builder() {
super(new FeeDeleteResponseExtensionV11());
}
}
} }

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeRenewCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain renew commands. */ /** A fee extension that may be present on domain renew commands. */
@XmlRootElement(name = "renew") @XmlRootElement(name = "renew")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewCommandExtensionV11 public class FeeRenewCommandExtensionV11 extends FeeRenewCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeRenewResponseExtensionV11.Builder(); return new FeeTransformResponseExtension.Builder(new FeeRenewResponseExtensionV11());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "renData") @XmlRootElement(name = "renData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewResponseExtensionV11 extends FeeTransformResponseExtensionImpl { public class FeeRenewResponseExtensionV11 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeRenewResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeRenewResponseExtensionV11, Builder> {}
}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransferCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain transfer requests. */ /** A fee extension that may be present on domain transfer requests. */
@XmlRootElement(name = "transfer") @XmlRootElement(name = "transfer")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferCommandExtensionV11 public class FeeTransferCommandExtensionV11 extends FeeTransferCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeTransferResponseExtensionV11.Builder(); return new FeeTransformResponseExtension.Builder(new FeeTransferResponseExtensionV11());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "trnData") @XmlRootElement(name = "trnData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferResponseExtensionV11 extends FeeTransformResponseExtensionImpl { public class FeeTransferResponseExtensionV11 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeTransferResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeTransferResponseExtensionV11, Builder> {}
}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.fee.FeeUpdateCommandExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain update commands. */ /** A fee extension that may be present on domain update commands. */
@XmlRootElement(name = "update") @XmlRootElement(name = "update")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateCommandExtensionV11 public class FeeUpdateCommandExtensionV11 extends FeeUpdateCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeUpdateResponseExtensionV11.Builder(); return new FeeTransformResponseExtension.Builder(new FeeUpdateResponseExtensionV11());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee11; package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "updData") @XmlRootElement(name = "updData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateResponseExtensionV11 extends FeeTransformResponseExtensionImpl { public class FeeUpdateResponseExtensionV11 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeUpdateResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeUpdateResponseExtensionV11, Builder> {}
}

View file

@ -17,10 +17,8 @@ package google.registry.model.domain.fee12;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher; import com.google.common.base.CharMatcher;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.FeeCheckCommandExtensionItem; import google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -41,8 +39,7 @@ import org.joda.time.DateTime;
* the names from the non-extension check element are used. * the names from the non-extension check element are used.
*/ */
@XmlType(propOrder = {"period", "feeClass", "feeDate"}) @XmlType(propOrder = {"period", "feeClass", "feeDate"})
public class FeeCheckCommandExtensionItemV12 public class FeeCheckCommandExtensionItemV12 extends FeeCheckCommandExtensionItem {
extends ImmutableObject implements FeeCheckCommandExtensionItem {
/** The default validity period (if not specified) is 1 year for all operations. */ /** The default validity period (if not specified) is 1 year for all operations. */
static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS); static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS);
@ -56,9 +53,6 @@ public class FeeCheckCommandExtensionItemV12
@XmlAttribute @XmlAttribute
String subphase; String subphase;
@XmlElement
Period period;
@XmlElement(name = "class") @XmlElement(name = "class")
String feeClass; String feeClass;
@ -110,12 +104,7 @@ public class FeeCheckCommandExtensionItemV12
} }
@Override @Override
public Period getPeriod() { public FeeCheckResponseExtensionItemV12.Builder createResponseBuilder() {
return Optional.fromNullable(period).or(DEFAULT_PERIOD);
}
@Override
public FeeCheckResponseExtensionItem.Builder createResponseBuilder() {
return new FeeCheckResponseExtensionItemV12.Builder(); return new FeeCheckResponseExtensionItemV12.Builder();
} }

View file

@ -17,24 +17,19 @@ package google.registry.model.domain.fee12;
import static google.registry.util.CollectionUtils.forceEmptyToNull; import static google.registry.util.CollectionUtils.forceEmptyToNull;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import google.registry.model.Buildable.GenericBuilder;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.DomainObjectSpec; import google.registry.model.domain.DomainObjectSpec;
import google.registry.model.domain.Period; import google.registry.model.domain.Period;
import google.registry.model.domain.fee.Fee; import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem; import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName; import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import java.util.List;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime; import org.joda.time.DateTime;
/** /**
* The version 0.12 response for a domain check on a single resource. * The version 0.12 response for a domain check on a single resource.
*/ */
@XmlType(propOrder = {"object", "command"}) @XmlType(propOrder = {"object", "command"})
public class FeeCheckResponseExtensionItemV12 public class FeeCheckResponseExtensionItemV12 extends FeeCheckResponseExtensionItem {
extends ImmutableObject implements FeeCheckResponseExtensionItem {
/** The domain that was checked. */ /** The domain that was checked. */
DomainObjectSpec object; DomainObjectSpec object;
@ -42,6 +37,28 @@ public class FeeCheckResponseExtensionItemV12
/** The command that was checked. */ /** The command that was checked. */
FeeCheckResponseExtensionItemCommandV12 command; FeeCheckResponseExtensionItemCommandV12 command;
/**
* This method is overridden and not annotated for JAXB because this version of the extension
* doesn't support "period".
*/
@Override
public Period getPeriod() {
return super.getPeriod();
}
/**
* This method is overridden and not annotated for JAXB because this version of the extension
* doesn't support "fee".
*/
@Override
public ImmutableList<Fee> getFees() {
return super.getFees();
}
/**
* This method is not annotated for JAXB because this version of the extension doesn't support
* "feeClass" and because the data comes off of the command object rather than a field.
*/
@Override @Override
public String getFeeClass() { public String getFeeClass() {
return command.getFeeClass(); return command.getFeeClass();
@ -49,15 +66,10 @@ public class FeeCheckResponseExtensionItemV12
/** Builder for {@link FeeCheckResponseExtensionItemV12}. */ /** Builder for {@link FeeCheckResponseExtensionItemV12}. */
public static class Builder public static class Builder
extends GenericBuilder<FeeCheckResponseExtensionItemV12, Builder> extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV12> {
implements FeeCheckResponseExtensionItem.Builder {
final FeeCheckResponseExtensionItemCommandV12.Builder commandBuilder; final FeeCheckResponseExtensionItemCommandV12.Builder commandBuilder =
new FeeCheckResponseExtensionItemCommandV12.Builder();
Builder() {
super();
commandBuilder = new FeeCheckResponseExtensionItemCommandV12.Builder();
}
@Override @Override
public Builder setCommand(CommandName commandName, String phase, String subphase) { public Builder setCommand(CommandName commandName, String phase, String subphase) {
@ -74,7 +86,7 @@ public class FeeCheckResponseExtensionItemV12
} }
@Override @Override
public Builder setFees(List<Fee> fees) { public Builder setFees(ImmutableList<Fee> fees) {
commandBuilder.setFee(forceEmptyToNull(ImmutableList.copyOf(fees))); commandBuilder.setFee(forceEmptyToNull(ImmutableList.copyOf(fees)));
return this; return this;
} }
@ -91,22 +103,6 @@ public class FeeCheckResponseExtensionItemV12
return this; return this;
} }
/** Version 0.12 does not support currency in check items. */
@Override
public Builder setCurrencyIfSupported(CurrencyUnit currency) {
return this;
}
@Override
public Builder setAvailIfSupported(boolean avail) {
return this;
}
@Override
public Builder setReasonIfSupported(String reason) {
return this;
}
@Override @Override
public FeeCheckResponseExtensionItemV12 build() { public FeeCheckResponseExtensionItemV12 build() {
getInstance().command = commandBuilder.build(); getInstance().command = commandBuilder.build();

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeCreateCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain create commands. */ /** A fee extension that may be present on domain create commands. */
@XmlRootElement(name = "create") @XmlRootElement(name = "create")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateCommandExtensionV12 public class FeeCreateCommandExtensionV12 extends FeeCreateCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeCreateResponseExtensionV12.Builder(); return new FeeTransformResponseExtension.Builder(new FeeCreateResponseExtensionV12());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "creData") @XmlRootElement(name = "creData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateResponseExtensionV12 extends FeeTransformResponseExtensionImpl { public class FeeCreateResponseExtensionV12 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeCreateResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeCreateResponseExtensionV12, Builder> {}
}

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,9 +24,12 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "delData") @XmlRootElement(name = "delData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeDeleteResponseExtensionV12 extends FeeTransformResponseExtensionImpl { public class FeeDeleteResponseExtensionV12 extends FeeTransformResponseExtension {
/** Builder for {@link FeeDeleteResponseExtensionV12}. */ /** Builder for {@link FeeDeleteResponseExtensionV12}. */
public static class Builder public static class Builder extends FeeTransformResponseExtension.Builder {
extends FeeTransformResponseExtensionImpl.Builder<FeeDeleteResponseExtensionV12, Builder> {} public Builder() {
super(new FeeDeleteResponseExtensionV12());
}
}
} }

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeRenewCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain renew commands. */ /** A fee extension that may be present on domain renew commands. */
@XmlRootElement(name = "renew") @XmlRootElement(name = "renew")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewCommandExtensionV12 public class FeeRenewCommandExtensionV12 extends FeeRenewCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeRenewResponseExtensionV12.Builder(); return new FeeTransformResponseExtension.Builder(new FeeRenewResponseExtensionV12());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "renData") @XmlRootElement(name = "renData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewResponseExtensionV12 extends FeeTransformResponseExtensionImpl { public class FeeRenewResponseExtensionV12 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeRenewResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeRenewResponseExtensionV12, Builder> {}
}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransferCommandExtension;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain transfer requests. */ /** A fee extension that may be present on domain transfer requests. */
@XmlRootElement(name = "transfer") @XmlRootElement(name = "transfer")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferCommandExtensionV12 public class FeeTransferCommandExtensionV12 extends FeeTransferCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeTransferResponseExtensionV12.Builder(); return new FeeTransformResponseExtension.Builder(new FeeTransferResponseExtensionV12());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "trnData") @XmlRootElement(name = "trnData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferResponseExtensionV12 extends FeeTransformResponseExtensionImpl { public class FeeTransferResponseExtensionV12 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeTransferResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeTransferResponseExtensionV12, Builder> {}
}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import com.google.common.collect.ImmutableList;
import google.registry.model.domain.fee.Credit;
import google.registry.model.domain.fee.FeeTransformResponseExtension; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import google.registry.model.domain.fee.FeeUpdateCommandExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain update commands. */ /** A fee extension that may be present on domain update commands. */
@XmlRootElement(name = "update") @XmlRootElement(name = "update")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateCommandExtensionV12 public class FeeUpdateCommandExtensionV12 extends FeeUpdateCommandExtension {
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override @Override
public FeeTransformResponseExtension.Builder createResponseBuilder() { public FeeTransformResponseExtension.Builder createResponseBuilder() {
return new FeeUpdateResponseExtensionV12.Builder(); return new FeeTransformResponseExtension.Builder(new FeeUpdateResponseExtensionV12());
} }
} }

View file

@ -14,7 +14,7 @@
package google.registry.model.domain.fee12; package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformResponseExtensionImpl; import google.registry.model.domain.fee.FeeTransformResponseExtension;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/ */
@XmlRootElement(name = "updData") @XmlRootElement(name = "updData")
@XmlType(propOrder = {"currency", "fees", "credits"}) @XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateResponseExtensionV12 extends FeeTransformResponseExtensionImpl { public class FeeUpdateResponseExtensionV12 extends FeeTransformResponseExtension {}
/** A builder for {@link FeeUpdateResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeUpdateResponseExtensionV12, Builder> {}
}

View file

@ -17,7 +17,6 @@ package google.registry.model.eppinput;
import static google.registry.util.CollectionUtils.nullSafeImmutableCopy; import static google.registry.util.CollectionUtils.nullSafeImmutableCopy;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy; import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import com.google.common.base.Optional;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -111,34 +110,6 @@ public class EppInput extends ImmutableObject {
return FluentIterable.from(getCommandWrapper().getExtensions()).filter(clazz).first().orNull(); return FluentIterable.from(getCommandWrapper().getExtensions()).filter(clazz).first().orNull();
} }
/** Get the extension based on type, or null, chosen from a list of possible extension classes.
* If there are extensions matching multiple classes, the first class listed is chosen. If there
* are multiple extensions of the same class, the first extension of that class is chosen
* (assuming that an extension matching a preceding class was not already chosen). This method is
* used to support multiple versions of an extension. Specify all supported versions, starting
* with the latest. The first-occurring extension of the latest version will be chosen, or failing
* that the first-occurring extension of the previous version, and so on.
*/
@Nullable
public <E extends CommandExtension>
E getFirstExtensionOfClasses(ImmutableList<Class<? extends E>> classes) {
for (Class<? extends E> clazz : classes) {
Optional<? extends E> extension = FluentIterable.from(
getCommandWrapper().getExtensions()).filter(clazz).first();
if (extension.isPresent()) {
return extension.get();
}
}
return null;
}
@SafeVarargs
@Nullable
public final <E extends CommandExtension>
E getFirstExtensionOfClasses(Class<? extends E>... classes) {
return getFirstExtensionOfClasses(ImmutableList.copyOf(classes));
}
/** A tag that goes inside of an EPP {@literal <command>}. */ /** A tag that goes inside of an EPP {@literal <command>}. */
public static class InnerCommand extends ImmutableObject {} public static class InnerCommand extends ImmutableObject {}

View file

@ -18,7 +18,6 @@ import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Maps.toMap; import static com.google.common.collect.Maps.toMap;
import static google.registry.flows.EppXmlTransformer.unmarshal; import static google.registry.flows.EppXmlTransformer.unmarshal;
import static google.registry.flows.picker.FlowPicker.getFlowClass; import static google.registry.flows.picker.FlowPicker.getFlowClass;
import static google.registry.model.domain.fee.Fee.FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER;
import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.util.CollectionUtils.isNullOrEmpty; import static google.registry.util.CollectionUtils.isNullOrEmpty;
import static google.registry.util.DomainNameUtils.ACE_PREFIX; import static google.registry.util.DomainNameUtils.ACE_PREFIX;
@ -58,6 +57,7 @@ import google.registry.flows.host.HostCreateFlow;
import google.registry.flows.host.HostDeleteFlow; import google.registry.flows.host.HostDeleteFlow;
import google.registry.flows.host.HostUpdateFlow; import google.registry.flows.host.HostUpdateFlow;
import google.registry.model.domain.DomainCommand; import google.registry.model.domain.DomainCommand;
import google.registry.model.domain.fee.FeeCreateCommandExtension;
import google.registry.model.domain.launch.LaunchCreateExtension; import google.registry.model.domain.launch.LaunchCreateExtension;
import google.registry.model.domain.secdns.SecDnsCreateExtension; import google.registry.model.domain.secdns.SecDnsCreateExtension;
import google.registry.model.domain.secdns.SecDnsUpdateExtension; import google.registry.model.domain.secdns.SecDnsUpdateExtension;
@ -143,8 +143,7 @@ public class VerifyOteAction implements Runnable, JsonAction {
private static final Predicate<EppInput> HAS_FEE = new Predicate<EppInput>() { private static final Predicate<EppInput> HAS_FEE = new Predicate<EppInput>() {
@Override @Override
public boolean apply(@Nonnull EppInput eppInput) { public boolean apply(@Nonnull EppInput eppInput) {
return eppInput.getFirstExtensionOfClasses( return eppInput.getSingleExtension(FeeCreateCommandExtension.class) != null;
FEE_CREATE_COMMAND_EXTENSIONS_IN_PREFERENCE_ORDER) != null;
}}; }};
private static final Predicate<EppInput> HAS_SEC_DNS = new Predicate<EppInput>() { private static final Predicate<EppInput> HAS_SEC_DNS = new Predicate<EppInput>() {

View file

@ -24,7 +24,6 @@ import google.registry.flows.ExtensionManager.UndeclaredServiceExtensionExceptio
import google.registry.flows.ExtensionManager.UnsupportedRepeatedExtensionException; import google.registry.flows.ExtensionManager.UnsupportedRepeatedExtensionException;
import google.registry.flows.exceptions.OnlyToolCanPassMetadataException; import google.registry.flows.exceptions.OnlyToolCanPassMetadataException;
import google.registry.flows.session.HelloFlow; import google.registry.flows.session.HelloFlow;
import google.registry.model.domain.allocate.AllocateCreateExtension;
import google.registry.model.domain.fee06.FeeInfoCommandExtensionV06; import google.registry.model.domain.fee06.FeeInfoCommandExtensionV06;
import google.registry.model.domain.launch.LaunchCreateExtension; import google.registry.model.domain.launch.LaunchCreateExtension;
import google.registry.model.domain.metadata.MetadataExtension; import google.registry.model.domain.metadata.MetadataExtension;
@ -68,23 +67,6 @@ public class ExtensionManagerTest {
manager.validate(); manager.validate();
} }
@Test
public void testMultipleExtensionsFromSameGroupForbidden() throws Exception {
ExtensionManager manager = new TestInstanceBuilder()
.setEppRequestSource(EppRequestSource.TOOL)
.setDeclaredUris(ServiceExtension.FEE_0_6.getUri())
.setSuppliedExtensions(
MetadataExtension.class,
LaunchCreateExtension.class,
AllocateCreateExtension.class)
.build();
manager.register(MetadataExtension.class);
manager.registerAsGroup(
ImmutableList.of(LaunchCreateExtension.class, AllocateCreateExtension.class));
thrown.expect(UnsupportedRepeatedExtensionException.class);
manager.validate();
}
@Test @Test
public void testUndeclaredExtensionsLogged() throws Exception { public void testUndeclaredExtensionsLogged() throws Exception {
TestLogHandler handler = new TestLogHandler(); TestLogHandler handler = new TestLogHandler();