use of org.olat.modules.wiki.Wiki in project OpenOLAT by OpenOLAT.
the class GroupWikiIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (!(businessObj instanceof BusinessGroup))
throw new AssertException("businessObj must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObj;
// Index Group Wiki
if (isLogDebugEnabled())
logDebug("Analyse Wiki for Group=" + businessGroup);
CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
if (collabTools.isToolEnabled(CollaborationTools.TOOL_WIKI)) {
try {
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(businessGroup);
// loop over all wiki pages
List<WikiPage> wikiPageList = wiki.getAllPagesWithContent();
for (WikiPage wikiPage : wikiPageList) {
SearchResourceContext wikiResourceContext = new SearchResourceContext(parentResourceContext);
wikiResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLWIKI);
wikiResourceContext.setDocumentType(TYPE);
wikiResourceContext.setFilePath(wikiPage.getPageName());
Document document = WikiPageDocument.createDocument(wikiResourceContext, wikiPage);
indexWriter.addDocument(document);
}
} catch (NullPointerException nex) {
logWarn("NullPointerException in GroupWikiIndexer.doIndex.", nex);
}
} else {
if (isLogDebugEnabled())
logDebug("Group=" + businessGroup + " has no Wiki.");
}
}
use of org.olat.modules.wiki.Wiki in project OpenOLAT by OpenOLAT.
the class OlatWikiDataHandler method exists.
/**
* @see org.jamwiki.DataHandler#exists(java.lang.String, java.lang.String)
*/
public boolean exists(String virtualWiki, String topic) {
if (!StringUtils.hasText(topic)) {
return false;
}
if (PseudoTopicHandler.isPseudoTopic(topic)) {
return true;
}
if (InterWikiHandler.isInterWiki(topic)) {
return true;
}
// try {
// Utilities.validateTopicName(topic);
// } catch (WikiException e) {
// throw new OLATRuntimeException(this.getClass(), "invalid topic name!", e);
// }
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
if (topic.startsWith(IMAGE_NAMESPACE) || topic.startsWith(MEDIA_NAMESPACE)) {
return wiki.pageExists(topic);
}
String pageId = WikiManager.generatePageId(FilterUtil.normalizeWikiLink(topic));
return wiki.pageExists(pageId);
}
use of org.olat.modules.wiki.Wiki in project OpenOLAT by OpenOLAT.
the class WikiRepositoryIndexer method doIndex.
/**
* @see org.olat.repository.handlers.RepositoryHandler#supportsDownload()
*/
@Override
public void doIndex(SearchResourceContext resourceContext, Object parentObject, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
RepositoryEntry repositoryEntry = (RepositoryEntry) parentObject;
if (isLogDebugEnabled())
logDebug("Analyse Wiki RepositoryEntry...");
String repoEntryName = "*name not available*";
try {
repoEntryName = repositoryEntry.getDisplayname();
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(repositoryEntry.getOlatResource());
// loop over all wiki pages
List<WikiPage> wikiPageList = wiki.getAllPagesWithContent();
for (WikiPage wikiPage : wikiPageList) {
try {
SearchResourceContext wikiContext = new SearchResourceContext(resourceContext);
wikiContext.setDocumentType(TYPE);
wikiContext.setFilePath(wikiPage.getPageName());
Document document = WikiPageDocument.createDocument(wikiContext, wikiPage);
indexWriter.addDocument(document);
} catch (Exception e) {
logError("Error indexing wiki page:" + repoEntryName + " " + (wikiPage == null ? "null" : wikiPage.getPageName()), e);
}
}
} catch (Exception e) {
logError("Error indexing wiki:" + repoEntryName, e);
}
}
use of org.olat.modules.wiki.Wiki in project openolat by klemens.
the class GroupWikiIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (!(businessObj instanceof BusinessGroup))
throw new AssertException("businessObj must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObj;
// Index Group Wiki
if (isLogDebugEnabled())
logDebug("Analyse Wiki for Group=" + businessGroup);
CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
if (collabTools.isToolEnabled(CollaborationTools.TOOL_WIKI)) {
try {
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(businessGroup);
// loop over all wiki pages
List<WikiPage> wikiPageList = wiki.getAllPagesWithContent();
for (WikiPage wikiPage : wikiPageList) {
SearchResourceContext wikiResourceContext = new SearchResourceContext(parentResourceContext);
wikiResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLWIKI);
wikiResourceContext.setDocumentType(TYPE);
wikiResourceContext.setFilePath(wikiPage.getPageName());
Document document = WikiPageDocument.createDocument(wikiResourceContext, wikiPage);
indexWriter.addDocument(document);
}
} catch (NullPointerException nex) {
logWarn("NullPointerException in GroupWikiIndexer.doIndex.", nex);
}
} else {
if (isLogDebugEnabled())
logDebug("Group=" + businessGroup + " has no Wiki.");
}
}
use of org.olat.modules.wiki.Wiki in project openolat by klemens.
the class WikiRepositoryIndexer method doIndex.
/**
* @see org.olat.repository.handlers.RepositoryHandler#supportsDownload()
*/
@Override
public void doIndex(SearchResourceContext resourceContext, Object parentObject, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
RepositoryEntry repositoryEntry = (RepositoryEntry) parentObject;
if (isLogDebugEnabled())
logDebug("Analyse Wiki RepositoryEntry...");
String repoEntryName = "*name not available*";
try {
repoEntryName = repositoryEntry.getDisplayname();
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(repositoryEntry.getOlatResource());
// loop over all wiki pages
List<WikiPage> wikiPageList = wiki.getAllPagesWithContent();
for (WikiPage wikiPage : wikiPageList) {
try {
SearchResourceContext wikiContext = new SearchResourceContext(resourceContext);
wikiContext.setDocumentType(TYPE);
wikiContext.setFilePath(wikiPage.getPageName());
Document document = WikiPageDocument.createDocument(wikiContext, wikiPage);
indexWriter.addDocument(document);
} catch (Exception e) {
logError("Error indexing wiki page:" + repoEntryName + " " + (wikiPage == null ? "null" : wikiPage.getPageName()), e);
}
}
} catch (Exception e) {
logError("Error indexing wiki:" + repoEntryName, e);
}
}
Aggregations