use of org.xwiki.model.reference.EntityReferenceTreeNode in project xwiki-platform by xwiki.
the class AbstractEntityJob method visitDocumentAncestor.
private void visitDocumentAncestor(EntityReferenceTreeNode node, Visitor<DocumentReference> visitor) {
Collection<EntityReferenceTreeNode> children = node.getChildren();
this.progressManager.pushLevelProgress(children.size(), this);
try {
// Visit the space preferences document at the end as otherwise we may loose the space access rights.
EntityReferenceTreeNode spacePreferencesNode = null;
for (EntityReferenceTreeNode child : children) {
if (isSpacePreferencesReference(child.getReference())) {
spacePreferencesNode = child;
continue;
}
visitDocumentAncestorStep(child, visitor);
}
if (spacePreferencesNode != null) {
visitDocumentAncestorStep(spacePreferencesNode, visitor);
}
} finally {
this.progressManager.popLevelProgress(this);
}
}
use of org.xwiki.model.reference.EntityReferenceTreeNode in project xwiki-platform by xwiki.
the class InstanceInputFilterStream method writeSpace.
private void writeSpace(EntityReferenceTreeNode node, Object filter, InstanceFilter proxyFilter) throws FilterException {
SpaceReference spaceReference = (SpaceReference) node.getReference();
FilterEventParameters parameters = new FilterEventParameters();
// Get begin/end space parameters
for (InstanceInputEventGenerator generator : this.eventGenerators) {
generator.setWikiSpaceParameters(spaceReference.getName(), parameters);
}
// Begin space
proxyFilter.beginWikiSpace(spaceReference.getName(), parameters);
// Extend begin space
for (InstanceInputEventGenerator generator : this.eventGenerators) {
generator.beginWikiSpace(spaceReference.getName(), parameters);
}
// Write documents
for (DocumentReference documentReference : this.instanceModel.getDocumentReferences(spaceReference)) {
if (isDocumentEnabled(documentReference)) {
writeDocument(documentReference, filter, proxyFilter);
} else {
if (this.properties.isVerbose()) {
this.logger.info(LOG_DOCUMENT_SKIPPED, "Skipped document [{}]", documentReference);
}
}
}
// Write nested spaces
for (EntityReferenceTreeNode child : node.getChildren()) {
writeSpace(child, filter, proxyFilter);
}
// Extend end space
for (InstanceInputEventGenerator generator : this.eventGenerators) {
generator.endWikiSpace(spaceReference.getName(), parameters);
}
// End space
proxyFilter.endWikiSpace(spaceReference.getName(), parameters);
}
use of org.xwiki.model.reference.EntityReferenceTreeNode in project xwiki-platform by xwiki.
the class InstanceInputFilterStream method writeWiki.
private void writeWiki(WikiReference wikiReference, Object filter, InstanceFilter proxyFilter) throws FilterException {
FilterEventParameters parameters = new FilterEventParameters();
for (InstanceInputEventGenerator generator : this.eventGenerators) {
generator.setWikiParameters(wikiReference.getName(), parameters);
}
proxyFilter.beginWiki(wikiReference.getName(), parameters);
for (InstanceInputEventGenerator generator : this.eventGenerators) {
generator.beginWiki(wikiReference.getName(), parameters);
}
// TODO: improve with a new space related API to get space level by space level instead of all of them at the
// same time
EntityReferenceTreeNode spaces = this.instanceModel.getSpaceReferences(wikiReference);
for (EntityReferenceTreeNode node : spaces.getChildren()) {
if (isSpaceEnabled((SpaceReference) node.getReference())) {
writeSpace(node, filter, proxyFilter);
}
}
for (InstanceInputEventGenerator generator : this.eventGenerators) {
generator.endWiki(wikiReference.getName(), parameters);
}
proxyFilter.endWiki(wikiReference.getName(), parameters);
}
Aggregations