Record domain transaction for domain transfers

This is the last of many cls adding explicit logging in all our domain
mutation flows to facilitate transaction reporting.

The transfer process is as follows:
GAINING sends a TransferRequest to LOSING
LOSING either acks (TransferApprove), nacks (TransferReject) or does nothing
(auto approve). For acks and autoapproves, we produce a +1 counter for GAINING
and LOSING for domain-gaining/losing-successful for each registrar, to be
reported on the approve date + the transfer grace period. For nacks, we produce
a +1 counter for domain-gaining/losing-nacked for each registrar.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166535579
This commit is contained in:
larryruili 2017-07-13 15:42:35 -04:00 committed by Ben McIlwain
parent 7ee8bc9070
commit 16e8286dca
15 changed files with 319 additions and 95 deletions

View file

@ -97,10 +97,8 @@ public class DomainTransactionRecord extends ImmutableObject implements Buildabl
NET_RENEWS_8_YR,
NET_RENEWS_9_YR,
NET_RENEWS_10_YR,
TRANSFER_GAINING_SUCCESSFUL,
TRANSFER_GAINING_NACKED,
TRANSFER_LOSING_SUCCESSFUL,
TRANSFER_LOSING_NACKED,
TRANSFER_SUCCESSFUL,
TRANSFER_NACKED,
DELETED_DOMAINS_GRACE,
DELETED_DOMAINS_NOGRACE,
RESTORED_DOMAINS;
@ -115,7 +113,7 @@ public class DomainTransactionRecord extends ImmutableObject implements Buildabl
return nameToField("NET_RENEWS_%d_YR", years);
}
private static final ImmutableSet<TransactionReportField> ADD_FIELDS =
public static final ImmutableSet<TransactionReportField> ADD_FIELDS =
ImmutableSet.of(
NET_ADDS_1_YR,
NET_ADDS_2_YR,
@ -128,7 +126,7 @@ public class DomainTransactionRecord extends ImmutableObject implements Buildabl
NET_ADDS_9_YR,
NET_ADDS_10_YR);
private static final ImmutableSet<TransactionReportField> RENEW_FIELDS =
public static final ImmutableSet<TransactionReportField> RENEW_FIELDS =
ImmutableSet.of(
NET_RENEWS_1_YR,
NET_RENEWS_2_YR,
@ -141,16 +139,6 @@ public class DomainTransactionRecord extends ImmutableObject implements Buildabl
NET_RENEWS_9_YR,
NET_RENEWS_10_YR);
/** Boilerplate to determine if a field is one of the NET_ADDS fields. */
public static boolean isAddsField(TransactionReportField field) {
return ADD_FIELDS.contains(field);
}
/** Boilerplate to determine if a field is one of the NET_ADDS fields. */
public static boolean isRenewsField(TransactionReportField field) {
return RENEW_FIELDS.contains(field);
}
private static TransactionReportField nameToField(String enumTemplate, int years) {
checkArgument(
years >= 1 && years <= 10, "domain add and renew years must be between 1 and 10");