mirror of
https://github.com/google/nomulus
synced 2026-08-01 12:56:06 +00: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:
@@ -14,7 +14,7 @@
|
||||
|
||||
package google.registry.rdap;
|
||||
|
||||
import static google.registry.model.EppResourceUtils.loadByUniqueId;
|
||||
import static google.registry.model.EppResourceUtils.loadByForeignKey;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.request.Action.Method.GET;
|
||||
import static google.registry.request.Action.Method.HEAD;
|
||||
@@ -118,7 +118,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
|
||||
// Handle queries without a wildcard -- just load by foreign key.
|
||||
if (!partialStringQuery.getHasWildcard()) {
|
||||
HostResource hostResource =
|
||||
loadByUniqueId(HostResource.class, partialStringQuery.getInitialString(), now);
|
||||
loadByForeignKey(HostResource.class, partialStringQuery.getInitialString(), now);
|
||||
if (hostResource == null) {
|
||||
throw new NotFoundException("No nameservers found");
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
|
||||
// looking for matches.
|
||||
} else {
|
||||
DomainResource domainResource =
|
||||
loadByUniqueId(DomainResource.class, partialStringQuery.getSuffix(), now);
|
||||
loadByForeignKey(DomainResource.class, partialStringQuery.getSuffix(), now);
|
||||
if (domainResource == null) {
|
||||
throw new NotFoundException("No domain found for specified nameserver suffix");
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class RdapNameserverSearchAction extends RdapActionBase {
|
||||
// We can't just check that the host name starts with the initial query string, because then
|
||||
// the query ns.exam*.example.com would match against nameserver ns.example.com.
|
||||
if (partialStringQuery.matches(fqhn)) {
|
||||
HostResource hostResource = loadByUniqueId(HostResource.class, fqhn, now);
|
||||
HostResource hostResource = loadByForeignKey(HostResource.class, fqhn, now);
|
||||
if (hostResource != null) {
|
||||
hostListBuilder.add(hostResource);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user