Rename buildHistory() methods to buildHistoryEntry()

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165707934
This commit is contained in:
mcilwain 2017-08-18 08:25:52 -07:00 committed by Ben McIlwain
parent dedabfb076
commit fcb554947c
6 changed files with 16 additions and 14 deletions

View file

@ -156,7 +156,7 @@ public class DomainAllocateFlow implements TransactionalFlow {
loadAndValidateApplication(allocateCreate.getApplicationRoid(), now); loadAndValidateApplication(allocateCreate.getApplicationRoid(), now);
String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr()); String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr());
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>(); ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
HistoryEntry historyEntry = buildHistory(repoId, period, now); HistoryEntry historyEntry = buildHistoryEntry(repoId, period, now);
entitiesToSave.add(historyEntry); entitiesToSave.add(historyEntry);
ImmutableSet<? extends ImmutableObject> billsAndPolls = createBillingEventsAndPollMessages( ImmutableSet<? extends ImmutableObject> billsAndPolls = createBillingEventsAndPollMessages(
domainName, application, historyEntry, isSunrushAddGracePeriod, registry, now, years); domainName, application, historyEntry, isSunrushAddGracePeriod, registry, now, years);
@ -229,7 +229,7 @@ public class DomainAllocateFlow implements TransactionalFlow {
return application; return application;
} }
private HistoryEntry buildHistory(String repoId, Period period, DateTime now) { private HistoryEntry buildHistoryEntry(String repoId, Period period, DateTime now) {
return historyBuilder return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_ALLOCATE) .setType(HistoryEntry.Type.DOMAIN_ALLOCATE)
.setPeriod(period) .setPeriod(period)

View file

@ -267,7 +267,8 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
}}) }})
.toList()) .toList())
.build(); .build();
HistoryEntry historyEntry = buildHistory(newApplication.getRepoId(), command.getPeriod(), now); HistoryEntry historyEntry =
buildHistoryEntry(newApplication.getRepoId(), command.getPeriod(), now);
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>(); ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
entitiesToSave.add( entitiesToSave.add(
newApplication, newApplication,
@ -364,7 +365,7 @@ public final class DomainApplicationCreateFlow implements TransactionalFlow {
} }
} }
private HistoryEntry buildHistory(String repoId, Period period, DateTime now) { private HistoryEntry buildHistoryEntry(String repoId, Period period, DateTime now) {
return historyBuilder return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE) .setType(HistoryEntry.Type.DOMAIN_APPLICATION_CREATE)
.setPeriod(period) .setPeriod(period)

View file

@ -163,7 +163,7 @@ public class DomainApplicationUpdateFlow implements TransactionalFlow {
verifyNoDisallowedStatuses(existingApplication, UPDATE_DISALLOWED_STATUSES); verifyNoDisallowedStatuses(existingApplication, UPDATE_DISALLOWED_STATUSES);
verifyOptionalAuthInfo(authInfo, existingApplication); verifyOptionalAuthInfo(authInfo, existingApplication);
verifyUpdateAllowed(existingApplication, command, now); verifyUpdateAllowed(existingApplication, command, now);
HistoryEntry historyEntry = buildHistory(existingApplication, now); HistoryEntry historyEntry = buildHistoryEntry(existingApplication, now);
DomainApplication newApplication = updateApplication(existingApplication, command, now); DomainApplication newApplication = updateApplication(existingApplication, command, now);
validateNewApplication(newApplication); validateNewApplication(newApplication);
ofy().save().<ImmutableObject>entities(newApplication, historyEntry); ofy().save().<ImmutableObject>entities(newApplication, historyEntry);
@ -215,7 +215,7 @@ public class DomainApplicationUpdateFlow implements TransactionalFlow {
domainName, nullToEmpty(add.getNameserverFullyQualifiedHostNames())); domainName, nullToEmpty(add.getNameserverFullyQualifiedHostNames()));
} }
private HistoryEntry buildHistory(DomainApplication existingApplication, DateTime now) { private HistoryEntry buildHistoryEntry(DomainApplication existingApplication, DateTime now) {
return historyBuilder return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_APPLICATION_UPDATE) .setType(HistoryEntry.Type.DOMAIN_APPLICATION_UPDATE)
.setModificationTime(now) .setModificationTime(now)

View file

@ -258,7 +258,7 @@ public class DomainCreateFlow implements TransactionalFlow {
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class)); validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));
String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr()); String repoId = createDomainRepoId(ObjectifyService.allocateId(), registry.getTldStr());
DateTime registrationExpirationTime = leapSafeAddYears(now, years); DateTime registrationExpirationTime = leapSafeAddYears(now, years);
HistoryEntry historyEntry = buildHistory(repoId, period, now); HistoryEntry historyEntry = buildHistoryEntry(repoId, period, now);
// Bill for the create. // Bill for the create.
BillingEvent.OneTime createBillingEvent = BillingEvent.OneTime createBillingEvent =
createOneTimeBillingEvent( createOneTimeBillingEvent(
@ -360,7 +360,7 @@ public class DomainCreateFlow implements TransactionalFlow {
} }
} }
private HistoryEntry buildHistory(String repoId, Period period, DateTime now) { private HistoryEntry buildHistoryEntry(String repoId, Period period, DateTime now) {
return historyBuilder return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_CREATE) .setType(HistoryEntry.Type.DOMAIN_CREATE)
.setPeriod(period) .setPeriod(period)

View file

@ -138,7 +138,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
FeeUpdateCommandExtension feeUpdate = FeeUpdateCommandExtension feeUpdate =
eppInput.getSingleExtension(FeeUpdateCommandExtension.class); eppInput.getSingleExtension(FeeUpdateCommandExtension.class);
verifyRestoreAllowed(command, existingDomain, feeUpdate, feesAndCredits, now); verifyRestoreAllowed(command, existingDomain, feeUpdate, feesAndCredits, now);
HistoryEntry historyEntry = buildHistory(existingDomain, now); HistoryEntry historyEntry = buildHistoryEntry(existingDomain, now);
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>(); ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
entitiesToSave.addAll( entitiesToSave.addAll(
createRestoreAndRenewBillingEvents( createRestoreAndRenewBillingEvents(
@ -172,7 +172,7 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
.build(); .build();
} }
private HistoryEntry buildHistory(DomainResource existingDomain, DateTime now) { private HistoryEntry buildHistoryEntry(DomainResource existingDomain, DateTime now) {
DomainTransactionRecord transactionRecord = DomainTransactionRecord transactionRecord =
new DomainTransactionRecord.Builder() new DomainTransactionRecord.Builder()
.setTld(existingDomain.getTld()) .setTld(existingDomain.getTld())

View file

@ -141,7 +141,7 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
eppInput.getSingleExtension(FeeTransferCommandExtension.class); eppInput.getSingleExtension(FeeTransferCommandExtension.class);
FeesAndCredits feesAndCredits = pricingLogic.getTransferPrice(registry, targetId, now); FeesAndCredits feesAndCredits = pricingLogic.getTransferPrice(registry, targetId, now);
validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits); validateFeeChallenge(targetId, tld, now, feeTransfer, feesAndCredits);
HistoryEntry historyEntry = buildHistory(period, existingDomain, now); HistoryEntry historyEntry = buildHistoryEntry(period, existingDomain, now);
DateTime automaticTransferTime = now.plus(registry.getAutomaticTransferLength()); DateTime automaticTransferTime = now.plus(registry.getAutomaticTransferLength());
// If the domain will be in the auto-renew grace period at the moment of transfer, the transfer // If the domain will be in the auto-renew grace period at the moment of transfer, the transfer
@ -251,13 +251,14 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
} }
} }
private HistoryEntry buildHistory(Period period, DomainResource existingResource, DateTime now) { private HistoryEntry buildHistoryEntry(
Period period, DomainResource existingDomain, DateTime now) {
return historyBuilder return historyBuilder
.setType(HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST) .setType(HistoryEntry.Type.DOMAIN_TRANSFER_REQUEST)
.setOtherClientId(existingResource.getCurrentSponsorClientId()) .setOtherClientId(existingDomain.getCurrentSponsorClientId())
.setPeriod(period) .setPeriod(period)
.setModificationTime(now) .setModificationTime(now)
.setParent(Key.create(existingResource)) .setParent(Key.create(existingDomain))
.build(); .build();
} }