mirror of
https://github.com/google/nomulus
synced 2025-12-23 14:25:44 +00:00
Convert more @AutoValues to records, particularly in custom flow classes (#2408)
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
@@ -22,7 +22,6 @@ import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowMetadata;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainCheckFlow;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppoutput.CheckData.DomainCheck;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
@@ -67,91 +66,83 @@ public class DomainCheckFlowCustomLogic extends BaseFlowCustomLogic {
|
||||
.build();
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
@AutoValue
|
||||
public abstract static class AfterValidationParameters extends ImmutableObject {
|
||||
|
||||
public abstract ImmutableMap<String, InternetDomainName> domainNames();
|
||||
|
||||
/**
|
||||
* The time to perform the domain check as of. This defaults to the current time, but can be
|
||||
* overridden in v>=0.12 of the fee extension.
|
||||
* A record to encapsulate parameters for a call to {@link #afterValidation}.
|
||||
*
|
||||
* @param domainNames A map of the domain names being checked, from domain name as string to
|
||||
* parsed value.
|
||||
* @param asOfDate The time to perform the domain check as of. This defaults to the current time,
|
||||
* but can be overridden in v>=0.12 of the fee extension.
|
||||
*/
|
||||
public abstract DateTime asOfDate();
|
||||
public record AfterValidationParameters(
|
||||
ImmutableMap<String, InternetDomainName> domainNames, DateTime asOfDate) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainCheckFlowCustomLogic_AfterValidationParameters.Builder();
|
||||
return new AutoBuilder_DomainCheckFlowCustomLogic_AfterValidationParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link AfterValidationParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setDomainNames(ImmutableMap<String, InternetDomainName> domainNames);
|
||||
Builder setDomainNames(ImmutableMap<String, InternetDomainName> domainNames);
|
||||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract AfterValidationParameters build();
|
||||
AfterValidationParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseParameters extends ImmutableObject {
|
||||
|
||||
public abstract ImmutableList<DomainCheck> domainChecks();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
|
||||
/**
|
||||
* The time to perform the domain check as of. This defaults to the current time, but can be
|
||||
* overridden in v>=0.12 of the fee extension.
|
||||
* A record to encapsulate parameters for a call to {@link #beforeResponse}.
|
||||
*
|
||||
* @param asOfDate The time to perform the domain check as of. This defaults to the current time,
|
||||
* but can be overridden in v>=0.12 of the fee extension.
|
||||
*/
|
||||
public abstract DateTime asOfDate();
|
||||
public record BeforeResponseParameters(
|
||||
ImmutableList<DomainCheck> domainChecks,
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions,
|
||||
DateTime asOfDate) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainCheckFlowCustomLogic_BeforeResponseParameters.Builder();
|
||||
return new AutoBuilder_DomainCheckFlowCustomLogic_BeforeResponseParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setDomainChecks(ImmutableList<DomainCheck> domainChecks);
|
||||
Builder setDomainChecks(ImmutableList<DomainCheck> domainChecks);
|
||||
|
||||
public abstract Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
Builder setResponseExtensions(ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract BeforeResponseParameters build();
|
||||
BeforeResponseParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}.
|
||||
* A record to encapsulate parameters for the return values from a call to {@link
|
||||
* #beforeResponse}.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseReturnData extends ImmutableObject {
|
||||
|
||||
public abstract ImmutableList<DomainCheck> domainChecks();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
public record BeforeResponseReturnData(
|
||||
ImmutableList<DomainCheck> domainChecks,
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainCheckFlowCustomLogic_BeforeResponseReturnData.Builder();
|
||||
return new AutoBuilder_DomainCheckFlowCustomLogic_BeforeResponseReturnData_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseReturnData}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setDomainChecks(ImmutableList<DomainCheck> domainChecks);
|
||||
Builder setDomainChecks(ImmutableList<DomainCheck> domainChecks);
|
||||
|
||||
public abstract Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
Builder setResponseExtensions(ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseReturnData build();
|
||||
BeforeResponseReturnData build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,13 @@
|
||||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowMetadata;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainCreateFlow;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseData;
|
||||
@@ -81,147 +80,114 @@ public class DomainCreateFlowCustomLogic extends BaseFlowCustomLogic {
|
||||
.build();
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
@AutoValue
|
||||
public abstract static class AfterValidationParameters extends ImmutableObject {
|
||||
|
||||
/** The parsed domain name of the domain that is requested to be created. */
|
||||
public abstract InternetDomainName domainName();
|
||||
|
||||
/**
|
||||
* The number of years that the domain name will be registered for.
|
||||
* A record to encapsulate parameters for a call to {@link #afterValidation}.
|
||||
*
|
||||
* <p>On standard TLDs, this is usually 1.
|
||||
* @param domainName The parsed domain name of the domain that is requested to be created.
|
||||
* @param years The number of years that the domain name will be registered for (typically 1).
|
||||
* @param signedMarkId The ID of the validated signed mark, or absent if not supplied.
|
||||
*/
|
||||
public abstract int years();
|
||||
|
||||
/**
|
||||
* The ID of the validated signed mark.
|
||||
*
|
||||
* <p>If a signed mark was not supplied, this value will be absent.
|
||||
*/
|
||||
public abstract Optional<String> signedMarkId();
|
||||
public record AfterValidationParameters(
|
||||
InternetDomainName domainName, int years, Optional<String> signedMarkId) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainCreateFlowCustomLogic_AfterValidationParameters.Builder();
|
||||
return new AutoBuilder_DomainCreateFlowCustomLogic_AfterValidationParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link AfterValidationParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||
Builder setDomainName(InternetDomainName domainName);
|
||||
|
||||
public abstract Builder setYears(int years);
|
||||
Builder setYears(int years);
|
||||
|
||||
public abstract Builder setSignedMarkId(Optional<String> signedMarkId);
|
||||
Builder setSignedMarkId(Optional<String> signedMarkId);
|
||||
|
||||
public abstract AfterValidationParameters build();
|
||||
AfterValidationParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #beforeSave}. */
|
||||
@AutoValue
|
||||
public abstract static class BeforeSaveParameters extends ImmutableObject {
|
||||
|
||||
/**
|
||||
* The new {@link Domain} entity that is going to be persisted at the end of the transaction.
|
||||
*/
|
||||
public abstract Domain newDomain();
|
||||
|
||||
/**
|
||||
* The new {@link HistoryEntry} entity for the domain's creation that is going to be persisted
|
||||
* at the end of the transaction.
|
||||
*/
|
||||
public abstract HistoryEntry historyEntry();
|
||||
|
||||
/**
|
||||
* The collection of {@link EntityChanges} (including new entities and those to delete) that
|
||||
* will be persisted at the end of the transaction.
|
||||
* A record to encapsulate parameters for a call to {@link #beforeSave}.
|
||||
*
|
||||
* <p>Note that the new domain and history entry are also included as saves in this collection,
|
||||
* and are separated out above solely for convenience, as they are most likely to need to be
|
||||
* changed. Removing them from the collection will cause them not to be saved, which is most
|
||||
* likely not what you intended.
|
||||
* @param newDomain The new {@link Domain} entity that is going to be persisted at the end of the
|
||||
* transaction.
|
||||
* @param historyEntry The new {@link HistoryEntry} entity for the domain's creation that is going
|
||||
* to be persisted at the end of the transaction.
|
||||
* @param entityChanges The collection of {@link EntityChanges} (including new entities and those
|
||||
* to delete) that will be persisted at the end of the transaction.
|
||||
* <p>Note that the new domain and history entry are also included as saves in this
|
||||
* collection, and are separated out above solely for convenience, as they are most likely to
|
||||
* need to be changed. Removing them from the collection will cause them not to be saved,
|
||||
* which is most likely not what you intended.
|
||||
* @param years The number of years that the domain name will be registered for (typically 1).
|
||||
*/
|
||||
public abstract EntityChanges entityChanges();
|
||||
|
||||
/**
|
||||
* The number of years that the domain name will be registered for.
|
||||
*
|
||||
* <p>On standard TLDs, this is usually 1.
|
||||
*/
|
||||
public abstract int years();
|
||||
public record BeforeSaveParameters(
|
||||
Domain newDomain, HistoryEntry historyEntry, EntityChanges entityChanges, int years) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainCreateFlowCustomLogic_BeforeSaveParameters.Builder();
|
||||
return new AutoBuilder_DomainCreateFlowCustomLogic_BeforeSaveParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeSaveParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setNewDomain(Domain newDomain);
|
||||
Builder setNewDomain(Domain newDomain);
|
||||
|
||||
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
|
||||
public abstract Builder setEntityChanges(EntityChanges entityChanges);
|
||||
Builder setEntityChanges(EntityChanges entityChanges);
|
||||
|
||||
public abstract Builder setYears(int years);
|
||||
Builder setYears(int years);
|
||||
|
||||
public abstract BeforeSaveParameters build();
|
||||
BeforeSaveParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseParameters extends ImmutableObject {
|
||||
|
||||
public abstract ResponseData resData();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
/** A record to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
public record BeforeResponseParameters(
|
||||
ResponseData resData, ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static BeforeResponseParameters.Builder newBuilder() {
|
||||
return new AutoValue_DomainCreateFlowCustomLogic_BeforeResponseParameters.Builder();
|
||||
return new AutoBuilder_DomainCreateFlowCustomLogic_BeforeResponseParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link DomainCreateFlowCustomLogic.BeforeResponseParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract BeforeResponseParameters.Builder setResData(ResponseData resData);
|
||||
BeforeResponseParameters.Builder setResData(ResponseData resData);
|
||||
|
||||
public abstract BeforeResponseParameters.Builder setResponseExtensions(
|
||||
BeforeResponseParameters.Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseParameters build();
|
||||
BeforeResponseParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}.
|
||||
* A record to encapsulate parameters for the return values from a call to {@link
|
||||
* #beforeResponse}.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseReturnData extends ImmutableObject {
|
||||
|
||||
public abstract ResponseData resData();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
public record BeforeResponseReturnData(
|
||||
ResponseData resData, ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static BeforeResponseReturnData.Builder newBuilder() {
|
||||
return new AutoValue_DomainCreateFlowCustomLogic_BeforeResponseReturnData.Builder();
|
||||
return new AutoBuilder_DomainCreateFlowCustomLogic_BeforeResponseReturnData_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link DomainCreateFlowCustomLogic.BeforeResponseReturnData}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract BeforeResponseReturnData.Builder setResData(ResponseData resData);
|
||||
BeforeResponseReturnData.Builder setResData(ResponseData resData);
|
||||
|
||||
public abstract BeforeResponseReturnData.Builder setResponseExtensions(
|
||||
BeforeResponseReturnData.Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseReturnData build();
|
||||
BeforeResponseReturnData build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowMetadata;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainDeleteFlow;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||
@@ -79,112 +78,96 @@ public class DomainDeleteFlowCustomLogic extends BaseFlowCustomLogic {
|
||||
.build();
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
@AutoValue
|
||||
public abstract static class AfterValidationParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain existingDomain();
|
||||
/** A record to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
public record AfterValidationParameters(Domain existingDomain) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainDeleteFlowCustomLogic_AfterValidationParameters.Builder();
|
||||
return new AutoBuilder_DomainDeleteFlowCustomLogic_AfterValidationParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link AfterValidationParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setExistingDomain(Domain existingDomain);
|
||||
Builder setExistingDomain(Domain existingDomain);
|
||||
|
||||
public abstract AfterValidationParameters build();
|
||||
AfterValidationParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for a call to {@link #beforeSave}.
|
||||
* A record to encapsulate parameters for a call to {@link #beforeSave}.
|
||||
*
|
||||
* <p>Note that both newDomain and historyEntry are included in entityChanges. They are also
|
||||
* passed separately for convenience, but they are the same instance, and changes to them will
|
||||
* also affect what is persisted from entityChanges.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeSaveParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain existingDomain();
|
||||
|
||||
public abstract Domain newDomain();
|
||||
|
||||
public abstract HistoryEntry historyEntry();
|
||||
|
||||
public abstract EntityChanges entityChanges();
|
||||
public record BeforeSaveParameters(
|
||||
Domain existingDomain,
|
||||
Domain newDomain,
|
||||
HistoryEntry historyEntry,
|
||||
EntityChanges entityChanges) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainDeleteFlowCustomLogic_BeforeSaveParameters.Builder();
|
||||
return new AutoBuilder_DomainDeleteFlowCustomLogic_BeforeSaveParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeSaveParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setExistingDomain(Domain existingDomain);
|
||||
Builder setExistingDomain(Domain existingDomain);
|
||||
|
||||
public abstract Builder setNewDomain(Domain newDomain);
|
||||
Builder setNewDomain(Domain newDomain);
|
||||
|
||||
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
|
||||
public abstract Builder setEntityChanges(EntityChanges entityChanges);
|
||||
Builder setEntityChanges(EntityChanges entityChanges);
|
||||
|
||||
public abstract BeforeSaveParameters build();
|
||||
BeforeSaveParameters build();
|
||||
}
|
||||
}
|
||||
/** A class to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseParameters extends ImmutableObject {
|
||||
|
||||
public abstract Result.Code resultCode();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
/** A record to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
public record BeforeResponseParameters(
|
||||
Result.Code resultCode, ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainDeleteFlowCustomLogic_BeforeResponseParameters.Builder();
|
||||
return new AutoBuilder_DomainDeleteFlowCustomLogic_BeforeResponseParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setResultCode(Result.Code resultCode);
|
||||
Builder setResultCode(Result.Code resultCode);
|
||||
|
||||
public abstract Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
Builder setResponseExtensions(ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseParameters build();
|
||||
BeforeResponseParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}.
|
||||
* A record to encapsulate parameters for the return values from a call to {@link
|
||||
* #beforeResponse}.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseReturnData extends ImmutableObject {
|
||||
|
||||
public abstract Result.Code resultCode();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
public record BeforeResponseReturnData(
|
||||
Result.Code resultCode, ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainDeleteFlowCustomLogic_BeforeResponseReturnData.Builder();
|
||||
return new AutoBuilder_DomainDeleteFlowCustomLogic_BeforeResponseReturnData_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseReturnData}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setResultCode(Result.Code resultCode);
|
||||
Builder setResultCode(Result.Code resultCode);
|
||||
|
||||
public abstract Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
Builder setResponseExtensions(ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseReturnData build();
|
||||
BeforeResponseReturnData build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,12 @@
|
||||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowMetadata;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainInfoFlow;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.domain.DomainInfoData;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
@@ -65,79 +64,67 @@ public class DomainInfoFlowCustomLogic extends BaseFlowCustomLogic {
|
||||
.build();
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
@AutoValue
|
||||
public abstract static class AfterValidationParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain domain();
|
||||
/** A record to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
public record AfterValidationParameters(Domain domain) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainInfoFlowCustomLogic_AfterValidationParameters.Builder();
|
||||
return new AutoBuilder_DomainInfoFlowCustomLogic_AfterValidationParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link AfterValidationParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setDomain(Domain domain);
|
||||
Builder setDomain(Domain domain);
|
||||
|
||||
public abstract AfterValidationParameters build();
|
||||
AfterValidationParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain domain();
|
||||
|
||||
public abstract DomainInfoData resData();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
/** A record to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
public record BeforeResponseParameters(
|
||||
Domain domain,
|
||||
DomainInfoData resData,
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainInfoFlowCustomLogic_BeforeResponseParameters.Builder();
|
||||
return new AutoBuilder_DomainInfoFlowCustomLogic_BeforeResponseParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setDomain(Domain domain);
|
||||
Builder setDomain(Domain domain);
|
||||
|
||||
public abstract Builder setResData(DomainInfoData resData);
|
||||
Builder setResData(DomainInfoData resData);
|
||||
|
||||
public abstract Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
Builder setResponseExtensions(ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseParameters build();
|
||||
BeforeResponseParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}.
|
||||
* A record to encapsulate parameters for the return values from a call to {@link
|
||||
* #beforeResponse}.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseReturnData extends ImmutableObject {
|
||||
|
||||
public abstract DomainInfoData resData();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
public record BeforeResponseReturnData(
|
||||
DomainInfoData resData, ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainInfoFlowCustomLogic_BeforeResponseReturnData.Builder();
|
||||
return new AutoBuilder_DomainInfoFlowCustomLogic_BeforeResponseReturnData_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseReturnData}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setResData(DomainInfoData resData);
|
||||
Builder setResData(DomainInfoData resData);
|
||||
|
||||
public abstract Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
Builder setResponseExtensions(ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseReturnData build();
|
||||
BeforeResponseReturnData build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,13 @@
|
||||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowMetadata;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainPricingLogic;
|
||||
import google.registry.flows.domain.FeesAndCredits;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.tld.Tld;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -75,171 +74,135 @@ public class DomainPricingCustomLogic extends BaseFlowCustomLogic {
|
||||
return priceParameters.feesAndCredits();
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #customizeCreatePrice} . */
|
||||
@AutoValue
|
||||
public abstract static class CreatePriceParameters extends ImmutableObject {
|
||||
|
||||
public abstract FeesAndCredits feesAndCredits();
|
||||
|
||||
public abstract Tld tld();
|
||||
|
||||
public abstract InternetDomainName domainName();
|
||||
|
||||
public abstract DateTime asOfDate();
|
||||
|
||||
public abstract int years();
|
||||
/** A record to encapsulate parameters for a call to {@link #customizeCreatePrice} . */
|
||||
public record CreatePriceParameters(
|
||||
FeesAndCredits feesAndCredits,
|
||||
Tld tld,
|
||||
InternetDomainName domainName,
|
||||
DateTime asOfDate,
|
||||
int years) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainPricingCustomLogic_CreatePriceParameters.Builder();
|
||||
return new AutoBuilder_DomainPricingCustomLogic_CreatePriceParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link CreatePriceParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
|
||||
public abstract Builder setTld(Tld tld);
|
||||
Builder setTld(Tld tld);
|
||||
|
||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||
Builder setDomainName(InternetDomainName domainName);
|
||||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract Builder setYears(int years);
|
||||
Builder setYears(int years);
|
||||
|
||||
public abstract CreatePriceParameters build();
|
||||
CreatePriceParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #customizeRenewPrice} . */
|
||||
@AutoValue
|
||||
public abstract static class RenewPriceParameters extends ImmutableObject {
|
||||
|
||||
public abstract FeesAndCredits feesAndCredits();
|
||||
|
||||
public abstract Tld tld();
|
||||
|
||||
public abstract InternetDomainName domainName();
|
||||
|
||||
public abstract DateTime asOfDate();
|
||||
|
||||
public abstract int years();
|
||||
/** A record to encapsulate parameters for a call to {@link #customizeRenewPrice} . */
|
||||
public record RenewPriceParameters(
|
||||
FeesAndCredits feesAndCredits,
|
||||
Tld tld,
|
||||
InternetDomainName domainName,
|
||||
DateTime asOfDate,
|
||||
int years) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainPricingCustomLogic_RenewPriceParameters.Builder();
|
||||
return new AutoBuilder_DomainPricingCustomLogic_RenewPriceParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link RenewPriceParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
|
||||
public abstract Builder setTld(Tld tld);
|
||||
Builder setTld(Tld tld);
|
||||
|
||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||
Builder setDomainName(InternetDomainName domainName);
|
||||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract Builder setYears(int years);
|
||||
Builder setYears(int years);
|
||||
|
||||
public abstract RenewPriceParameters build();
|
||||
RenewPriceParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #customizeRestorePrice} . */
|
||||
@AutoValue
|
||||
public abstract static class RestorePriceParameters extends ImmutableObject {
|
||||
|
||||
public abstract FeesAndCredits feesAndCredits();
|
||||
|
||||
public abstract Tld tld();
|
||||
|
||||
public abstract InternetDomainName domainName();
|
||||
|
||||
public abstract DateTime asOfDate();
|
||||
/** A record to encapsulate parameters for a call to {@link #customizeRestorePrice} . */
|
||||
public record RestorePriceParameters(
|
||||
FeesAndCredits feesAndCredits, Tld tld, InternetDomainName domainName, DateTime asOfDate) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainPricingCustomLogic_RestorePriceParameters.Builder();
|
||||
return new AutoBuilder_DomainPricingCustomLogic_RestorePriceParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link RestorePriceParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
|
||||
public abstract Builder setTld(Tld tld);
|
||||
Builder setTld(Tld tld);
|
||||
|
||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||
Builder setDomainName(InternetDomainName domainName);
|
||||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract RestorePriceParameters build();
|
||||
RestorePriceParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #customizeTransferPrice} . */
|
||||
@AutoValue
|
||||
public abstract static class TransferPriceParameters extends ImmutableObject {
|
||||
|
||||
public abstract FeesAndCredits feesAndCredits();
|
||||
|
||||
public abstract Tld tld();
|
||||
|
||||
public abstract InternetDomainName domainName();
|
||||
|
||||
public abstract DateTime asOfDate();
|
||||
/** A record to encapsulate parameters for a call to {@link #customizeTransferPrice} . */
|
||||
public record TransferPriceParameters(
|
||||
FeesAndCredits feesAndCredits, Tld tld, InternetDomainName domainName, DateTime asOfDate) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainPricingCustomLogic_TransferPriceParameters.Builder();
|
||||
return new AutoBuilder_DomainPricingCustomLogic_TransferPriceParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link TransferPriceParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
|
||||
public abstract Builder setTld(Tld tld);
|
||||
Builder setTld(Tld tld);
|
||||
|
||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||
Builder setDomainName(InternetDomainName domainName);
|
||||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract TransferPriceParameters build();
|
||||
TransferPriceParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #customizeUpdatePrice} . */
|
||||
@AutoValue
|
||||
public abstract static class UpdatePriceParameters extends ImmutableObject {
|
||||
|
||||
public abstract FeesAndCredits feesAndCredits();
|
||||
|
||||
public abstract Tld tld();
|
||||
|
||||
public abstract InternetDomainName domainName();
|
||||
|
||||
public abstract DateTime asOfDate();
|
||||
/** A record to encapsulate parameters for a call to {@link #customizeUpdatePrice} . */
|
||||
public record UpdatePriceParameters(
|
||||
FeesAndCredits feesAndCredits, Tld tld, InternetDomainName domainName, DateTime asOfDate) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainPricingCustomLogic_UpdatePriceParameters.Builder();
|
||||
return new AutoBuilder_DomainPricingCustomLogic_UpdatePriceParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link UpdatePriceParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
Builder setFeesAndCredits(FeesAndCredits feesAndCredits);
|
||||
|
||||
public abstract Builder setTld(Tld tld);
|
||||
Builder setTld(Tld tld);
|
||||
|
||||
public abstract Builder setDomainName(InternetDomainName domainName);
|
||||
Builder setDomainName(InternetDomainName domainName);
|
||||
|
||||
public abstract Builder setAsOfDate(DateTime asOfDate);
|
||||
Builder setAsOfDate(DateTime asOfDate);
|
||||
|
||||
public abstract UpdatePriceParameters build();
|
||||
UpdatePriceParameters build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,11 @@
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowMetadata;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainRenewFlow;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseData;
|
||||
@@ -103,103 +101,89 @@ public class DomainRenewFlowCustomLogic extends BaseFlowCustomLogic {
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for a call to {@link #beforeSave}.
|
||||
* A record to encapsulate parameters for a call to {@link #beforeSave}.
|
||||
*
|
||||
* <p>Note that both newDomain and historyEntry are included in entityChanges. They are also
|
||||
* passed separately for convenience, but they are the same instance, and changes to them will
|
||||
* also affect what is persisted from entityChanges.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeSaveParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain existingDomain();
|
||||
|
||||
public abstract Domain newDomain();
|
||||
|
||||
public abstract HistoryEntry historyEntry();
|
||||
|
||||
public abstract EntityChanges entityChanges();
|
||||
|
||||
public abstract int years();
|
||||
|
||||
public abstract DateTime now();
|
||||
public record BeforeSaveParameters(
|
||||
Domain existingDomain,
|
||||
Domain newDomain,
|
||||
HistoryEntry historyEntry,
|
||||
EntityChanges entityChanges,
|
||||
int years,
|
||||
DateTime now) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainRenewFlowCustomLogic_BeforeSaveParameters.Builder();
|
||||
return new AutoBuilder_DomainRenewFlowCustomLogic_BeforeSaveParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeSaveParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setExistingDomain(Domain existingDomain);
|
||||
Builder setExistingDomain(Domain existingDomain);
|
||||
|
||||
public abstract Builder setNewDomain(Domain newDomain);
|
||||
Builder setNewDomain(Domain newDomain);
|
||||
|
||||
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
|
||||
public abstract Builder setEntityChanges(EntityChanges entityChanges);
|
||||
Builder setEntityChanges(EntityChanges entityChanges);
|
||||
|
||||
public abstract Builder setYears(int years);
|
||||
Builder setYears(int years);
|
||||
|
||||
public abstract Builder setNow(DateTime now);
|
||||
Builder setNow(DateTime now);
|
||||
|
||||
public abstract BeforeSaveParameters build();
|
||||
BeforeSaveParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain domain();
|
||||
|
||||
public abstract ResponseData resData();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
/** A record to encapsulate parameters for a call to {@link #beforeResponse}. */
|
||||
public record BeforeResponseParameters(
|
||||
Domain domain,
|
||||
ResponseData resData,
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static BeforeResponseParameters.Builder newBuilder() {
|
||||
return new AutoValue_DomainRenewFlowCustomLogic_BeforeResponseParameters.Builder();
|
||||
return new AutoBuilder_DomainRenewFlowCustomLogic_BeforeResponseParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract BeforeResponseParameters.Builder setDomain(Domain domain);
|
||||
BeforeResponseParameters.Builder setDomain(Domain domain);
|
||||
|
||||
public abstract BeforeResponseParameters.Builder setResData(ResponseData resData);
|
||||
BeforeResponseParameters.Builder setResData(ResponseData resData);
|
||||
|
||||
public abstract BeforeResponseParameters.Builder setResponseExtensions(
|
||||
BeforeResponseParameters.Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseParameters build();
|
||||
BeforeResponseParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for the return values from a call to {@link #beforeResponse}.
|
||||
* A record to encapsulate parameters for the return values from a call to {@link
|
||||
* #beforeResponse}.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeResponseReturnData extends ImmutableObject {
|
||||
|
||||
public abstract ResponseData resData();
|
||||
|
||||
public abstract ImmutableList<? extends ResponseExtension> responseExtensions();
|
||||
public record BeforeResponseReturnData(
|
||||
ResponseData resData, ImmutableList<? extends ResponseExtension> responseExtensions) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainRenewFlowCustomLogic_BeforeResponseReturnData.Builder();
|
||||
return new AutoBuilder_DomainRenewFlowCustomLogic_BeforeResponseReturnData_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeResponseReturnData}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setResData(ResponseData resData);
|
||||
Builder setResData(ResponseData resData);
|
||||
|
||||
public abstract Builder setResponseExtensions(
|
||||
ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
Builder setResponseExtensions(ImmutableList<? extends ResponseExtension> responseExtensions);
|
||||
|
||||
public abstract BeforeResponseReturnData build();
|
||||
BeforeResponseReturnData build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowMetadata;
|
||||
import google.registry.flows.SessionMetadata;
|
||||
import google.registry.flows.domain.DomainUpdateFlow;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.domain.Domain;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
@@ -61,61 +60,53 @@ public class DomainUpdateFlowCustomLogic extends BaseFlowCustomLogic {
|
||||
return parameters.entityChanges();
|
||||
}
|
||||
|
||||
/** A class to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
@AutoValue
|
||||
public abstract static class AfterValidationParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain existingDomain();
|
||||
/** A record to encapsulate parameters for a call to {@link #afterValidation}. */
|
||||
public record AfterValidationParameters(Domain existingDomain) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainUpdateFlowCustomLogic_AfterValidationParameters.Builder();
|
||||
return new AutoBuilder_DomainUpdateFlowCustomLogic_AfterValidationParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link AfterValidationParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setExistingDomain(Domain existingDomain);
|
||||
Builder setExistingDomain(Domain existingDomain);
|
||||
|
||||
public abstract AfterValidationParameters build();
|
||||
AfterValidationParameters build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class to encapsulate parameters for a call to {@link #beforeSave}.
|
||||
* A record to encapsulate parameters for a call to {@link #beforeSave}.
|
||||
*
|
||||
* <p>Note that both newDomain and historyEntry are included in entityChanges. They are also
|
||||
* passed separately for convenience, but they are the same instance, and changes to them will
|
||||
* also affect what is persisted from entityChanges.
|
||||
*/
|
||||
@AutoValue
|
||||
public abstract static class BeforeSaveParameters extends ImmutableObject {
|
||||
|
||||
public abstract Domain existingDomain();
|
||||
|
||||
public abstract Domain newDomain();
|
||||
|
||||
public abstract HistoryEntry historyEntry();
|
||||
|
||||
public abstract EntityChanges entityChanges();
|
||||
public record BeforeSaveParameters(
|
||||
Domain existingDomain,
|
||||
Domain newDomain,
|
||||
HistoryEntry historyEntry,
|
||||
EntityChanges entityChanges) {
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new AutoValue_DomainUpdateFlowCustomLogic_BeforeSaveParameters.Builder();
|
||||
return new AutoBuilder_DomainUpdateFlowCustomLogic_BeforeSaveParameters_Builder();
|
||||
}
|
||||
|
||||
/** Builder for {@link BeforeSaveParameters}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setExistingDomain(Domain existingDomain);
|
||||
Builder setExistingDomain(Domain existingDomain);
|
||||
|
||||
public abstract Builder setNewDomain(Domain newDomain);
|
||||
Builder setNewDomain(Domain newDomain);
|
||||
|
||||
public abstract Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
Builder setHistoryEntry(HistoryEntry historyEntry);
|
||||
|
||||
public abstract Builder setEntityChanges(EntityChanges entityChanges);
|
||||
Builder setEntityChanges(EntityChanges entityChanges);
|
||||
|
||||
public abstract BeforeSaveParameters build();
|
||||
BeforeSaveParameters build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,49 +14,55 @@
|
||||
|
||||
package google.registry.flows.custom;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.auto.value.AutoBuilder;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.persistence.VKey;
|
||||
|
||||
/** A wrapper class that encapsulates database entities to both save and delete. */
|
||||
@AutoValue
|
||||
public abstract class EntityChanges {
|
||||
/** A record that encapsulates database entities to both save and delete. */
|
||||
public record EntityChanges(
|
||||
ImmutableSet<ImmutableObject> saves, ImmutableSet<VKey<ImmutableObject>> deletes) {
|
||||
|
||||
public abstract ImmutableSet<ImmutableObject> getSaves();
|
||||
public ImmutableSet<ImmutableObject> getSaves() {
|
||||
return saves;
|
||||
}
|
||||
;
|
||||
|
||||
public abstract ImmutableSet<VKey<ImmutableObject>> getDeletes();
|
||||
public ImmutableSet<VKey<ImmutableObject>> getDeletes() {
|
||||
return deletes;
|
||||
}
|
||||
;
|
||||
|
||||
public static Builder newBuilder() {
|
||||
// Default both entities to save and entities to delete to empty sets, so that the build()
|
||||
// method won't subsequently throw an exception if one doesn't end up being applicable.
|
||||
return new AutoValue_EntityChanges.Builder()
|
||||
return new AutoBuilder_EntityChanges_Builder()
|
||||
.setSaves(ImmutableSet.of())
|
||||
.setDeletes(ImmutableSet.of());
|
||||
}
|
||||
|
||||
/** Builder for {@link EntityChanges}. */
|
||||
@AutoValue.Builder
|
||||
public abstract static class Builder {
|
||||
@AutoBuilder
|
||||
public interface Builder {
|
||||
|
||||
public abstract Builder setSaves(ImmutableSet<ImmutableObject> entitiesToSave);
|
||||
Builder setSaves(ImmutableSet<ImmutableObject> entitiesToSave);
|
||||
|
||||
public abstract ImmutableSet.Builder<ImmutableObject> savesBuilder();
|
||||
ImmutableSet.Builder<ImmutableObject> savesBuilder();
|
||||
|
||||
public Builder addSave(ImmutableObject entityToSave) {
|
||||
default Builder addSave(ImmutableObject entityToSave) {
|
||||
savesBuilder().add(entityToSave);
|
||||
return this;
|
||||
}
|
||||
|
||||
public abstract Builder setDeletes(ImmutableSet<VKey<ImmutableObject>> entitiesToDelete);
|
||||
Builder setDeletes(ImmutableSet<VKey<ImmutableObject>> entitiesToDelete);
|
||||
|
||||
public abstract ImmutableSet.Builder<VKey<ImmutableObject>> deletesBuilder();
|
||||
ImmutableSet.Builder<VKey<ImmutableObject>> deletesBuilder();
|
||||
|
||||
public Builder addDelete(VKey<ImmutableObject> entityToDelete) {
|
||||
default Builder addDelete(VKey<ImmutableObject> entityToDelete) {
|
||||
deletesBuilder().add(entityToDelete);
|
||||
return this;
|
||||
}
|
||||
|
||||
public abstract EntityChanges build();
|
||||
EntityChanges build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,23 +14,11 @@
|
||||
|
||||
package google.registry.flows.domain.token;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.model.domain.token.AllocationToken;
|
||||
import java.util.Optional;
|
||||
|
||||
/** Value class to represent the result of loading a token and checking domains with it. */
|
||||
@AutoValue
|
||||
public abstract class AllocationTokenDomainCheckResults {
|
||||
|
||||
public abstract Optional<AllocationToken> token();
|
||||
|
||||
public abstract ImmutableMap<InternetDomainName, String> domainCheckResults();
|
||||
|
||||
public static AllocationTokenDomainCheckResults create(
|
||||
Optional<AllocationToken> allocationToken,
|
||||
ImmutableMap<InternetDomainName, String> domainCheckResults) {
|
||||
return new AutoValue_AllocationTokenDomainCheckResults(allocationToken, domainCheckResults);
|
||||
}
|
||||
}
|
||||
/** Record to represent the result of loading a token and checking domains with it. */
|
||||
public record AllocationTokenDomainCheckResults(
|
||||
Optional<AllocationToken> token, ImmutableMap<InternetDomainName, String> domainCheckResults) {}
|
||||
|
||||
@@ -69,9 +69,8 @@ public class AllocationTokenFlowUtils {
|
||||
try {
|
||||
tokenEntity = loadToken(token);
|
||||
} catch (EppException e) {
|
||||
return AllocationTokenDomainCheckResults.create(
|
||||
Optional.empty(),
|
||||
ImmutableMap.copyOf(Maps.toMap(domainNames, ignored -> e.getMessage())));
|
||||
return new AllocationTokenDomainCheckResults(
|
||||
Optional.empty(), Maps.toMap(domainNames, ignored -> e.getMessage()));
|
||||
}
|
||||
|
||||
// If the token is only invalid for some domain names (e.g. an invalid TLD), include those error
|
||||
@@ -97,8 +96,7 @@ public class AllocationTokenFlowUtils {
|
||||
resultsBuilder.putAll(
|
||||
tokenCustomLogic.checkDomainsWithToken(
|
||||
validDomainNames.build(), tokenEntity, registrarId, now));
|
||||
return AllocationTokenDomainCheckResults.create(
|
||||
Optional.of(tokenEntity), resultsBuilder.build());
|
||||
return new AllocationTokenDomainCheckResults(Optional.of(tokenEntity), resultsBuilder.build());
|
||||
}
|
||||
|
||||
/** Redeems a SINGLE_USE {@link AllocationToken}, returning the redeemed copy. */
|
||||
|
||||
@@ -23,7 +23,6 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
|
||||
import com.github.benmanes.caffeine.cache.CacheLoader;
|
||||
import com.github.benmanes.caffeine.cache.LoadingCache;
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -221,15 +220,10 @@ public final class ForeignKeyUtils {
|
||||
e -> VKey.create(clazz, e.getValue().get().repoId())));
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
abstract static class MostRecentResource {
|
||||
|
||||
abstract String repoId();
|
||||
|
||||
abstract DateTime deletionTime();
|
||||
record MostRecentResource(String repoId, DateTime deletionTime) {
|
||||
|
||||
static MostRecentResource create(String repoId, DateTime deletionTime) {
|
||||
return new AutoValue_ForeignKeyUtils_MostRecentResource(repoId, deletionTime);
|
||||
return new MostRecentResource(repoId, deletionTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user