mirror of
https://github.com/google/nomulus
synced 2026-08-27 19:37:07 +00:00
Load referenced contact/hosts from EPP more efficiently
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=122459862
This commit is contained in:
committed by
Justine Tunney
parent
86f3287761
commit
618050dc32
@@ -17,7 +17,9 @@ package google.registry.flows;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import google.registry.model.annotations.ExternalMessagingName;
|
||||
import google.registry.model.eppinput.EppInput.InnerCommand;
|
||||
@@ -117,11 +119,21 @@ public abstract class EppException extends Exception {
|
||||
super(
|
||||
String.format(
|
||||
"The %s with given ID (%s) doesn't exist.",
|
||||
!type.isAnnotationPresent(ExternalMessagingName.class)
|
||||
? "object"
|
||||
: type.getAnnotation(ExternalMessagingName.class).value(),
|
||||
type.isAnnotationPresent(ExternalMessagingName.class)
|
||||
? type.getAnnotation(ExternalMessagingName.class).value()
|
||||
: "object",
|
||||
id));
|
||||
}
|
||||
|
||||
public ObjectDoesNotExistException(Class<?> type, ImmutableSet<String> ids) {
|
||||
super(
|
||||
String.format(
|
||||
"The %s with given IDs (%s) don't exist.",
|
||||
type.isAnnotationPresent(ExternalMessagingName.class)
|
||||
? type.getAnnotation(ExternalMessagingName.class).value() + " objects"
|
||||
: "objects",
|
||||
Joiner.on(',').join(ids)));
|
||||
}
|
||||
}
|
||||
|
||||
/** Abstract exception class. Do not throw this directly or catch in tests. */
|
||||
|
||||
@@ -89,7 +89,7 @@ import java.util.List;
|
||||
* @error {@link DomainFlowUtils.InvalidPunycodeException}
|
||||
* @error {@link DomainFlowUtils.LaunchPhaseMismatchException}
|
||||
* @error {@link DomainFlowUtils.LeadingDashException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourceDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourcesDoNotExistException}
|
||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||
* @error {@link DomainFlowUtils.NameserversNotAllowedException}
|
||||
* @error {@link DomainFlowUtils.NoMarksFoundMatchingDomainException}
|
||||
|
||||
@@ -46,7 +46,7 @@ import google.registry.model.reporting.HistoryEntry;
|
||||
* @error {@link BaseDomainUpdateFlow.SecDnsAllUsageException}
|
||||
* @error {@link BaseDomainUpdateFlow.UrgentAttributeNotSupportedException}
|
||||
* @error {@link DomainFlowUtils.DuplicateContactForRoleException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourceDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourcesDoNotExistException}
|
||||
* @error {@link DomainFlowUtils.MissingAdminContactException}
|
||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||
* @error {@link DomainFlowUtils.MissingTechnicalContactException}
|
||||
|
||||
@@ -75,7 +75,7 @@ import java.util.Set;
|
||||
* @error {@link DomainFlowUtils.InvalidIdnDomainLabelException}
|
||||
* @error {@link DomainFlowUtils.InvalidPunycodeException}
|
||||
* @error {@link DomainFlowUtils.LeadingDashException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourceDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourcesDoNotExistException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourceInPendingDeleteProhibitsOperationException}
|
||||
* @error {@link DomainFlowUtils.MissingAdminContactException}
|
||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||
|
||||
@@ -64,7 +64,7 @@ import google.registry.model.domain.DesignatedContact;
|
||||
import google.registry.model.domain.DesignatedContact.Type;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.model.domain.DomainCommand.CreateOrUpdate;
|
||||
import google.registry.model.domain.DomainCommand.InvalidReferenceException;
|
||||
import google.registry.model.domain.DomainCommand.InvalidReferencesException;
|
||||
import google.registry.model.domain.DomainResource;
|
||||
import google.registry.model.domain.Period;
|
||||
import google.registry.model.domain.fee.BaseFeeCommand;
|
||||
@@ -405,8 +405,8 @@ public class DomainFlowUtils {
|
||||
throws EppException {
|
||||
try {
|
||||
return command.cloneAndLinkReferences(now);
|
||||
} catch (InvalidReferenceException e) {
|
||||
throw new LinkedResourceDoesNotExistException(e.getType(), e.getForeignKey());
|
||||
} catch (InvalidReferencesException e) {
|
||||
throw new LinkedResourcesDoNotExistException(e.getType(), e.getForeignKeys());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,9 +681,9 @@ public class DomainFlowUtils {
|
||||
}
|
||||
|
||||
/** Resource linked to this domain does not exist. */
|
||||
static class LinkedResourceDoesNotExistException extends ObjectDoesNotExistException {
|
||||
public LinkedResourceDoesNotExistException(Class<?> type, String resourceId) {
|
||||
super(type, resourceId);
|
||||
static class LinkedResourcesDoNotExistException extends ObjectDoesNotExistException {
|
||||
public LinkedResourcesDoNotExistException(Class<?> type, ImmutableSet<String> resourceIds) {
|
||||
super(type, resourceIds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ import java.util.Set;
|
||||
* @error {@link BaseDomainUpdateFlow.SecDnsAllUsageException}
|
||||
* @error {@link BaseDomainUpdateFlow.UrgentAttributeNotSupportedException}
|
||||
* @error {@link DomainFlowUtils.DuplicateContactForRoleException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourceDoesNotExistException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourcesDoNotExistException}
|
||||
* @error {@link DomainFlowUtils.LinkedResourceInPendingDeleteProhibitsOperationException}
|
||||
* @error {@link DomainFlowUtils.MissingAdminContactException}
|
||||
* @error {@link DomainFlowUtils.MissingContactTypeException}
|
||||
|
||||
Reference in New Issue
Block a user