use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class BCCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (isLogDebugEnabled())
logDebug("Index Briefcase...");
BCCourseNode bcNode = (BCCourseNode) courseNode;
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, bcNode, TYPE);
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, bcNode);
indexWriter.addDocument(document);
VFSContainer bcContainer = null;
if (bcNode.getModuleConfiguration().getBooleanSafe(BCCourseNodeEditController.CONFIG_AUTO_FOLDER)) {
bcContainer = BCCourseNode.getNodeFolderContainer(bcNode, course.getCourseEnvironment());
} else {
String subpath = courseNode.getModuleConfiguration().getStringValue(BCCourseNodeEditController.CONFIG_SUBPATH);
if (subpath != null) {
VFSItem item = course.getCourseEnvironment().getCourseFolderContainer().resolve(subpath);
if (item instanceof VFSContainer) {
bcContainer = new NamedContainerImpl(courseNode.getShortTitle(), (VFSContainer) item);
}
}
}
if (bcContainer != null) {
doIndexVFSContainer(courseNodeResourceContext, bcContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class CPCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, TYPE);
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(document);
RepositoryEntry re = CPEditController.getCPReference(courseNode.getModuleConfiguration(), false);
if (re != null) {
File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
if (cpRoot != null) {
VFSContainer rootContainer = new LocalFolderImpl(cpRoot);
doIndexVFSContainer(courseNodeResourceContext, rootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
}
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class GroupFolderIndexer 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;
String path = collaborationManager.getFolderRelPath(businessGroup);
OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(path, null);
SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext);
forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFOLDER);
forumSearchResourceContext.setDocumentType(TYPE);
forumSearchResourceContext.setParentContextType(GroupDocument.TYPE);
forumSearchResourceContext.setParentContextName(businessGroup.getName());
doIndexVFSContainer(forumSearchResourceContext, rootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class GroupInfoIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext searchResourceContext, Object businessObject, OlatFullIndexer indexerWriter) throws IOException, InterruptedException {
if (!(businessObject instanceof BusinessGroup))
throw new AssertException("businessObject must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObject;
try {
SearchResourceContext messagesGroupResourceContext = new SearchResourceContext(searchResourceContext);
messagesGroupResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLMSG);
messagesGroupResourceContext.setDocumentType(TYPE);
doIndexInfos(messagesGroupResourceContext, businessGroup, indexerWriter);
} catch (Exception ex) {
log.error("Exception indexing businessGroup=" + businessGroup, ex);
} catch (Error err) {
log.error("Error indexing businessGroup=" + businessGroup, err);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class DialogCourseNodeIndexer method doIndexAllMessages.
private void doIndexAllMessages(SearchResourceContext parentResourceContext, Forum forum, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
// loop over all messages of a forum
List<Message> messages = ForumManager.getInstance().getMessagesByForum(forum);
for (Message message : messages) {
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
searchResourceContext.setBusinessControlFor(message);
searchResourceContext.setDocumentType(TYPE_MESSAGE);
Document document = ForumMessageDocument.createDocument(searchResourceContext, message);
indexWriter.addDocument(document);
}
}
Aggregations