mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Replace loadByUniqueId() with methods that don't overload unique id
It is replaced by loadByForeignKey(), which does the same thing that loadByUniqueId() did for contacts, hosts, and domains, and also loadDomainApplication(), which loads domain application by ROID. This eliminates the ugly mode-switching of attemping to load by other foreign key or ROID. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133980156
This commit is contained in:
parent
025a4ae012
commit
21a98b899c
57 changed files with 367 additions and 340 deletions
|
@ -15,7 +15,7 @@
|
|||
package google.registry.flows;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.EppResourceUtils.queryDomainsUsingResource;
|
||||
import static google.registry.model.domain.DomainResource.extendRegistrationWithCap;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
|
@ -287,7 +287,7 @@ public class ResourceFlowUtils {
|
|||
|
||||
public static <R extends EppResource> R loadResourceForQuery(
|
||||
Class<R> clazz, String targetId, DateTime now) throws ResourceToQueryDoesNotExistException {
|
||||
R resource = loadByUniqueId(clazz, targetId, now);
|
||||
R resource = loadByForeignKey(clazz, targetId, now);
|
||||
if (resource == null) {
|
||||
throw new ResourceToQueryDoesNotExistException(clazz, targetId);
|
||||
}
|
||||
|
@ -296,7 +296,7 @@ public class ResourceFlowUtils {
|
|||
|
||||
public static <R extends EppResource> R loadResourceToMutate(
|
||||
Class<R> clazz, String targetId, DateTime now) throws ResourceToMutateDoesNotExistException {
|
||||
R resource = loadByUniqueId(clazz, targetId, now);
|
||||
R resource = loadByForeignKey(clazz, targetId, now);
|
||||
if (resource == null) {
|
||||
throw new ResourceToMutateDoesNotExistException(clazz, targetId);
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ public class ResourceFlowUtils {
|
|||
|
||||
public static <R extends EppResource> void verifyResourceDoesNotExist(
|
||||
Class<R> clazz, String targetId, DateTime now) throws EppException {
|
||||
if (loadByUniqueId(clazz, targetId, now) != null) {
|
||||
if (loadByForeignKey(clazz, targetId, now) != null) {
|
||||
throw new ResourceAlreadyExistsException(targetId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue