mirror of
https://github.com/google/nomulus
synced 2026-01-03 19:54:18 +00:00
Crush out shared code in contact flows, especially transfer
Although the delta implies that this is actually adding code, it's better than it looks, because some of the stuff in ContactFlowUtils is duplicating more generic methods in ResourceFlowUtils, which can be deleted when the domain and host flows are cut over. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133149104
This commit is contained in:
@@ -32,6 +32,7 @@ import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.eppoutput.EppResponse.ResponseData;
|
||||
import google.registry.model.ofy.CommitLogManifest;
|
||||
import google.registry.model.transfer.TransferData;
|
||||
import google.registry.model.transfer.TransferStatus;
|
||||
import java.util.Set;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
@@ -303,6 +304,27 @@ public abstract class EppResource extends BackupGroupRoot implements Buildable,
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a pending transfer.
|
||||
*
|
||||
* <p>This removes the {@link StatusValue#PENDING_TRANSFER} status, clears all the
|
||||
* server-approve fields on the {@link TransferData} including the extended registration years
|
||||
* field, and sets the expiration time of the last pending transfer (i.e. the one being cleared)
|
||||
* to now.
|
||||
*/
|
||||
public B clearPendingTransfer(TransferStatus transferStatus, DateTime now) {
|
||||
removeStatusValue(StatusValue.PENDING_TRANSFER);
|
||||
return setTransferData(getInstance().getTransferData().asBuilder()
|
||||
.setExtendedRegistrationYears(null)
|
||||
.setServerApproveEntities(null)
|
||||
.setServerApproveBillingEvent(null)
|
||||
.setServerApproveAutorenewEvent(null)
|
||||
.setServerApproveAutorenewPollMessage(null)
|
||||
.setTransferStatus(transferStatus)
|
||||
.setPendingTransferExpirationTime(now)
|
||||
.build());
|
||||
}
|
||||
|
||||
/** Wipe out any personal information in the resource. */
|
||||
public B wipeOut() {
|
||||
return thisCastToDerived();
|
||||
|
||||
@@ -50,4 +50,8 @@ public enum TransferStatus {
|
||||
public String getXmlName() {
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, toString());
|
||||
}
|
||||
|
||||
public boolean isApproved() {
|
||||
return this.equals(CLIENT_APPROVED) || this.equals(SERVER_APPROVED);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user