Skip to content

Commit 9366093

Browse files
committed
Remove the concept of a TransferData abstract class
The only type of thing that can be transferred now is a domain, so there's no point in having this abstract class / redirection. This does not include deletion of the contact-response-related XML classes; that can come next.
1 parent ee8746c commit 9366093

File tree

19 files changed

+186
-372
lines changed

19 files changed

+186
-372
lines changed

core/src/main/java/google/registry/flows/domain/DomainTransferRequestFlow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
7777
import google.registry.model.tld.Tld;
7878
import google.registry.model.transfer.DomainTransferData;
79-
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
79+
import google.registry.model.transfer.DomainTransferData.TransferServerApproveEntity;
8080
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
8181
import google.registry.model.transfer.TransferStatus;
8282
import jakarta.inject.Inject;

core/src/main/java/google/registry/flows/domain/DomainTransferUtils.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
3737
import google.registry.model.tld.Tld;
3838
import google.registry.model.transfer.DomainTransferData;
39-
import google.registry.model.transfer.TransferData;
40-
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
39+
import google.registry.model.transfer.DomainTransferData.TransferServerApproveEntity;
4140
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
4241
import google.registry.model.transfer.TransferStatus;
4342
import google.registry.persistence.VKey;
@@ -51,7 +50,7 @@
5150
*/
5251
public final class DomainTransferUtils {
5352

54-
/** Sets up {@link TransferData} for a domain with links to entities for server approval. */
53+
/** Sets up {@link DomainTransferData} for a domain with links to entities for server approval. */
5554
public static DomainTransferData createPendingTransferData(
5655
String domainRepoId,
5756
Long historyId,
@@ -179,7 +178,7 @@ public static ImmutableSet<TransferServerApproveEntity> createTransferServerAppr
179178
/** Create a poll message for the gaining client in a transfer. */
180179
public static PollMessage createGainingTransferPollMessage(
181180
String targetId,
182-
TransferData transferData,
181+
DomainTransferData transferData,
183182
@Nullable DateTime extendedRegistrationExpirationTime,
184183
DateTime now,
185184
HistoryEntryId domainHistoryId) {
@@ -202,7 +201,7 @@ public static PollMessage createGainingTransferPollMessage(
202201
/** Create a poll message for the losing client in a transfer. */
203202
public static PollMessage createLosingTransferPollMessage(
204203
String targetId,
205-
TransferData transferData,
204+
DomainTransferData transferData,
206205
@Nullable DateTime extendedRegistrationExpirationTime,
207206
HistoryEntryId domainHistoryId) {
208207
return new PollMessage.OneTime.Builder()
@@ -216,10 +215,10 @@ public static PollMessage createLosingTransferPollMessage(
216215
.build();
217216
}
218217

219-
/** Create a {@link DomainTransferResponse} off of the info in a {@link TransferData}. */
218+
/** Create a {@link DomainTransferResponse} off of the info in a {@link DomainTransferData}. */
220219
static DomainTransferResponse createTransferResponse(
221220
String targetId,
222-
TransferData transferData,
221+
DomainTransferData transferData,
223222
@Nullable DateTime extendedRegistrationExpirationTime) {
224223
return new DomainTransferResponse.Builder()
225224
.setDomainName(targetId)

core/src/main/java/google/registry/model/EppResource.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import com.google.gson.annotations.Expose;
3535
import google.registry.config.RegistryConfig;
3636
import google.registry.model.eppcommon.StatusValue;
37-
import google.registry.model.transfer.TransferData;
3837
import google.registry.persistence.VKey;
3938
import google.registry.util.NonFinalForTesting;
4039
import jakarta.persistence.Access;
@@ -207,27 +206,6 @@ public DateTime getDeletionTime() {
207206
/** EppResources that are loaded via foreign keys should implement this marker interface. */
208207
public interface ForeignKeyedEppResource {}
209208

210-
/** An interface for resources that have transfer data. */
211-
public interface ResourceWithTransferData<T extends TransferData> {
212-
T getTransferData();
213-
214-
/**
215-
* The time that this resource was last transferred.
216-
*
217-
* <p>Can be null if the resource has never been transferred.
218-
*/
219-
DateTime getLastTransferTime();
220-
}
221-
222-
/** An interface for builders of resources that have transfer data. */
223-
public interface BuilderWithTransferData<
224-
T extends TransferData, B extends BuilderWithTransferData<T, B>> {
225-
B setTransferData(T transferData);
226-
227-
/** Set the time when this resource was transferred. */
228-
B setLastTransferTime(DateTime lastTransferTime);
229-
}
230-
231209
/** Abstract builder for {@link EppResource} types. */
232210
public abstract static class Builder<T extends EppResource, B extends Builder<T, B>>
233211
extends GenericBuilder<T, B> {

core/src/main/java/google/registry/model/ResourceTransferUtils.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import google.registry.model.poll.PollMessage;
3030
import google.registry.model.reporting.HistoryEntry;
3131
import google.registry.model.transfer.DomainTransferData;
32-
import google.registry.model.transfer.TransferData;
3332
import google.registry.model.transfer.TransferResponse;
3433
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
3534
import google.registry.model.transfer.TransferStatus;
@@ -79,7 +78,7 @@ public static void handlePendingTransferOnDelete(
7978
if (!domain.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
8079
return;
8180
}
82-
TransferData oldTransferData = domain.getTransferData();
81+
DomainTransferData oldTransferData = domain.getTransferData();
8382
tm().delete(oldTransferData.getServerApproveEntities());
8483
tm().put(
8584
new PollMessage.OneTime.Builder()
@@ -99,8 +98,8 @@ public static void handlePendingTransferOnDelete(
9998
* Turn a domain into a builder with its pending transfer resolved.
10099
*
101100
* <p>This removes the {@link StatusValue#PENDING_TRANSFER} status, sets the {@link
102-
* TransferStatus}, clears all the server-approve fields on the {@link TransferData}, and sets the
103-
* expiration time of the last pending transfer to now.
101+
* TransferStatus}, clears all the server-approve fields on the {@link DomainTransferData}, and
102+
* sets the expiration time of the last pending transfer to now.
104103
*/
105104
private static Domain.Builder resolvePendingTransfer(
106105
Domain domain, TransferStatus transferStatus, DateTime now) {
@@ -125,9 +124,9 @@ private static Domain.Builder resolvePendingTransfer(
125124
* Resolve a pending transfer by awarding it to the gaining client.
126125
*
127126
* <p>This removes the {@link StatusValue#PENDING_TRANSFER} status, sets the {@link
128-
* TransferStatus}, clears all the server-approve fields on the {@link TransferData}, sets the new
129-
* client id, and sets the last transfer time and the expiration time of the last pending transfer
130-
* to now.
127+
* TransferStatus}, clears all the server-approve fields on the {@link DomainTransferData}, sets
128+
* the new client id, and sets the last transfer time and the expiration time of the last pending
129+
* transfer to now.
131130
*/
132131
public static Domain approvePendingTransfer(
133132
Domain domain, TransferStatus transferStatus, DateTime now) {
@@ -143,9 +142,9 @@ public static Domain approvePendingTransfer(
143142
* Resolve a pending transfer by denying it.
144143
*
145144
* <p>This removes the {@link StatusValue#PENDING_TRANSFER} status, sets the {@link
146-
* TransferStatus}, clears all the server-approve fields on the {@link TransferData}, sets the
147-
* expiration time of the last pending transfer to now, sets the last EPP update time to now, and
148-
* sets the last EPP update client id to the given client id.
145+
* TransferStatus}, clears all the server-approve fields on the {@link DomainTransferData}, sets
146+
* the expiration time of the last pending transfer to now, sets the last EPP update time to now,
147+
* and sets the last EPP update client id to the given client id.
149148
*/
150149
public static Domain denyPendingTransfer(
151150
Domain domain, TransferStatus transferStatus, DateTime now, String lastEppUpdateRegistrarId) {

core/src/main/java/google/registry/model/billing/BillingBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import google.registry.model.annotations.IdAllocation;
2727
import google.registry.model.domain.DomainHistory;
2828
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
29-
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
29+
import google.registry.model.transfer.DomainTransferData.TransferServerApproveEntity;
3030
import google.registry.persistence.VKey;
3131
import jakarta.persistence.Column;
3232
import jakarta.persistence.EnumType;

core/src/main/java/google/registry/model/domain/DomainBase.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import com.google.gson.annotations.Expose;
4444
import google.registry.flows.ResourceFlowUtils;
4545
import google.registry.model.EppResource;
46-
import google.registry.model.EppResource.ResourceWithTransferData;
4746
import google.registry.model.billing.BillingRecurrence;
4847
import google.registry.model.domain.launch.LaunchNotice;
4948
import google.registry.model.domain.rgp.GracePeriodStatus;
@@ -96,8 +95,7 @@
9695
@MappedSuperclass
9796
@Embeddable
9897
@Access(AccessType.FIELD)
99-
public class DomainBase extends EppResource
100-
implements ResourceWithTransferData<DomainTransferData> {
98+
public class DomainBase extends EppResource {
10199

102100
/** The max number of years that a domain can be registered for, as set by ICANN policy. */
103101
public static final int MAX_REGISTRATION_YEARS = 10;
@@ -319,12 +317,10 @@ public Optional<DateTime> getAutorenewEndTime() {
319317
return Optional.ofNullable(autorenewEndTime.equals(END_OF_TIME) ? null : autorenewEndTime);
320318
}
321319

322-
@Override
323320
public DomainTransferData getTransferData() {
324321
return Optional.ofNullable(transferData).orElse(DomainTransferData.EMPTY);
325322
}
326323

327-
@Override
328324
public DateTime getLastTransferTime() {
329325
return lastTransferTime;
330326
}
@@ -605,7 +601,7 @@ public VKey<Domain> createVKey() {
605601

606602
/** A builder for constructing {@link Domain}, since it is immutable. */
607603
public static class Builder<T extends DomainBase, B extends Builder<T, B>>
608-
extends EppResource.Builder<T, B> implements BuilderWithTransferData<DomainTransferData, B> {
604+
extends EppResource.Builder<T, B> {
609605

610606
public Builder() {}
611607

@@ -783,13 +779,11 @@ public B setAutorenewEndTime(Optional<DateTime> autorenewEndTime) {
783779
return thisCastToDerived();
784780
}
785781

786-
@Override
787782
public B setTransferData(DomainTransferData transferData) {
788783
getInstance().transferData = transferData;
789784
return thisCastToDerived();
790785
}
791786

792-
@Override
793787
public B setLastTransferTime(DateTime lastTransferTime) {
794788
getInstance().lastTransferTime = lastTransferTime;
795789
return thisCastToDerived();

core/src/main/java/google/registry/model/host/HostBase.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.google.common.collect.ImmutableSet;
2525
import google.registry.model.EppResource;
2626
import google.registry.model.domain.Domain;
27-
import google.registry.model.transfer.TransferData;
2827
import google.registry.persistence.VKey;
2928
import google.registry.persistence.converter.InetAddressSetUserType;
3029
import jakarta.persistence.Access;
@@ -41,8 +40,8 @@
4140
/**
4241
* A persistable Host resource including mutable and non-mutable fields.
4342
*
44-
* <p>A host's {@link TransferData} is stored on the superordinate domain. Non-subordinate hosts
45-
* don't carry a full set of TransferData; all they have is lastTransferTime.
43+
* <p>A host's full transfer data is stored on the superordinate domain. Non-subordinate hosts don't
44+
* carry a full set of TransferData; all they have is lastTransferTime.
4645
*
4746
* <p>This class deliberately does not include an {@link jakarta.persistence.Id} so that any
4847
* foreign-keyed fields can refer to the proper parent entity's ID, whether we're storing this in

core/src/main/java/google/registry/model/poll/PollMessage.java

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@
3232
import google.registry.model.eppoutput.EppResponse.ResponseData;
3333
import google.registry.model.host.Host;
3434
import google.registry.model.host.HostHistory;
35-
import google.registry.model.poll.PendingActionNotificationResponse.ContactPendingActionNotificationResponse;
3635
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
3736
import google.registry.model.poll.PendingActionNotificationResponse.HostPendingActionNotificationResponse;
3837
import google.registry.model.reporting.HistoryEntry;
3938
import google.registry.model.reporting.HistoryEntry.HistoryEntryId;
40-
import google.registry.model.transfer.TransferData.TransferServerApproveEntity;
39+
import google.registry.model.transfer.DomainTransferData.TransferServerApproveEntity;
4140
import google.registry.model.transfer.TransferResponse;
42-
import google.registry.model.transfer.TransferResponse.ContactTransferResponse;
4341
import google.registry.model.transfer.TransferResponse.DomainTransferResponse;
4442
import google.registry.persistence.VKey;
4543
import google.registry.persistence.WithVKey;
@@ -406,12 +404,8 @@ void postLoad() {
406404
if (pendingActionNotificationResponse != null) {
407405
// Promote the pending action notification response to its specialized type.
408406
if (contactId != null) {
409-
pendingActionNotificationResponse =
410-
ContactPendingActionNotificationResponse.create(
411-
pendingActionNotificationResponse.nameOrId.value,
412-
pendingActionNotificationResponse.getActionResult(),
413-
pendingActionNotificationResponse.getTrid(),
414-
pendingActionNotificationResponse.processedDate);
407+
// Contacts are no longer supported
408+
pendingActionNotificationResponse = null;
415409
} else if (domainName != null) {
416410
pendingActionNotificationResponse =
417411
DomainPendingActionNotificationResponse.create(
@@ -432,16 +426,8 @@ void postLoad() {
432426
// The transferResponse is currently an unspecialized TransferResponse instance, create the
433427
// appropriate subclass so that the value is consistently specialized
434428
if (contactId != null) {
435-
transferResponse =
436-
new ContactTransferResponse.Builder()
437-
.setContactId(contactId)
438-
.setGainingRegistrarId(transferResponse.getGainingRegistrarId())
439-
.setLosingRegistrarId(transferResponse.getLosingRegistrarId())
440-
.setTransferStatus(transferResponse.getTransferStatus())
441-
.setTransferRequestTime(transferResponse.getTransferRequestTime())
442-
.setPendingTransferExpirationTime(
443-
transferResponse.getPendingTransferExpirationTime())
444-
.build();
429+
// Contacts are no longer supported
430+
transferResponse = null;
445431
} else if (domainName != null) {
446432
transferResponse =
447433
new DomainTransferResponse.Builder()
@@ -488,9 +474,6 @@ public Builder setResponseData(ImmutableList<? extends ResponseData> responseDat
488474

489475
// Set identifier fields based on the type of the notification response.
490476
if (instance.pendingActionNotificationResponse
491-
instanceof ContactPendingActionNotificationResponse) {
492-
instance.contactId = instance.pendingActionNotificationResponse.nameOrId.value;
493-
} else if (instance.pendingActionNotificationResponse
494477
instanceof DomainPendingActionNotificationResponse) {
495478
instance.domainName = instance.pendingActionNotificationResponse.nameOrId.value;
496479
} else if (instance.pendingActionNotificationResponse
@@ -507,9 +490,7 @@ public Builder setResponseData(ImmutableList<? extends ResponseData> responseDat
507490
.orElse(null);
508491

509492
// Set the identifier according to the TransferResponse type.
510-
if (instance.transferResponse instanceof ContactTransferResponse) {
511-
instance.contactId = ((ContactTransferResponse) instance.transferResponse).getContactId();
512-
} else if (instance.transferResponse instanceof DomainTransferResponse response) {
493+
if (instance.transferResponse instanceof DomainTransferResponse response) {
513494
instance.domainName = response.getDomainName();
514495
instance.extendedRegistrationExpirationTime =
515496
response.getExtendedRegistrationExpirationTime();

core/src/main/java/google/registry/model/transfer/BaseTransferObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import jakarta.xml.bind.annotation.XmlTransient;
2626
import org.joda.time.DateTime;
2727

28-
/** Fields common to {@link TransferData} and {@link TransferResponse}. */
28+
/** Fields common to {@link DomainTransferData} and {@link TransferResponse}. */
2929
@XmlTransient
3030
@MappedSuperclass
3131
public abstract class BaseTransferObject extends ImmutableObject implements UnsafeSerializable {

core/src/main/java/google/registry/model/transfer/ContactTransferData.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)