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:
cgoldfeder 2016-05-16 14:34:26 -07:00 committed by Justine Tunney
parent 86f3287761
commit 618050dc32
11 changed files with 113 additions and 64 deletions

View file

@ -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. */