Search in sources :

Example 6 with DialogElementsManager

use of org.olat.course.nodes.dialog.DialogElementsManager in project OpenOLAT by OpenOLAT.

the class DialogCourseNodeIndexer method doIndex.

@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
    SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, null);
    Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
    indexWriter.addDocument(document);
    RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    DialogElementsManager dialogElmsMgr = CoreSpringFactory.getImpl(DialogElementsManager.class);
    List<DialogElement> elements = dialogElmsMgr.getDialogElements(entry, courseNode.getIdent());
    for (DialogElement element : elements) {
        Forum forum = element.getForum();
        doIndexAllMessages(courseNodeResourceContext, forum, indexWriter);
        doIndexFile(element, courseNodeResourceContext, indexWriter);
    }
}
Also used : SearchResourceContext(org.olat.search.service.SearchResourceContext) DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry) Document(org.apache.lucene.document.Document) ForumMessageDocument(org.olat.search.service.document.ForumMessageDocument) CourseNodeDocument(org.olat.search.service.document.CourseNodeDocument) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager) Forum(org.olat.modules.fo.Forum)

Example 7 with DialogElementsManager

use of org.olat.course.nodes.dialog.DialogElementsManager in project OpenOLAT by OpenOLAT.

the class DialogCourseNode method doArchiveElement.

/**
 * Archive a single dialog element with files and forum
 * @param element
 * @param exportDirectory
 */
public void doArchiveElement(DialogElement element, ZipOutputStream exportStream, Locale locale) {
    DialogElementsManager depm = CoreSpringFactory.getImpl(DialogElementsManager.class);
    String exportDirName = Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + element.getForum().getKey() + "_" + Formatter.formatDatetimeFilesystemSave(new Date());
    VFSContainer forumContainer = depm.getDialogContainer(element);
    for (VFSItem item : forumContainer.getItems(new VFSLeafFilter())) {
        ZipUtil.addToZip(item, exportDirName, exportStream);
    }
    ForumArchiveManager fam = ForumArchiveManager.getInstance();
    ForumFormatter ff = new ForumStreamedRTFFormatter(exportStream, exportDirName, false, locale);
    fam.applyFormatter(ff, element.getForum().getKey(), null);
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) ForumStreamedRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter) ForumArchiveManager(org.olat.modules.fo.archiver.ForumArchiveManager) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager) Date(java.util.Date) VFSLeafFilter(org.olat.core.util.vfs.filters.VFSLeafFilter)

Example 8 with DialogElementsManager

use of org.olat.course.nodes.dialog.DialogElementsManager in project openolat by klemens.

the class DialogCourseNodeIndexer method doIndex.

@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
    SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, null);
    Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
    indexWriter.addDocument(document);
    RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    DialogElementsManager dialogElmsMgr = CoreSpringFactory.getImpl(DialogElementsManager.class);
    List<DialogElement> elements = dialogElmsMgr.getDialogElements(entry, courseNode.getIdent());
    for (DialogElement element : elements) {
        Forum forum = element.getForum();
        doIndexAllMessages(courseNodeResourceContext, forum, indexWriter);
        doIndexFile(element, courseNodeResourceContext, indexWriter);
    }
}
Also used : SearchResourceContext(org.olat.search.service.SearchResourceContext) DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry) Document(org.apache.lucene.document.Document) ForumMessageDocument(org.olat.search.service.document.ForumMessageDocument) CourseNodeDocument(org.olat.search.service.document.CourseNodeDocument) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager) Forum(org.olat.modules.fo.Forum)

Example 9 with DialogElementsManager

use of org.olat.course.nodes.dialog.DialogElementsManager in project openolat by klemens.

the class DialogCourseNode method cleanupOnDelete.

/**
 * life cycle of node data e.g properties stuff should be deleted if node gets
 * deleted life cycle: create - delete - migrate
 */
@Override
public void cleanupOnDelete(ICourse course) {
    super.cleanupOnDelete(course);
    DialogElementsManager depm = CoreSpringFactory.getImpl(DialogElementsManager.class);
    RepositoryEntry entry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    List<DialogElement> dialogElements = depm.getDialogElements(entry, getIdent());
    for (DialogElement dialogElement : dialogElements) {
        Long forumKey = dialogElement.getForum().getKey();
        SubscriptionContext subsContext = CourseModule.createSubscriptionContext(course.getCourseEnvironment(), this, forumKey.toString());
        NotificationsManager.getInstance().delete(subsContext);
        depm.deleteDialogElement(dialogElement);
    }
}
Also used : DialogElement(org.olat.course.nodes.dialog.DialogElement) RepositoryEntry(org.olat.repository.RepositoryEntry) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager)

Example 10 with DialogElementsManager

use of org.olat.course.nodes.dialog.DialogElementsManager in project openolat by klemens.

the class DialogCourseNode method doArchiveElement.

/**
 * Archive a single dialog element with files and forum
 * @param element
 * @param exportDirectory
 */
public void doArchiveElement(DialogElement element, ZipOutputStream exportStream, Locale locale) {
    DialogElementsManager depm = CoreSpringFactory.getImpl(DialogElementsManager.class);
    String exportDirName = Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + element.getForum().getKey() + "_" + Formatter.formatDatetimeFilesystemSave(new Date());
    VFSContainer forumContainer = depm.getDialogContainer(element);
    for (VFSItem item : forumContainer.getItems(new VFSLeafFilter())) {
        ZipUtil.addToZip(item, exportDirName, exportStream);
    }
    ForumArchiveManager fam = ForumArchiveManager.getInstance();
    ForumFormatter ff = new ForumStreamedRTFFormatter(exportStream, exportDirName, false, locale);
    fam.applyFormatter(ff, element.getForum().getKey(), null);
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) ForumStreamedRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter) ForumArchiveManager(org.olat.modules.fo.archiver.ForumArchiveManager) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager) Date(java.util.Date) VFSLeafFilter(org.olat.core.util.vfs.filters.VFSLeafFilter)

Aggregations

DialogElementsManager (org.olat.course.nodes.dialog.DialogElementsManager)10 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 VFSLeafFilter (org.olat.core.util.vfs.filters.VFSLeafFilter)6 Date (java.util.Date)4 Document (org.apache.lucene.document.Document)4 VFSItem (org.olat.core.util.vfs.VFSItem)4 DialogElement (org.olat.course.nodes.dialog.DialogElement)4 ForumArchiveManager (org.olat.modules.fo.archiver.ForumArchiveManager)4 ForumFormatter (org.olat.modules.fo.archiver.formatters.ForumFormatter)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 CourseNodeDocument (org.olat.search.service.document.CourseNodeDocument)4 ForumMessageDocument (org.olat.search.service.document.ForumMessageDocument)4 IOException (java.io.IOException)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2 FullAccessCallback (org.olat.core.util.vfs.callbacks.FullAccessCallback)2 Forum (org.olat.modules.fo.Forum)2 ForumRTFFormatter (org.olat.modules.fo.archiver.formatters.ForumRTFFormatter)2 ForumStreamedRTFFormatter (org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter)2