diff --git a/src/main/java/info/textgrid/services/aggregator/AggregationTreeWalker.java b/src/main/java/info/textgrid/services/aggregator/AggregationTreeWalker.java index 8c4f626db3e8783d2a1f394b20056a7396e3b611..90ed64d96cb3c939725d414ae2fd494ea5d16748 100644 --- a/src/main/java/info/textgrid/services/aggregator/AggregationTreeWalker.java +++ b/src/main/java/info/textgrid/services/aggregator/AggregationTreeWalker.java @@ -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. */