use of com.xpn.xwiki.doc.XWikiSpace in project xwiki-platform by xwiki.
the class R72001XWIKI12228DataMigration method createSpaces.
private void createSpaces(Collection<SpaceReference> spaces, boolean hidden, Session session) {
// Create spaces in the xwikispace table
for (SpaceReference spaceReference : spaces) {
XWikiSpace space = new XWikiSpace(spaceReference);
space.setHidden(hidden);
session.save(space);
}
}
use of com.xpn.xwiki.doc.XWikiSpace in project xwiki-platform by xwiki.
the class XWikiHibernateStore method makeSpaceVisible.
private void makeSpaceVisible(SpaceReference spaceReference, Session session) {
XWikiSpace space = loadXWikiSpace(spaceReference, session);
makeSpaceVisible(space, session);
}
use of com.xpn.xwiki.doc.XWikiSpace in project xwiki-platform by xwiki.
the class XWikiHibernateStore method maybeMakeSpaceHidden.
private void maybeMakeSpaceHidden(SpaceReference spaceReference, String modifiedDocument, Session session) {
XWikiSpace space = loadXWikiSpace(spaceReference, session);
// The space is supposed to exist
if (space == null) {
this.logger.warn("Space [{}] does not exist. Usually means the spaces table is not in sync with the documents table.", spaceReference);
return;
}
// If the space is already hidden return
if (space.isHidden()) {
return;
}
if (calculateHiddenStatus(spaceReference, modifiedDocument, session)) {
// Make the space hidden
space.setHidden(true);
session.update(space);
// Update space parent
if (spaceReference.getParent() instanceof SpaceReference) {
maybeMakeSpaceHidden((SpaceReference) spaceReference.getParent(), modifiedDocument, session);
}
}
}
use of com.xpn.xwiki.doc.XWikiSpace in project xwiki-platform by xwiki.
the class XWikiHibernateStore method maybeDeleteXWikiSpace.
private void maybeDeleteXWikiSpace(SpaceReference spaceReference, String deletedDocument, Session session) {
if (countAllDocuments(spaceReference, session, "fullName <> ? AND (language IS NULL OR language = '')", deletedDocument) == 0) {
// The document was the last document in the space
XWikiSpace space = new XWikiSpace(spaceReference, this);
session.delete(space);
// Update parent
if (spaceReference.getParent() instanceof SpaceReference) {
maybeDeleteXWikiSpace((SpaceReference) spaceReference.getParent(), deletedDocument, session);
}
} else {
// Update space hidden property if needed
maybeMakeSpaceHidden(spaceReference, deletedDocument, session);
}
}
Aggregations