use of org.olat.modules.wiki.WikiPage in project openolat by klemens.
the class WikiMediaHandler method createMedia.
@Override
public Media createMedia(String title, String description, Object mediaObject, String businessPath, Identity author) {
String content = null;
if (mediaObject instanceof WikiPage) {
WikiPage page = (WikiPage) mediaObject;
content = page.getContent();
}
Media media = mediaDao.createMedia(title, description, content, WIKI_HANDLER, businessPath, null, 70, author);
ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_MEDIA_ADDED, getClass(), LoggingResourceable.wrap(media));
return media;
}
use of org.olat.modules.wiki.WikiPage in project openolat by klemens.
the class WikiCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) {
String repoEntryName = "*name not available*";
try {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, TYPE);
Document nodeDocument = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(nodeDocument);
RepositoryEntry repositoryEntry = courseNode.getReferencedRepositoryEntry();
if (repositoryEntry == null)
return;
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 {
courseNodeResourceContext.setFilePath(wikiPage.getPageName());
Document document = WikiPageDocument.createDocument(courseNodeResourceContext, wikiPage);
indexWriter.addDocument(document);
} catch (Exception e) {
log.error("Error indexing wiki page:" + (wikiPage == null ? "null" : wikiPage.getPageName()), e);
}
}
} catch (Exception e) {
log.error("Error indexing wiki:" + repoEntryName, e);
}
}
Aggregations