Flatten the hosts flows

There's so little meat here that there's not much
reason to break this cl up any further

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133171754
This commit is contained in:
cgoldfeder 2016-07-10 14:10:42 -04:00 committed by Ben McIlwain
parent 00ea99960a
commit 516b5663a5
12 changed files with 336 additions and 210 deletions

View file

@ -64,6 +64,13 @@ public class ContactDeleteFlow extends LoggedInFlow implements TransactionalFlow
StatusValue.PENDING_DELETE,
StatusValue.SERVER_DELETE_PROHIBITED);
private static final Function<DomainBase, ImmutableSet<?>> GET_REFERENCED_CONTACTS =
new Function<DomainBase, ImmutableSet<?>>() {
@Override
public ImmutableSet<?> apply(DomainBase domain) {
return domain.getReferencedContacts();
}};
@Inject AsyncFlowEnqueuer asyncFlowEnqueuer;
@Inject @ClientId String clientId;
@Inject @TargetId String targetId;
@ -79,15 +86,7 @@ public class ContactDeleteFlow extends LoggedInFlow implements TransactionalFlow
@Override
public final EppOutput run() throws EppException {
failfastForAsyncDelete(
targetId,
now,
ContactResource.class,
new Function<DomainBase, ImmutableSet<?>>() {
@Override
public ImmutableSet<?> apply(DomainBase domain) {
return domain.getReferencedContacts();
}});
failfastForAsyncDelete(targetId, now, ContactResource.class, GET_REFERENCED_CONTACTS);
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
if (existingResource == null) {
throw new ResourceToMutateDoesNotExistException(ContactResource.class, targetId);