mirror of
https://github.com/google/nomulus.git
synced 2025-06-27 06:44:51 +02:00
Fix nits on flows:
Rename existingResource flows variable to be specific to EPP resource type and replace some explicit checks with helper methods. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133774229
This commit is contained in:
parent
df70da48a2
commit
aed3c0f0d0
14 changed files with 125 additions and 156 deletions
|
@ -79,20 +79,20 @@ public class HostDeleteFlow extends LoggedInFlow implements TransactionalFlow {
|
|||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
failfastForAsyncDelete(targetId, now, HostResource.class, GET_NAMESERVERS);
|
||||
HostResource existingResource = loadResourceToMutate(HostResource.class, targetId, now);
|
||||
verifyNoDisallowedStatuses(existingResource, DISALLOWED_STATUSES);
|
||||
verifyOptionalAuthInfoForResource(authInfo, existingResource);
|
||||
HostResource existingHost = loadResourceToMutate(HostResource.class, targetId, now);
|
||||
verifyNoDisallowedStatuses(existingHost, DISALLOWED_STATUSES);
|
||||
verifyOptionalAuthInfoForResource(authInfo, existingHost);
|
||||
if (!isSuperuser) {
|
||||
verifyResourceOwnership(clientId, existingResource);
|
||||
verifyResourceOwnership(clientId, existingHost);
|
||||
}
|
||||
asyncFlowEnqueuer.enqueueAsyncDelete(existingResource, clientId, isSuperuser);
|
||||
HostResource newResource =
|
||||
existingResource.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build();
|
||||
asyncFlowEnqueuer.enqueueAsyncDelete(existingHost, clientId, isSuperuser);
|
||||
HostResource newHost =
|
||||
existingHost.asBuilder().addStatusValue(StatusValue.PENDING_DELETE).build();
|
||||
historyBuilder
|
||||
.setType(HistoryEntry.Type.HOST_PENDING_DELETE)
|
||||
.setModificationTime(now)
|
||||
.setParent(Key.create(existingResource));
|
||||
ofy().save().<Object>entities(newResource, historyBuilder.build());
|
||||
.setParent(Key.create(existingHost));
|
||||
ofy().save().<Object>entities(newHost, historyBuilder.build());
|
||||
return createOutput(SUCCESS_WITH_ACTION_PENDING);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue