mirror of
https://github.com/google/nomulus
synced 2026-01-05 21:15:18 +00:00
Minor cleanups in host flows
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133760258
This commit is contained in:
@@ -14,19 +14,17 @@
|
||||
|
||||
package google.registry.flows.host;
|
||||
|
||||
import static google.registry.flows.ResourceFlowUtils.loadResourceForQuery;
|
||||
import static google.registry.flows.ResourceFlowUtils.verifyOptionalAuthInfoForResource;
|
||||
import static google.registry.model.EppResourceUtils.cloneResourceWithLinkedStatus;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.eppoutput.Result.Code.SUCCESS;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import google.registry.flows.EppException;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.flows.LoggedInFlow;
|
||||
import google.registry.flows.exceptions.ResourceToQueryDoesNotExistException;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.model.host.HostCommand.Info;
|
||||
import google.registry.model.host.HostResource;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -37,18 +35,13 @@ import javax.inject.Inject;
|
||||
*/
|
||||
public class HostInfoFlow extends LoggedInFlow {
|
||||
|
||||
@Inject ResourceCommand resourceCommand;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject Optional<AuthInfo> authInfo;
|
||||
@Inject HostInfoFlow() {}
|
||||
|
||||
@Override
|
||||
public EppOutput run() throws EppException {
|
||||
Info command = (Info) resourceCommand;
|
||||
String targetId = command.getTargetId();
|
||||
HostResource existingResource = loadByUniqueId(HostResource.class, targetId, now);
|
||||
if (existingResource == null) {
|
||||
throw new ResourceToQueryDoesNotExistException(HostResource.class, targetId);
|
||||
}
|
||||
HostResource existingResource = loadResourceForQuery(HostResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, existingResource);
|
||||
return createOutput(SUCCESS, cloneResourceWithLinkedStatus(existingResource, now));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user