Add TransactionRecord to HistoryEntry for transaction reporting

This change adds the persisted data model necessary to facilitate transaction
reporting. TransactionRecord is an embedded repeated class within HistoryEntry
which is only added to when a HistoryEntry is created that counts towards
transaction reporting.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165619552
This commit is contained in:
larryruili 2017-08-17 13:18:24 -07:00 committed by Ben McIlwain
parent 46f175e078
commit bf383081ce
4 changed files with 260 additions and 14 deletions

View file

@ -27,6 +27,7 @@ import google.registry.model.ImmutableObject;
import google.registry.model.annotations.ReportedOn;
import google.registry.model.domain.Period;
import google.registry.model.eppcommon.Trid;
import javax.annotation.Nullable;
import org.joda.time.DateTime;
/** A record of an EPP command that mutated a resource. */
@ -124,6 +125,16 @@ public class HistoryEntry extends ImmutableObject implements Buildable {
/** Whether this change was requested by a registrar. */
Boolean requestedByRegistrar;
/**
* Logging field for transaction reporting.
*
* <p>This will be null for any HistoryEntry generated before this field was added. This will
* also be null if the HistoryEntry refers to an EPP mutation that does not affect domain
* transaction counts (such as contact or host mutations).
*/
@Nullable
DomainTransactionRecord domainTransactionRecord;
public Key<? extends EppResource> getParent() {
return parent;
}
@ -168,6 +179,11 @@ public class HistoryEntry extends ImmutableObject implements Buildable {
return requestedByRegistrar;
}
@Nullable
public DomainTransactionRecord getDomainTransactionRecord() {
return domainTransactionRecord;
}
@Override
public Builder asBuilder() {
return new Builder(clone(this));
@ -240,5 +256,10 @@ public class HistoryEntry extends ImmutableObject implements Buildable {
getInstance().requestedByRegistrar = requestedByRegistrar;
return this;
}
public Builder setDomainTransactionRecord(DomainTransactionRecord domainTransactionRecord) {
getInstance().domainTransactionRecord = domainTransactionRecord;
return this;
}
}
}