mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Refactor Guava functional methods to use lambdas
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=177027488
This commit is contained in:
parent
2ae496bfce
commit
bbe2584da4
47 changed files with 478 additions and 647 deletions
|
@ -34,7 +34,6 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.template.soy.data.SoyMapData;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
import com.googlecode.objectify.Work;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DomainApplication;
|
||||
|
@ -71,27 +70,24 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
|
|||
.append(
|
||||
ofy()
|
||||
.transactNewReadOnly(
|
||||
new Work<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
String failureMessage =
|
||||
ofy()
|
||||
.load()
|
||||
.keys(applicationKeys)
|
||||
.values()
|
||||
.stream()
|
||||
.map(
|
||||
application ->
|
||||
application.getApplicationStatus()
|
||||
== ApplicationStatus.ALLOCATED
|
||||
? null
|
||||
: application.getFullyQualifiedDomainName())
|
||||
.filter(Objects::nonNull)
|
||||
.collect(joining("\n"));
|
||||
return failureMessage.isEmpty()
|
||||
? "ALL SUCCEEDED"
|
||||
: addHeader("FAILURES", failureMessage);
|
||||
}
|
||||
() -> {
|
||||
String failureMessage =
|
||||
ofy()
|
||||
.load()
|
||||
.keys(applicationKeys)
|
||||
.values()
|
||||
.stream()
|
||||
.map(
|
||||
application ->
|
||||
application.getApplicationStatus()
|
||||
== ApplicationStatus.ALLOCATED
|
||||
? null
|
||||
: application.getFullyQualifiedDomainName())
|
||||
.filter(Objects::nonNull)
|
||||
.collect(joining("\n"));
|
||||
return failureMessage.isEmpty()
|
||||
? "ALL SUCCEEDED"
|
||||
: addHeader("FAILURES", failureMessage);
|
||||
}))
|
||||
.toString();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue