RDAP: Display summary data for search result items

It appears to be standard RDAP practice when returning result sets for domain, nameserver and entity searches to give only summary data for each result item. Any information that can be gleaned from the object itself is included, but related resources are not included. For a domain, for instance, the domain information is included, but nameservers, entities and events (which come from history entries) are suppressed. In their place, there is a standard boilerplate remark in the object indicating that only summary data is included, and that the user should query the item directly to get the full data. Note that summary data is used only for searches; direct queries for an item will still return full data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133973835
This commit is contained in:
mountford 2016-09-22 11:00:37 -07:00 committed by Ben McIlwain
parent 740d49e22e
commit b5e421cee3
25 changed files with 773 additions and 1120 deletions

View file

@ -732,6 +732,25 @@ public class DatastoreHelper {
return persistResource(resource, true);
}
private static <R> void saveResource(final R resource, final boolean wantBackup) {
Saver saver = wantBackup ? ofy().save() : ofy().saveWithoutBackup();
saver.entity(resource);
if (resource instanceof EppResource) {
EppResource eppResource = (EppResource) resource;
assertWithMessage("Cannot persist an EppResource with a missing repoId in tests")
.that(eppResource.getRepoId()).isNotEmpty();
Key<EppResource> eppResourceKey = Key.create(eppResource);
saver.entity(EppResourceIndex.create(eppResourceKey));
if (resource instanceof ForeignKeyedEppResource) {
saver.entity(ForeignKeyIndex.create(eppResource, eppResource.getDeletionTime()));
}
if (resource instanceof DomainApplication) {
saver.entity(
DomainApplicationIndex.createUpdatedInstance((DomainApplication) resource));
}
}
}
private static <R> R persistResource(final R resource, final boolean wantBackup) {
assertWithMessage("Attempting to persist a Builder is almost certainly an error in test code")
.that(resource)
@ -739,22 +758,7 @@ public class DatastoreHelper {
ofy().transact(new VoidWork() {
@Override
public void vrun() {
Saver saver = wantBackup ? ofy().save() : ofy().saveWithoutBackup();
saver.entity(resource);
if (resource instanceof EppResource) {
EppResource eppResource = (EppResource) resource;
assertWithMessage("Cannot persist an EppResource with a missing repoId in tests")
.that(eppResource.getRepoId()).isNotEmpty();
Key<EppResource> eppResourceKey = Key.create(eppResource);
saver.entity(EppResourceIndex.create(eppResourceKey));
if (resource instanceof ForeignKeyedEppResource) {
saver.entity(ForeignKeyIndex.create(eppResource, eppResource.getDeletionTime()));
}
if (resource instanceof DomainApplication) {
saver.entity(
DomainApplicationIndex.createUpdatedInstance((DomainApplication) resource));
}
}
saveResource(resource, wantBackup);
}});
// Force the session to be cleared so that when we read it back, we read from the datastore
// and not from the transaction cache or memcache.
@ -762,6 +766,34 @@ public class DatastoreHelper {
return ofy().load().entity(resource).now();
}
public static <R> void persistResources(final Iterable<R> resources) {
persistResources(resources, false);
}
private static <R> void persistResources(final Iterable<R> resources, final boolean wantBackup) {
for (R resource : resources) {
assertWithMessage("Attempting to persist a Builder is almost certainly an error in test code")
.that(resource)
.isNotInstanceOf(Buildable.Builder.class);
}
// Persist domains ten at a time, to avoid exceeding the entity group limit.
for (final List<R> chunk : Iterables.partition(resources, 10)) {
ofy().transact(new VoidWork() {
@Override
public void vrun() {
for (R resource : chunk) {
saveResource(resource, wantBackup);
}
}});
}
// Force the session to be cleared so that when we read it back, we read from the datastore
// and not from the transaction cache or memcache.
ofy().clearSessionCache();
for (R resource : resources) {
ofy().load().entity(resource).now();
}
}
/**
* Saves an {@link EppResource} with partial history and commit log entries.
*