int counter = 0;
List repositoryList = repositoryManager.genericANDQueryWithRolesRestriction(null,null,null,null,roles, null);
if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("RepositoryIndexer repositoryList.size=" + repositoryList.size(), RepositoryIndexer.class);
// loop over all repository-entries
Iterator iter = repositoryList.iterator();
RepositoryEntry repositoryEntry = null;
while(iter.hasNext()) {
try {
repositoryEntry = (RepositoryEntry)iter.next();
if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("Index repositoryEntry=" + repositoryEntry + " counter=" + counter++ + " with ResourceableId=" + repositoryEntry.getOlatResource().getResourceableId(), RepositoryIndexer.class);
if (!isOnBlacklist(repositoryEntry.getOlatResource().getResourceableId().toString()) ) {
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
searchResourceContext.setBusinessControlFor(repositoryEntry);
Document document = RepositoryEntryDocument.createDocument(searchResourceContext, repositoryEntry);
indexWriter.addDocument(document);
// Pass created-date & modified-date in context to child indexer because the child have no dates
// TODO:chg: Check ob courseNode keine Daten hat
searchResourceContext.setLastModified(repositoryEntry.getLastModified());
searchResourceContext.setCreatedDate(repositoryEntry.getCreationDate());
// go further with resource
Indexer repositoryEntryIndexer = RepositoryEntryIndexerFactory.getInstance().getRepositoryEntryIndexer(repositoryEntry);
if (repositoryEntryIndexer != null) {
repositoryEntryIndexer.doIndex(searchResourceContext, repositoryEntry, indexWriter);
} else {
if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("No RepositoryEntryIndexer for " + repositoryEntry.getOlatResource(),RepositoryIndexer.class); // e.g. RepositoryEntry
}
} else {
Tracing.logWarn("RepositoryEntry is on black-list and excluded from search-index, repositoryEntry=" + repositoryEntry, RepositoryIndexer.class);
}
} catch (Throwable ex) {
// create meaninfull debugging output to find repo entry that is somehow broken
String entryDebug = "NULL";
if (repositoryEntry != null) {
entryDebug = "resId::" + repositoryEntry.getResourceableId() + " resTypeName::" + repositoryEntry.getResourceableTypeName() + " resName::" + repositoryEntry.getResourcename();
}
Tracing.logWarn("Exception=" + ex.getMessage() + " for repo entry " + entryDebug, ex, RepositoryIndexer.class);
}
}
if (Tracing.isDebugEnabled(RepositoryIndexer.class)) Tracing.logDebug("RepositoryIndexer finished. counter=" + counter, RepositoryIndexer.class);