mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Streamline transfer resolving helpers in ResourceFlowUtils
In the great flow flattening, ResourceFlowUtils grew a couple nice helpers for rebuilding transferrable resources (Domains and Contacts) upon the resolution of a transfer - approvePendingTransfer() and denyPendingTransfer(). Most transfer-resolving callsites use one of these two helpers, but for legacy reasons the deletion flows (DomainDeleteFlow and DeleteContactsAndHostsAction) were instead using the "manual" resolvePendingTransfer() method or its even more low-level createResolvedTransferData() helper instead of denyPendingTransfer(). It's simpler to just have two options - approve and deny - so this CL inlines createResolvedTransferData() into resolvePendingTransfer() and makes the latter a private helper for the approve/denyPendingTransfer() public helpers. This CL also adds sanity checks that approve/denyPendingTransfer() are called only with the logically appropriate values of TransferStatus. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=170819358
This commit is contained in:
parent
a5c931a152
commit
fd62f4a74e
4 changed files with 37 additions and 34 deletions
|
@ -20,7 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.math.IntMath.divide;
|
||||
import static com.googlecode.objectify.Key.getKind;
|
||||
import static google.registry.flows.ResourceFlowUtils.createResolvedTransferData;
|
||||
import static google.registry.flows.ResourceFlowUtils.denyPendingTransfer;
|
||||
import static google.registry.flows.ResourceFlowUtils.handlePendingTransferOnDelete;
|
||||
import static google.registry.flows.ResourceFlowUtils.updateForeignKeyIndexDeletionTime;
|
||||
import static google.registry.flows.async.AsyncFlowEnqueuer.PARAM_CLIENT_TRANSACTION_ID;
|
||||
|
@ -373,12 +373,12 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
EppResource.Builder<?, ?> resourceToSaveBuilder;
|
||||
if (resource instanceof ContactResource) {
|
||||
ContactResource contact = (ContactResource) resource;
|
||||
ContactResource.Builder contactToSaveBuilder = contact.asBuilder();
|
||||
// Handle pending transfers on contact deletion.
|
||||
if (contact.getStatusValues().contains(StatusValue.PENDING_TRANSFER)) {
|
||||
contactToSaveBuilder = contactToSaveBuilder.setTransferData(createResolvedTransferData(
|
||||
contact.getTransferData(), TransferStatus.SERVER_CANCELLED, now));
|
||||
contact = denyPendingTransfer(contact, TransferStatus.SERVER_CANCELLED, now);
|
||||
}
|
||||
resourceToSaveBuilder = contactToSaveBuilder.wipeOut();
|
||||
// Wipe out PII on contact deletion.
|
||||
resourceToSaveBuilder = contact.asBuilder().wipeOut();
|
||||
} else {
|
||||
resourceToSaveBuilder = resource.asBuilder();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue