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

ZIP: Don't forget the work objects.

If an edition is associated with a work object that it doesn't
aggregate, the work object is manually added to the aggregation tree.

git-svn-id: https://develop.sub.uni-goettingen.de/repos/textgrid/trunk/services/aggregator@14164 7c539038-3410-0410-b1ec-0f2a7bf1c452
parent 0b639b31
No related branches found
No related tags found
No related merge requests found
package info.textgrid.services.aggregator.tree; package info.textgrid.services.aggregator.tree;
import info.textgrid.namespaces.metadata.core._2010.ObjectType; import info.textgrid.namespaces.metadata.core._2010.ObjectType;
import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.AuthFault;
import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.IoFault;
import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.MetadataParseFault;
import info.textgrid.namespaces.middleware.tgcrud.services.tgcrudservice.ObjectNotFoundFault;
import info.textgrid.services.aggregator.AggregationTreeWalker; import info.textgrid.services.aggregator.AggregationTreeWalker;
import info.textgrid.services.aggregator.ITextGridRep; import info.textgrid.services.aggregator.ITextGridRep;
import java.util.Deque; import java.util.Deque;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.ibm.icu.text.MessageFormat;
public class AggregationTreeFactory extends AggregationTreeWalker { public class AggregationTreeFactory extends AggregationTreeWalker {
...@@ -39,6 +45,48 @@ protected void walkAggregation(final ObjectType aggregation, ...@@ -39,6 +45,48 @@ protected void walkAggregation(final ObjectType aggregation,
final boolean again) { final boolean again) {
stack.push(new Aggregation(aggregation, stack.peek())); stack.push(new Aggregation(aggregation, stack.peek()));
super.walkAggregation(aggregation, again); super.walkAggregation(aggregation, again);
if (aggregation.getEdition() != null
&& aggregation.getEdition().getIsEditionOf() != null) {
final String workURI = aggregation.getEdition().getIsEditionOf();
if (!seen.contains(workURI)) {
try {
final ObjectType workObject = getRepository()
.getCRUDService()
.readMetadata(getSid(), "", workURI).getObject();
walkAggregation(workObject, again);
} catch (final MetadataParseFault e) {
logger.log(
Level.WARNING,
MessageFormat
.format("Failed to retrieve work metadata for URI {0}, edition {1}",
workURI, stack.peek()), e);
walkInaccessibleURI(workURI);
} catch (final ObjectNotFoundFault e) {
logger.log(
Level.WARNING,
MessageFormat
.format("Failed to retrieve work metadata for URI {0}, edition {1}",
workURI, stack.peek()), e);
walkInaccessibleURI(workURI);
} catch (final IoFault e) {
logger.log(
Level.WARNING,
MessageFormat
.format("Failed to retrieve work metadata for URI {0}, edition {1}",
workURI, stack.peek()), e);
walkInaccessibleURI(workURI);
} catch (final AuthFault e) {
logger.log(
Level.WARNING,
MessageFormat
.format("Failed to retrieve work metadata for URI {0}, edition {1}",
workURI, stack.peek()), e);
walkInaccessibleURI(workURI);
}
}
}
this.root = stack.pop(); this.root = stack.pop();
} }
......
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