mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Replace many Work and VoidWork usages with lambdas
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=176153460
This commit is contained in:
parent
603e0470cc
commit
cd314bdc75
36 changed files with 443 additions and 680 deletions
|
@ -30,7 +30,6 @@ import com.google.common.collect.FluentIterable;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.VoidWork;
|
||||
import com.googlecode.objectify.Work;
|
||||
import com.googlecode.objectify.annotation.EmbedMap;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
|
@ -157,31 +156,27 @@ public class SignedMarkRevocationList extends ImmutableObject {
|
|||
public SignedMarkRevocationList save() {
|
||||
ofy()
|
||||
.transact(
|
||||
new VoidWork() {
|
||||
@Override
|
||||
public void vrun() {
|
||||
ofy()
|
||||
.deleteWithoutBackup()
|
||||
.keys(
|
||||
ofy()
|
||||
.load()
|
||||
.type(SignedMarkRevocationList.class)
|
||||
.ancestor(getCrossTldKey())
|
||||
.keys());
|
||||
ofy()
|
||||
.saveWithoutBackup()
|
||||
.entities(
|
||||
FluentIterable.from(CollectionUtils.partitionMap(revokes, SHARD_SIZE))
|
||||
.transform(
|
||||
(ImmutableMap<String, DateTime> shardRevokes) -> {
|
||||
SignedMarkRevocationList shard =
|
||||
create(creationTime, shardRevokes);
|
||||
shard.id = allocateId();
|
||||
shard.isShard =
|
||||
true; // Avoid the exception in disallowUnshardedSaves().
|
||||
return shard;
|
||||
}));
|
||||
}
|
||||
() -> {
|
||||
ofy()
|
||||
.deleteWithoutBackup()
|
||||
.keys(
|
||||
ofy()
|
||||
.load()
|
||||
.type(SignedMarkRevocationList.class)
|
||||
.ancestor(getCrossTldKey())
|
||||
.keys());
|
||||
ofy()
|
||||
.saveWithoutBackup()
|
||||
.entities(
|
||||
FluentIterable.from(CollectionUtils.partitionMap(revokes, SHARD_SIZE))
|
||||
.transform(
|
||||
(ImmutableMap<String, DateTime> shardRevokes) -> {
|
||||
SignedMarkRevocationList shard = create(creationTime, shardRevokes);
|
||||
shard.id = allocateId();
|
||||
shard.isShard =
|
||||
true; // Avoid the exception in disallowUnshardedSaves().
|
||||
return shard;
|
||||
}));
|
||||
});
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue