mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +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
|
@ -14,16 +14,15 @@
|
|||
|
||||
package google.registry.flows.contact;
|
||||
|
||||
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.contact.ContactResource;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppoutput.EppOutput;
|
||||
|
@ -42,11 +41,8 @@ public class ContactInfoFlow extends LoggedInFlow {
|
|||
|
||||
@Override
|
||||
public final EppOutput run() throws EppException {
|
||||
ContactResource existingResource = loadByUniqueId(ContactResource.class, targetId, now);
|
||||
if (existingResource == null) {
|
||||
throw new ResourceToQueryDoesNotExistException(ContactResource.class, targetId);
|
||||
}
|
||||
verifyOptionalAuthInfoForResource(authInfo, existingResource);
|
||||
return createOutput(SUCCESS, cloneResourceWithLinkedStatus(existingResource, now));
|
||||
ContactResource contact = loadResourceForQuery(ContactResource.class, targetId, now);
|
||||
verifyOptionalAuthInfoForResource(authInfo, contact);
|
||||
return createOutput(SUCCESS, cloneResourceWithLinkedStatus(contact, now));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue