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

@ -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.checkNotNull;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
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 java.math.BigDecimal;
import org.joda.time.DateTime;
@ -60,49 +44,8 @@ public class Fee extends BaseFee {
return instance;
}
public static final ImmutableList<
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_11.getUri(),
ServiceExtension.FEE_0_6.getUri());
public static final ImmutableSet<String> FEE_EXTENSION_URIS = ImmutableSet.of(
ServiceExtension.FEE_0_12.getUri(),
ServiceExtension.FEE_0_11.getUri(),
ServiceExtension.FEE_0_6.getUri());
}

View file

@ -14,19 +14,22 @@
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
* general query items (which cover Info commands as well), but may also contain a domain name,
* 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. */
public boolean isDomainNameSupported();
public abstract boolean isDomainNameSupported();
/** 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. */
public FeeCheckResponseExtensionItem.Builder createResponseBuilder();
public abstract FeeCheckResponseExtensionItem.Builder<?> createResponseBuilder();
}

View file

@ -14,20 +14,24 @@
package google.registry.model.domain.fee;
/**
* 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 {
import javax.xml.bind.annotation.XmlTransient;
/** 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. */
public Builder setDomainNameIfSupported(String name);
public FeeCheckResponseExtensionItem build();
public Builder<T> setDomainNameIfSupported(@SuppressWarnings("unused") String name) {
return this; // Default impl is a noop.
}
}
}

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;
import com.google.common.base.Optional;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.Period;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/**
* Interface for individual query items in Check and Info commands. Each item indicates the command
* to be checked, and the number of years for which the prices is requested. It may also contain the
* currency, but some versions of the fee extension specify the currency at the top level of the
* extension.
* Abstract base class for the fee request query items used in Check and Info commands. It handles
* the period, which is always present. Derived classes must handle the command, which may be
* implemented in different ways, and the currency, which may or may not be present, depending on
* 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. */
public enum CommandName {
@ -37,28 +40,35 @@ public interface FeeQueryCommandExtensionItem {
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.
*
* <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. */
public Optional<DateTime> getEffectiveDate();
public abstract Optional<DateTime> getEffectiveDate();
/** 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. */
public String getUnparsedCommandName();
/** The command name before being parsed into an enum, for use in error strings. */
public abstract String getUnparsedCommandName();
/** The phase of the command being checked. */
public String getPhase();
public abstract String getPhase();
/** 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;
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.fee.FeeQueryCommandExtensionItem.CommandName;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/**
* Interface for individual query items in Check and Info response. Each item indicates the fees and
* class associated with a particular command and period. The currency may also be listed, but some
* versions of the fee extension specify the currency at the top level of the extension.
* 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.
*/
public interface FeeQueryResponseExtensionItem {
@XmlTransient
public class FeeQueryResponseExtensionItem extends ImmutableObject {
/**
* The type of the fee. We will use "premium" for fees on premium names, and omit the field
* otherwise.
* The period that was checked.
*
* <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 {
/**
* 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.
*
* <p>This field is exposed to JAXB only via the getter so that subclasses can override it.
*/
@XmlTransient
List<Fee> fees;
/**
* If currency is not supported in this type of query response item for this version of the fee
* extension, this function has no effect.
*/
public Builder setCurrencyIfSupported(CurrencyUnit currency);
/**
* 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.
*/
@XmlTransient
String feeClass;
/** Whether this check item can be calculated. If so, reason should be null. If not, fees
* should not be set.
*/
public Builder setAvailIfSupported(boolean avail);
@XmlElement(name = "period")
public Period getPeriod() {
return period;
}
/** The reason that the check item cannot be calculated. */
public Builder setReasonIfSupported(String reason);
@XmlElement(name = "fee")
public ImmutableList<Fee> getFees() {
return nullToEmptyImmutableCopy(fees);
}
/** The effective date that the check is run on. */
public Builder setEffectiveDateIfSupported(DateTime effectiveDate);
@XmlElement(name = "class")
public String getFeeClass() {
return feeClass;
}
/** The date after which the quoted fees are no longer valid. */
public Builder setNotAfterDateIfSupported(DateTime notAfterDate);
/** Abstract builder for {@link FeeQueryResponseExtensionItemImpl}. */
public abstract static class
Builder<T extends FeeQueryResponseExtensionItem, B extends Builder<?, ?>>
extends GenericBuilder<T, B> {
public Builder setCommand(CommandName commandName, String phase, String subphase);
public abstract B setCommand(CommandName commandName, String phase, String subphase);
public Builder setPeriod(Period period);
public B setPeriod(Period period) {
getInstance().period = period;
return thisCastToDerived();
}
public Builder setFees(List<Fee> fees);
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 Builder setClass(String feeClass);
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;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
/** Interface for fee extensions in Create, Renew, Transfer and Update commands. */
public interface FeeTransformCommandExtension extends CommandExtension {
CurrencyUnit getCurrency();
List<Fee> getFees();
List<Credit> getCredits();
FeeTransformResponseExtension.Builder createResponseBuilder();
/** Base class for general transform commands with fees (create, renew, update, transfer). */
@XmlTransient
public abstract class FeeTransformCommandExtension
extends ImmutableObject implements CommandExtension {
/** 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;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import org.joda.money.CurrencyUnit;
/** Interface for fee extensions in Create, Renew, Transfer and Update responses. */
public interface FeeTransformResponseExtension extends ResponseExtension {
/** Base class for fee responses on general transform commands (create, update, renew, transfer). */
@XmlTransient
public class FeeTransformResponseExtension extends ImmutableObject implements ResponseExtension {
/** Builder for {@link FeeTransformResponseExtension}. */
public interface Builder {
Builder setCurrency(CurrencyUnit currency);
Builder setFees(List<Fee> fees);
Builder setCredits(List<Credit> credits);
FeeTransformResponseExtension build();
/** 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;
/** 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 google.registry.model.domain.fee.FeeCheckCommandExtensionItem;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItemImpl;
import google.registry.model.domain.fee.FeeExtensionCommandDescriptor;
import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** An individual price check item in version 0.6 of the fee extension on Check commands. */
@XmlType(propOrder = {"name", "currency", "command", "period"})
public class FeeCheckCommandExtensionItemV06
extends FeeQueryCommandExtensionItemImpl implements FeeCheckCommandExtensionItem {
public class FeeCheckCommandExtensionItemV06 extends FeeCheckCommandExtensionItem {
/** The fully qualified domain name being checked. */
String name;
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
public boolean isDomainNameSupported() {
return true;
@ -48,7 +73,7 @@ public class FeeCheckCommandExtensionItemV06
}
@Override
public FeeCheckResponseExtensionItem.Builder createResponseBuilder() {
public FeeCheckResponseExtensionItemV06.Builder createResponseBuilder() {
return new FeeCheckResponseExtensionItemV06.Builder();
}

View file

@ -15,24 +15,31 @@
package google.registry.model.domain.fee06;
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 org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** The version 0.6 response for a domain check on a single resource. */
@XmlType(propOrder = {"name", "currency", "command", "period", "fee", "feeClass"})
public class FeeCheckResponseExtensionItemV06
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
@XmlType(propOrder = {"name", "currency", "command", "period", "fees", "feeClass"})
public class FeeCheckResponseExtensionItemV06 extends FeeCheckResponseExtensionItem {
/** The name of the domain that was checked, with an attribute indicating if it is premium. */
String name;
CurrencyUnit currency;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeCheckResponseExtensionItemV06}. */
public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV06, Builder>
implements FeeCheckResponseExtensionItem.Builder {
extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV06> {
@Override
public Builder setCommand(CommandName commandName, String phase, String subphase) {
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return this;
}
@Override
public Builder setDomainNameIfSupported(String name) {
@ -45,26 +52,5 @@ public class FeeCheckResponseExtensionItemV06
getInstance().currency = currency;
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;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits;
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 javax.xml.bind.annotation.XmlRootElement;
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. */
@XmlRootElement(name = "create")
@XmlType(propOrder = {"currency", "fees"})
public class FeeCreateCommandExtensionV06
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
public class FeeCreateCommandExtensionV06 extends FeeCreateCommandExtension {
@Override
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;
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.XmlType;
@ -24,8 +26,11 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "creData")
@XmlType(propOrder = {"currency", "fees"})
public class FeeCreateResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits {
/** A builder for {@link FeeCreateResponseExtensionV06}. */
public static class Builder extends
FeeTransformResponseExtensionImplNoCredits.Builder<FeeCreateResponseExtensionV06, Builder> {}
public class FeeCreateResponseExtensionV06 extends FeeTransformResponseExtension {
/** This version of the extension doesn't support the "credit" field. */
@Override
public ImmutableList<Credit> getCredits() {
return ImmutableList.of();
}
}

View file

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

View file

@ -15,7 +15,8 @@
package google.registry.model.domain.fee06;
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 javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@ -26,11 +27,38 @@ import org.joda.time.DateTime;
@XmlRootElement(name = "info")
@XmlType(propOrder = {"currency", "command", "period"})
public class FeeInfoCommandExtensionV06
extends FeeQueryCommandExtensionItemImpl implements CommandExtension {
extends FeeQueryCommandExtensionItem implements CommandExtension {
/** A three-character ISO4217 currency code. */
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
public CurrencyUnit getCurrency() {
return currency;

View file

@ -14,54 +14,43 @@
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.FeeQueryResponseExtensionItemImpl;
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
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
* domain info commands.
*/
@XmlRootElement(name = "infData")
@XmlType(propOrder = {"currency", "command", "period", "fee", "feeClass"})
@XmlType(propOrder = {"currency", "command", "period", "fees", "feeClass"})
public class FeeInfoResponseExtensionV06
extends FeeQueryResponseExtensionItemImpl implements ResponseExtension {
extends FeeQueryResponseExtensionItem implements ResponseExtension {
CurrencyUnit currency;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeInfoResponseExtensionV06}. */
public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeInfoResponseExtensionV06, Builder> {
extends FeeQueryResponseExtensionItem.Builder<FeeInfoResponseExtensionV06, Builder> {
@Override
public Builder setAvailIfSupported(boolean avail) {
return this;
public Builder setCommand(CommandName commandName, String phase, String subphase) {
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return thisCastToDerived();
}
@Override
public Builder setReasonIfSupported(String reason) {
return this;
}
@Override
public FeeQueryResponseExtensionItem.Builder
setCurrencyIfSupported(CurrencyUnit currency) {
public Builder setCurrencyIfSupported(CurrencyUnit currency) {
getInstance().currency = currency;
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;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits;
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 javax.xml.bind.annotation.XmlRootElement;
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. */
@XmlRootElement(name = "renew")
@XmlType(propOrder = {"currency", "fees"})
public class FeeRenewCommandExtensionV06
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
public class FeeRenewCommandExtensionV06 extends FeeRenewCommandExtension {
@Override
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;
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.XmlType;
@ -24,8 +26,11 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "renData")
@XmlType(propOrder = {"currency", "fees"})
public class FeeRenewResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits {
/** A builder for {@link FeeRenewResponseExtensionV06}. */
public static class Builder extends
FeeTransformResponseExtensionImplNoCredits.Builder<FeeRenewResponseExtensionV06, Builder> {}
public class FeeRenewResponseExtensionV06 extends FeeTransformResponseExtension {
/** This version of the extension doesn't support the "credit" field. */
@Override
public ImmutableList<Credit> getCredits() {
return super.getCredits();
}
}

View file

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

View file

@ -14,20 +14,26 @@
package google.registry.model.domain.fee06;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImplNoCredits;
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.FeeUpdateCommandExtension;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain update commands. */
@XmlRootElement(name = "update")
@XmlType(propOrder = {"currency", "fees"})
public class FeeUpdateCommandExtensionV06
extends FeeTransformCommandExtensionImplNoCredits implements FeeTransformCommandExtension {
public class FeeUpdateCommandExtensionV06 extends FeeUpdateCommandExtension {
@Override
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;
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.XmlType;
@ -24,9 +26,11 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "updData")
@XmlType(propOrder = {"currency", "fees"})
public class FeeUpdateResponseExtensionV06 extends FeeTransformResponseExtensionImplNoCredits {
/** A builder for {@link FeeUpdateResponseExtensionV06}. */
public static class Builder
extends FeeTransformResponseExtensionImplNoCredits
.Builder<FeeUpdateResponseExtensionV06, Builder> {}
public class FeeUpdateResponseExtensionV06 extends FeeTransformResponseExtension {
/** This version of the extension doesn't support the "credit" field. */
@Override
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.FeeCheckCommandExtensionItem;
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.fee11.FeeCheckCommandExtensionV11.FeeCheckCommandExtensionItemV11;
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". */
class FeeCheckCommandExtensionItemV11 implements FeeCheckCommandExtensionItem {
class FeeCheckCommandExtensionItemV11 extends FeeCheckCommandExtensionItem {
/** The name of the command being checked. */
@Override
@ -135,7 +134,7 @@ public class FeeCheckCommandExtensionV11 extends ImmutableObject
}
@Override
public Builder createResponseBuilder() {
public FeeCheckResponseExtensionItemV11.Builder createResponseBuilder() {
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.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.XmlType;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/** The version 0.11 response for a domain check on a single resource. */
@XmlType(propOrder = {"object", "command", "currency", "period", "fee", "feeClass", "reason"})
public class FeeCheckResponseExtensionItemV11
extends FeeQueryResponseExtensionItemImpl implements FeeCheckResponseExtensionItem {
@XmlType(propOrder = {"object", "command", "currency", "period", "fees", "feeClass", "reason"})
public class FeeCheckResponseExtensionItemV11 extends FeeCheckResponseExtensionItem {
/** Whether the domain is available. */
@XmlAttribute
@ -39,10 +38,18 @@ public class FeeCheckResponseExtensionItemV11
/** The reason that the check item cannot be calculated. */
String reason;
/** The command that was checked. */
FeeExtensionCommandDescriptor command;
/** Builder for {@link FeeCheckResponseExtensionItemV11}. */
public static class Builder
extends FeeQueryResponseExtensionItemImpl.Builder<FeeCheckResponseExtensionItemV11, Builder>
implements FeeCheckResponseExtensionItem.Builder {
extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV11> {
@Override
public Builder setCommand(CommandName commandName, String phase, String subphase) {
getInstance().command = FeeExtensionCommandDescriptor.create(commandName, phase, subphase);
return this;
}
@Override
public Builder setDomainNameIfSupported(String name) {
@ -67,15 +74,5 @@ public class FeeCheckResponseExtensionItemV11
getInstance().reason = reason;
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;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain create commands. */
@XmlRootElement(name = "create")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateCommandExtensionV11
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeCreateCommandExtensionV11 extends FeeCreateCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "creData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeCreateResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeCreateResponseExtensionV11, Builder> {}
}
public class FeeCreateResponseExtensionV11 extends FeeTransformResponseExtension {}

View file

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

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain renew commands. */
@XmlRootElement(name = "renew")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewCommandExtensionV11
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeRenewCommandExtensionV11 extends FeeRenewCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "renData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeRenewResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeRenewResponseExtensionV11, Builder> {}
}
public class FeeRenewResponseExtensionV11 extends FeeTransformResponseExtension {}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain transfer requests. */
@XmlRootElement(name = "transfer")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferCommandExtensionV11
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeTransferCommandExtensionV11 extends FeeTransferCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "trnData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeTransferResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeTransferResponseExtensionV11, Builder> {}
}
public class FeeTransferResponseExtensionV11 extends FeeTransformResponseExtension {}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee11;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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.FeeUpdateCommandExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain update commands. */
@XmlRootElement(name = "update")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateCommandExtensionV11
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeUpdateCommandExtensionV11 extends FeeUpdateCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "updData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateResponseExtensionV11 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeUpdateResponseExtensionV11}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeUpdateResponseExtensionV11, Builder> {}
}
public class FeeUpdateResponseExtensionV11 extends FeeTransformResponseExtension {}

View file

@ -17,10 +17,8 @@ package google.registry.model.domain.fee12;
import com.google.common.base.Ascii;
import com.google.common.base.CharMatcher;
import com.google.common.base.Optional;
import google.registry.model.ImmutableObject;
import google.registry.model.domain.Period;
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.XmlElement;
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.
*/
@XmlType(propOrder = {"period", "feeClass", "feeDate"})
public class FeeCheckCommandExtensionItemV12
extends ImmutableObject implements FeeCheckCommandExtensionItem {
public class FeeCheckCommandExtensionItemV12 extends FeeCheckCommandExtensionItem {
/** The default validity period (if not specified) is 1 year for all operations. */
static final Period DEFAULT_PERIOD = Period.create(1, Period.Unit.YEARS);
@ -56,9 +53,6 @@ public class FeeCheckCommandExtensionItemV12
@XmlAttribute
String subphase;
@XmlElement
Period period;
@XmlElement(name = "class")
String feeClass;
@ -110,12 +104,7 @@ public class FeeCheckCommandExtensionItemV12
}
@Override
public Period getPeriod() {
return Optional.fromNullable(period).or(DEFAULT_PERIOD);
}
@Override
public FeeCheckResponseExtensionItem.Builder createResponseBuilder() {
public FeeCheckResponseExtensionItemV12.Builder createResponseBuilder() {
return new FeeCheckResponseExtensionItemV12.Builder();
}

View file

@ -17,24 +17,19 @@ package google.registry.model.domain.fee12;
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.DomainObjectSpec;
import google.registry.model.domain.Period;
import google.registry.model.domain.fee.Fee;
import google.registry.model.domain.fee.FeeCheckResponseExtensionItem;
import google.registry.model.domain.fee.FeeQueryCommandExtensionItem.CommandName;
import java.util.List;
import javax.xml.bind.annotation.XmlType;
import org.joda.money.CurrencyUnit;
import org.joda.time.DateTime;
/**
* The version 0.12 response for a domain check on a single resource.
*/
@XmlType(propOrder = {"object", "command"})
public class FeeCheckResponseExtensionItemV12
extends ImmutableObject implements FeeCheckResponseExtensionItem {
public class FeeCheckResponseExtensionItemV12 extends FeeCheckResponseExtensionItem {
/** The domain that was checked. */
DomainObjectSpec object;
@ -42,6 +37,28 @@ public class FeeCheckResponseExtensionItemV12
/** The command that was checked. */
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
public String getFeeClass() {
return command.getFeeClass();
@ -49,15 +66,10 @@ public class FeeCheckResponseExtensionItemV12
/** Builder for {@link FeeCheckResponseExtensionItemV12}. */
public static class Builder
extends GenericBuilder<FeeCheckResponseExtensionItemV12, Builder>
implements FeeCheckResponseExtensionItem.Builder {
extends FeeCheckResponseExtensionItem.Builder<FeeCheckResponseExtensionItemV12> {
final FeeCheckResponseExtensionItemCommandV12.Builder commandBuilder;
Builder() {
super();
commandBuilder = new FeeCheckResponseExtensionItemCommandV12.Builder();
}
final FeeCheckResponseExtensionItemCommandV12.Builder commandBuilder =
new FeeCheckResponseExtensionItemCommandV12.Builder();
@Override
public Builder setCommand(CommandName commandName, String phase, String subphase) {
@ -74,7 +86,7 @@ public class FeeCheckResponseExtensionItemV12
}
@Override
public Builder setFees(List<Fee> fees) {
public Builder setFees(ImmutableList<Fee> fees) {
commandBuilder.setFee(forceEmptyToNull(ImmutableList.copyOf(fees)));
return this;
}
@ -91,22 +103,6 @@ public class FeeCheckResponseExtensionItemV12
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
public FeeCheckResponseExtensionItemV12 build() {
getInstance().command = commandBuilder.build();

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain create commands. */
@XmlRootElement(name = "create")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateCommandExtensionV12
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeCreateCommandExtensionV12 extends FeeCreateCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "creData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeCreateResponseExtensionV12 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeCreateResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeCreateResponseExtensionV12, Builder> {}
}
public class FeeCreateResponseExtensionV12 extends FeeTransformResponseExtension {}

View file

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

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain renew commands. */
@XmlRootElement(name = "renew")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewCommandExtensionV12
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeRenewCommandExtensionV12 extends FeeRenewCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "renData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeRenewResponseExtensionV12 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeRenewResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeRenewResponseExtensionV12, Builder> {}
}
public class FeeRenewResponseExtensionV12 extends FeeTransformResponseExtension {}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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 java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain transfer requests. */
@XmlRootElement(name = "transfer")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferCommandExtensionV12
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeTransferCommandExtensionV12 extends FeeTransferCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "trnData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeTransferResponseExtensionV12 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeTransferResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeTransferResponseExtensionV12, Builder> {}
}
public class FeeTransferResponseExtensionV12 extends FeeTransformResponseExtension {}

View file

@ -14,20 +14,32 @@
package google.registry.model.domain.fee12;
import google.registry.model.domain.fee.FeeTransformCommandExtension;
import google.registry.model.domain.fee.FeeTransformCommandExtensionImpl;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
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.FeeUpdateCommandExtension;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/** A fee extension that may be present on domain update commands. */
@XmlRootElement(name = "update")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateCommandExtensionV12
extends FeeTransformCommandExtensionImpl implements FeeTransformCommandExtension {
public class FeeUpdateCommandExtensionV12 extends FeeUpdateCommandExtension {
@XmlElement(name = "credit")
List<Credit> credits;
@Override
public ImmutableList<Credit> getCredits() {
return nullToEmptyImmutableCopy(credits);
}
@Override
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;
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.XmlType;
@ -24,8 +24,4 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlRootElement(name = "updData")
@XmlType(propOrder = {"currency", "fees", "credits"})
public class FeeUpdateResponseExtensionV12 extends FeeTransformResponseExtensionImpl {
/** A builder for {@link FeeUpdateResponseExtensionV12}. */
public static class Builder
extends FeeTransformResponseExtensionImpl.Builder<FeeUpdateResponseExtensionV12, Builder> {}
}
public class FeeUpdateResponseExtensionV12 extends FeeTransformResponseExtension {}

View file

@ -17,7 +17,6 @@ package google.registry.model.eppinput;
import static google.registry.util.CollectionUtils.nullSafeImmutableCopy;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import com.google.common.base.Optional;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -111,34 +110,6 @@ public class EppInput extends ImmutableObject {
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>}. */
public static class InnerCommand extends ImmutableObject {}