Replace command.applyTo() with inlined builder operations

These are much easier to understand.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137446273
This commit is contained in:
cgoldfeder 2016-10-27 15:03:48 -07:00 committed by Ben McIlwain
parent b84d7f1fb5
commit 1dbc5f6bb0
28 changed files with 489 additions and 426 deletions

View file

@ -210,9 +210,7 @@ public final class DomainApplicationCreateFlow extends Flow implements Transacti
validateFeeChallenge(targetId, tld, now, feeCreate, commandOperations.getTotalCost());
SecDnsCreateExtension secDnsCreate =
validateSecDnsExtension(eppInput.getSingleExtension(SecDnsCreateExtension.class));
DomainApplication.Builder applicationBuilder = new DomainApplication.Builder();
command.applyTo(applicationBuilder);
applicationBuilder
DomainApplication newApplication = new DomainApplication.Builder()
.setCreationTrid(trid)
.setCreationClientId(clientId)
.setCurrentSponsorClientId(clientId)
@ -224,6 +222,11 @@ public final class DomainApplicationCreateFlow extends Flow implements Transacti
.setApplicationStatus(ApplicationStatus.VALIDATED)
.addStatusValue(StatusValue.PENDING_CREATE)
.setDsData(secDnsCreate == null ? null : secDnsCreate.getDsData())
.setRegistrant(command.getRegistrant())
.setAuthInfo(command.getAuthInfo())
.setFullyQualifiedDomainName(targetId)
.setNameservers(command.getNameservers())
.setContacts(command.getContacts())
.setEncodedSignedMarks(FluentIterable
.from(launchCreate.getSignedMarks())
.transform(new Function<AbstractSignedMark, EncodedSignedMark>() {
@ -231,8 +234,8 @@ public final class DomainApplicationCreateFlow extends Flow implements Transacti
public EncodedSignedMark apply(AbstractSignedMark abstractSignedMark) {
return (EncodedSignedMark) abstractSignedMark;
}})
.toList());
DomainApplication newApplication = applicationBuilder.build();
.toList())
.build();
HistoryEntry historyEntry = buildHistory(newApplication.getRepoId(), command.getPeriod());
ImmutableSet.Builder<ImmutableObject> entitiesToSave = new ImmutableSet.Builder<>();
handleExtraFlowLogic(