Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lastUpdateTimeViaEpp field to EppResource Java objects #2429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public EppResponse run() throws EppException {
.setEmailAddress(command.getEmail())
.setInternationalizedPostalInfo(command.getInternationalizedPostalInfo())
.setLocalizedPostalInfo(command.getLocalizedPostalInfo())
.setLastUpdateTimeViaEpp(now)
.build();
validateAsciiPostalInfo(newContact.getInternationalizedPostalInfo());
validateContactAgainstPolicy(newContact);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ public EppResponse run() throws EppException {
: existingContact;
// Wipe out PII on contact deletion.
newContact =
newContact.asBuilder().wipeOut().setStatusValues(null).setDeletionTime(now).build();
newContact
.asBuilder()
.wipeOut()
.setStatusValues(null)
.setDeletionTime(now)
.setLastUpdateTimeViaEpp(now)
.build();
ContactHistory contactHistory =
historyBuilder.setType(Type.CONTACT_DELETE).setContact(newContact).build();
handlePendingTransferOnDelete(existingContact, newContact, now, contactHistory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public EppResponse run() throws EppException {
Contact newContact =
builder
.setLastEppUpdateTime(now)
.setLastUpdateTimeViaEpp(now)
.setLastEppUpdateRegistrarId(registrarId)
.setAuthInfo(preferFirst(change.getAuthInfo(), existingContact.getAuthInfo()))
.setDisclose(preferFirst(change.getDisclose(), existingContact.getDisclose()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ public EppResponse run() throws EppException {
.setCreationRegistrarId(registrarId)
.setPersistedCurrentSponsorRegistrarId(registrarId)
.setRepoId(repoId)
.setLastUpdateTimeViaEpp(now)
.setIdnTableName(validateDomainNameWithIdnTables(domainName))
.setRegistrationExpirationTime(registrationExpirationTime)
.setAutorenewBillingEvent(autorenewBillingEvent.createVKey())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ public EppResponse run() throws EppException {
} else {
builder = existingDomain.asBuilder();
}
builder.setLastEppUpdateTime(now).setLastEppUpdateRegistrarId(registrarId);
builder
.setLastEppUpdateTime(now)
.setLastUpdateTimeViaEpp(now)
.setLastEppUpdateRegistrarId(registrarId);
Duration redemptionGracePeriodLength = tld.getRedemptionGracePeriodLength();
Duration pendingDeleteLength = tld.getPendingDeleteLength();
Optional<DomainDeleteSuperuserExtension> domainDeleteSuperuserExtension =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ public EppResponse run() throws EppException {
existingDomain
.asBuilder()
.setLastEppUpdateTime(now)
.setLastUpdateTimeViaEpp(now)
.setLastEppUpdateRegistrarId(registrarId)
.setRegistrationExpirationTime(newExpirationTime)
.setAutorenewBillingEvent(newAutorenewEvent.createVKey())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ private static Domain performRestore(
// it won't immediately be deleted again.
.setAutorenewEndTime(Optional.empty())
.setLastEppUpdateTime(now)
.setLastUpdateTimeViaEpp(now)
.setLastEppUpdateRegistrarId(registrarId)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public EppResponse run() throws EppException {
GracePeriodStatus.TRANSFER, existingDomain.getRepoId(), event)))
.orElseGet(ImmutableSet::of))
.setLastEppUpdateTime(now)
.setLastUpdateTimeViaEpp(now)
.setLastEppUpdateRegistrarId(registrarId)
// Even if the existing domain had a bulk token, that bulk token should be removed
// on transfer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ public EppResponse run() throws EppException {
.setTransferData(pendingTransferData)
.addStatusValue(StatusValue.PENDING_TRANSFER)
.setLastEppUpdateTime(now)
.setLastUpdateTimeViaEpp(now)
.setLastEppUpdateRegistrarId(gainingClientId)
.build();
DomainHistory domainHistory = buildDomainHistory(newDomain, tld, now, period);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ private Domain performUpdate(Update command, Domain domain, DateTime now) throws
secDnsUpdate.get())
: domain.getDsData())
.setLastEppUpdateTime(now)
.setLastUpdateTimeViaEpp(now)
.setLastEppUpdateRegistrarId(registrarId)
.addStatusValues(add.getStatusValues())
.removeStatusValues(remove.getStatusValues())
Expand Down
26 changes: 26 additions & 0 deletions core/src/main/java/google/registry/model/EppResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.google.gson.annotations.Expose;
import google.registry.config.RegistryConfig;
import google.registry.model.eppcommon.StatusValue;
import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.TransferData;
import google.registry.persistence.VKey;
import google.registry.util.NonFinalForTesting;
Expand Down Expand Up @@ -129,9 +130,24 @@ public abstract class EppResource extends UpdateAutoTimestampEntity implements B
* <p>This does not refer to the last delta made on this object, which might include out-of-band
* edits; it only includes EPP-visible modifications such as {@literal <update>}. Can be null if
* the resource has never been modified.
*
* <p>This field reflects the last update that is <b>visible</b> in EPP requests, not necessarily
* when the last EPP request was made on this entity. For that, see {@link #lastUpdateTimeViaEpp}.
*/
@Expose DateTime lastEppUpdateTime;

/**
* The time that this resource was last updated via an EPP request.
*
* <p>This will usually be the same as {@link #lastEppUpdateTime} but not always, as that field
* can be modified by automated events such as grace period expirations or autorenews. There
* should <b>always</b> be exactly one {@link HistoryEntry} object corresponding to this time.
*
* <p>This field exists to track when (if) the EppResource becomes out of sync with the
* corresponding most-recent {@link HistoryEntry} object.
*/
DateTime lastUpdateTimeViaEpp;

/** Status values associated with this resource. */
@Expose Set<StatusValue> statuses;

Expand Down Expand Up @@ -164,6 +180,10 @@ public DateTime getLastEppUpdateTime() {
return lastEppUpdateTime;
}

public DateTime getLastUpdateTimeViaEpp() {
return lastUpdateTimeViaEpp;
}

public String getLastEppUpdateRegistrarId() {
return lastEppUpdateRegistrarId;
}
Expand Down Expand Up @@ -281,6 +301,12 @@ public B setLastEppUpdateTime(DateTime lastEppUpdateTime) {
return thisCastToDerived();
}

/** Set the time when this resource was updated by an EPP request. */
public B setLastUpdateTimeViaEpp(DateTime lastUpdateTimeViaEpp) {
getInstance().lastUpdateTimeViaEpp = lastUpdateTimeViaEpp;
return thisCastToDerived();
}

/** Set the registrar who last performed a {@literal <update>} on this resource. */
public B setLastEppUpdateRegistrarId(String lastEppUpdateRegistrarId) {
getInstance().lastEppUpdateRegistrarId = lastEppUpdateRegistrarId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ B resolvePendingTransfer(R resource, TransferStatus transferStatus, DateTime now

return builder
.removeStatusValue(StatusValue.PENDING_TRANSFER)
.setLastUpdateTimeViaEpp(now)
.setTransferData(
(TransferData)
resource
.getTransferData()
.copyConstantFieldsToBuilder()
.setTransferStatus(transferStatus)
.setPendingTransferExpirationTime(checkNotNull(now))
.build());
resource
.getTransferData()
.copyConstantFieldsToBuilder()
.setTransferStatus(transferStatus)
.setPendingTransferExpirationTime(checkNotNull(now))
.build());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public Builder copyFrom(ContactBase contactBase) {
.setLastTransferTime(contactBase.getLastTransferTime())
.setLastEppUpdateRegistrarId(contactBase.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(contactBase.getLastEppUpdateTime())
.setLastUpdateTimeViaEpp(contactBase.getLastUpdateTimeViaEpp())
.setLocalizedPostalInfo(contactBase.getLocalizedPostalInfo())
.setPersistedCurrentSponsorRegistrarId(
contactBase.getPersistedCurrentSponsorRegistrarId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public Builder copyFrom(DomainBase domainBase) {
.setLaunchNotice(domainBase.getLaunchNotice())
.setLastEppUpdateRegistrarId(domainBase.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(domainBase.getLastEppUpdateTime())
.setLastUpdateTimeViaEpp(domainBase.getLastUpdateTimeViaEpp())
.setNameservers(domainBase.getNameservers())
.setPersistedCurrentSponsorRegistrarId(domainBase.getPersistedCurrentSponsorRegistrarId())
.setRegistrant(domainBase.getRegistrant())
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/google/registry/model/host/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public Builder copyFrom(HostBase hostBase) {
.setLastSuperordinateChange(hostBase.getLastSuperordinateChange())
.setLastEppUpdateRegistrarId(hostBase.getLastEppUpdateRegistrarId())
.setLastEppUpdateTime(hostBase.getLastEppUpdateTime())
.setLastUpdateTimeViaEpp(hostBase.getLastUpdateTimeViaEpp())
.setPersistedCurrentSponsorRegistrarId(hostBase.getPersistedCurrentSponsorRegistrarId())
.setRepoId(hostBase.getRepoId())
.setSuperordinateDomain(hostBase.getSuperordinateDomain())
Expand Down
12 changes: 6 additions & 6 deletions db/src/main/resources/sql/er_diagram/brief_er_diagram.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ <h2>System Information</h2>
</tr>
<tr>
<td class="property_name">generated on</td>
<td class="property_value">2024-05-01 21:04:48.5296048</td>
<td class="property_value">2024-05-02 20:18:24.185031041</td>
</tr>
<tr>
<td class="property_name">last flyway file</td>
Expand All @@ -277,11 +277,11 @@ <h2>System Information</h2>
SchemaCrawler_Diagram
</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-3493.5 4025,-3493.5 4025,4 -4,4" />
<text text-anchor="start" x="3745" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated by</text>
<text text-anchor="start" x="3828" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">SchemaCrawler 16.10.1</text>
<text text-anchor="start" x="3744" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated on</text>
<text text-anchor="start" x="3828" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">2024-05-01 21:04:48.5296048</text>
<polygon fill="none" stroke="#888888" points="3741,-4 3741,-44 4013,-44 4013,-4 3741,-4" /> <!-- allocationtoken_a08ccbef -->
<text text-anchor="start" x="3730.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated by</text>
<text text-anchor="start" x="3813.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">SchemaCrawler 16.10.1</text>
<text text-anchor="start" x="3729.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated on</text>
<text text-anchor="start" x="3813.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">2024-05-02 20:18:24.185031041</text>
<polygon fill="none" stroke="#888888" points="3726,-4 3726,-44 4013,-44 4013,-4 3726,-4" /> <!-- allocationtoken_a08ccbef -->
<g id="node1" class="node">
<title>
allocationtoken_a08ccbef
Expand Down
4 changes: 2 additions & 2 deletions db/src/main/resources/sql/er_diagram/full_er_diagram.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ <h2>System Information</h2>
</tr>
<tr>
<td class="property_name">generated on</td>
<td class="property_value">2024-05-01 21:04:45.792776047</td>
<td class="property_value">2024-05-02 20:18:21.247959871</td>
</tr>
<tr>
<td class="property_name">last flyway file</td>
Expand All @@ -280,7 +280,7 @@ <h2>System Information</h2>
<text text-anchor="start" x="4443.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated by</text>
<text text-anchor="start" x="4526.5" y="-29.8" font-family="Helvetica,sans-Serif" font-size="14.00">SchemaCrawler 16.10.1</text>
<text text-anchor="start" x="4442.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">generated on</text>
<text text-anchor="start" x="4526.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">2024-05-01 21:04:45.792776047</text>
<text text-anchor="start" x="4526.5" y="-10.8" font-family="Helvetica,sans-Serif" font-size="14.00">2024-05-02 20:18:21.247959871</text>
<polygon fill="none" stroke="#888888" points="4439,-4 4439,-44 4726,-44 4726,-4 4439,-4" /> <!-- allocationtoken_a08ccbef -->
<g id="node1" class="node">
<title>
Expand Down
6 changes: 6 additions & 0 deletions db/src/main/resources/sql/schema/db-schema.sql.generated
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
last_update_time_via_epp timestamptz,
statuses text[],
auth_info_repo_id text,
auth_info_value text,
Expand Down Expand Up @@ -273,6 +274,7 @@
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
last_update_time_via_epp timestamptz,
statuses text[],
update_timestamp timestamptz,
primary key (contact_repo_id, history_revision_id)
Expand Down Expand Up @@ -314,6 +316,7 @@
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
last_update_time_via_epp timestamptz,
statuses text[],
admin_contact text,
auth_info_repo_id text,
Expand Down Expand Up @@ -436,6 +439,7 @@
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
last_update_time_via_epp timestamptz,
statuses text[],
update_timestamp timestamptz,
primary key (domain_repo_id, history_revision_id)
Expand Down Expand Up @@ -496,6 +500,7 @@
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
last_update_time_via_epp timestamptz,
statuses text[],
host_name text,
inet_addresses text[],
Expand Down Expand Up @@ -528,6 +533,7 @@
deletion_time timestamptz,
last_epp_update_registrar_id text,
last_epp_update_time timestamptz,
last_update_time_via_epp timestamptz,
statuses text[],
update_timestamp timestamptz,
primary key (host_repo_id, history_revision_id)
Expand Down
Loading