if (getLogger().isDebugEnabled()) {
getLogger().debug("Obtaining requiring resources of [" + resource + "]");
}
DocumentSet resources = new DocumentSet();
SiteTree tree = getTree(resource);
SiteTreeNode node = tree.getNode(resource.getId());
if (node != null) {
List preOrder = node.preOrder();
// remove original resource (does not require itself)
preOrder.remove(0);
try {
for (int i = 0; i < preOrder.size(); i++) {
SiteTreeNode descendant = (SiteTreeNode) preOrder.get(i);
Label[] labels = descendant.getLabels();
for (int j = 0; j < labels.length; j++) {
Document version = resource.getIdentityMap().get(resource.getPublication(),
resource.getArea(),
descendant.getAbsoluteId(),
labels[j].getLanguage());
resources.add(version);
if (getLogger().isDebugEnabled()) {
getLogger().debug(" Descendant: [" + version + "]");
}
}
}
} catch (PublicationException e) {
throw new SiteException(e);
}
if (getLogger().isDebugEnabled()) {
getLogger().debug("Obtaining requiring resources completed.");
}
}
return resources.getDocuments();
}