Add temporary @OnLoad to set period in DomainApplication

We are adding the registration period to DomainApplication. For the moment, add an @OnLoad which, if the period is missing, populates it from the EPP XML. This can be removed once we have resaved all applications.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137723098
This commit is contained in:
mountford 2016-10-31 11:04:03 -07:00 committed by Ben McIlwain
parent b29d11f0de
commit da3e855b19
4 changed files with 187 additions and 4 deletions

View file

@ -266,11 +266,21 @@ public final class FullFieldsTestEntityHelper {
Period period,
String reason,
DateTime modificationTime) {
return makeHistoryEntry(resource, type, period, reason, modificationTime, "<xml></xml>");
}
public static HistoryEntry makeHistoryEntry(
EppResource resource,
HistoryEntry.Type type,
Period period,
String reason,
DateTime modificationTime,
String xml) {
HistoryEntry.Builder builder = new HistoryEntry.Builder()
.setParent(resource)
.setType(type)
.setPeriod(period)
.setXmlBytes("<xml></xml>".getBytes(UTF_8))
.setXmlBytes(xml.getBytes(UTF_8))
.setModificationTime(modificationTime)
.setClientId("foo")
.setTrid(Trid.create("ABC-123"))