Skip to content
Snippets Groups Projects
Commit 1c81fbef authored by Thorsten Vitt's avatar Thorsten Vitt
Browse files

Don't call listAggregations for non-aggregations (workaround)

parent fec0cdc0
No related branches found
No related tags found
No related merge requests found
......@@ -29,14 +29,14 @@ public abstract class AggregationTreeWalker {
* metadata. The specialized walk method's <var>again</var> parameter is
* passed the information whether this object has been already seen before.
* </p>
*
*
* <p>
* The {@link AggregationTreeWalker} implementation calls
* {@link #walkAggregation(ObjectType, boolean)} if the object's format
* contains "aggregation", otherwise, the object is only added to the
* registry. Clients should extend or override.
* </p>
*
*
* @param object
* the metadata of the object to process.
* @param again
......@@ -69,7 +69,7 @@ protected boolean walk(final ObjectType object, final boolean again) {
/**
* Iterates through the given <var>aggregation</var>'s contents unless it is
* visited <var>again</var>.
*
*
* <p>
* This method will issue a
* {@linkplain SearchClient#listAggregation(String) TG-search request to
......@@ -79,11 +79,11 @@ protected boolean walk(final ObjectType object, final boolean again) {
* request does not return object metadata,
* {@link #walkInaccessibleURI(String)} will be called instead.
* </p>
*
*
* <p>
* Clients may extend or override if they need special treatment.
* </p>
*
*
* @param aggregation
* The metadata of the aggregation to list.
* @param again
......@@ -94,11 +94,17 @@ protected void walkAggregation(final ObjectType aggregation,
final boolean again) {
if (again)
return;
// FIXME walkAggregation is also called for works, but it shouldn't.
// This is a workaround, we actually shoud factor out the work handling
// in the subclasses ...
if (!aggregation.getGeneric().getProvided().getFormat().contains("aggregation"))
return;
if (getRepository() == null)
throw new IllegalStateException(
"AggregationTreeWalkers must be initialized with a repository before use.");
final SearchClient searchClient = getSearchClient(isPublic(aggregation));
final String id = aggregation.getGeneric().getGenerated()
.getTextgridUri().getValue();
......@@ -121,6 +127,7 @@ protected void walkAggregation(final ObjectType aggregation,
}
/** for logging / debugging purposes */
private static String describe(final ObjectType object) {
final StringBuilder builder = new StringBuilder();
try {
......@@ -161,9 +168,9 @@ protected SearchClient getSearchClient(final boolean isPublic) {
/**
* Called by {@link #walkAggregation(ObjectType, boolean)} when the
* aggregation contains entries for which there is no metadata included.
*
*
* The default implementation does nothing, clients may override.
*
*
* @param textgridUri
* the URI listed in the aggregation.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment