use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class GroupInfoIndexer method doIndexInfos.
private void doIndexInfos(SearchResourceContext parentResourceContext, BusinessGroup businessGroup, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
List<InfoMessage> messages = infoMessageManager.loadInfoMessageByResource(businessGroup, InfoMessageFrontendManager.businessGroupResSubPath, null, null, null, 0, -1);
for (InfoMessage message : messages) {
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
OLATResourceable ores = OresHelper.createOLATResourceableInstance(InfoMessage.class, message.getKey());
searchResourceContext.setBusinessControlFor(ores);
Document document = InfoMessageDocument.createDocument(searchResourceContext, message);
indexWriter.addDocument(document);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class GroupPortfolioIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexerWriter) throws IOException, InterruptedException {
if (!portfolioModule.isEnabled())
return;
if (!(businessObj instanceof BusinessGroup))
throw new AssertException("businessObj must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObj;
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(businessGroup);
Property mapKeyProperty = npm.findProperty(null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_PORTFOLIO);
// Check if portfolio map property exist
if (mapKeyProperty != null) {
Long mapKey = mapKeyProperty.getLongValue();
String version = mapKeyProperty.getStringValue();
if (version == null || !version.equals("2")) {
PortfolioStructure map = frontendManager.loadPortfolioStructureByKey(mapKey);
if (map != null) {
SearchResourceContext resourceContext = new SearchResourceContext(parentResourceContext);
resourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLPORTFOLIO);
resourceContext.setDocumentType(TYPE);
resourceContext.setParentContextType(GroupDocument.TYPE);
resourceContext.setParentContextName(businessGroup.getName());
Document document = PortfolioMapDocument.createDocument(resourceContext, map);
indexerWriter.addDocument(document);
}
}
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class PublicFolderIndexer method doIndex.
/**
* @see org.olat.repository.handlers.RepositoryHandler#supportsDownload()
*/
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object parentObject, OlatFullIndexer indexWriter) {
try {
// get public folder for user
Identity identity = (Identity) parentObject;
OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(FolderConfig.getUserHome(identity.getName()) + "/public", null);
if (!rootContainer.getBasefile().exists())
return;
// build new resource context
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
searchResourceContext.setParentContextName(identity.getName());
searchResourceContext.setBusinessControlFor(BUSINESS_CONTROL_TYPE);
searchResourceContext.setDocumentType(TYPE);
// now index the folder
doIndexVFSContainer(searchResourceContext, rootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
} catch (Exception ex) {
logWarn("Exception while indexing public folder of identity::" + parentObject.toString() + ". Skipping this user, try next one.", ex);
}
if (isLogDebugEnabled())
logDebug("PublicFolder finished for user::" + parentObject.toString());
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class InfoCourseNodeIndexer method doIndexInfos.
private void doIndexInfos(SearchResourceContext parentResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
List<InfoMessage> messages = infoMessageManager.loadInfoMessageByResource(course, courseNode.getIdent(), null, null, null, 0, -1);
for (InfoMessage message : messages) {
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
OLATResourceable ores = OresHelper.createOLATResourceableInstance(InfoMessage.class, message.getKey());
searchResourceContext.setBusinessControlFor(ores);
Document document = InfoMessageDocument.createDocument(searchResourceContext, message);
indexWriter.addDocument(document);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class InfoCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) {
try {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, TYPE);
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(document);
doIndexInfos(courseNodeResourceContext, course, courseNode, indexWriter);
} catch (Exception ex) {
log.error("Exception indexing courseNode=" + courseNode, ex);
} catch (Error err) {
log.error("Error indexing courseNode=" + courseNode, err);
}
}
Aggregations