/** * Index a forum in a group. * * @param parentResourceContext * @param businessGroup * @param indexWriter * @throws IOException */ @Override public void doIndex( final SearchResourceContext parentResourceContext, final Object businessObj, final OlatFullIndexer indexWriter) throws IOException, InterruptedException { if (!(businessObj instanceof BusinessGroup)) { throw new AssertException("businessObj must be BusinessGroup"); } final BusinessGroup businessGroup = (BusinessGroup) businessObj; final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(businessGroup); final ForumManager fom = ForumManager.getInstance(); final Property forumKeyProperty = npm.findProperty( null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_FORUM); // Check if forum-property exist if (forumKeyProperty != null) { final Long forumKey = forumKeyProperty.getLongValue(); final Forum forum = fom.loadForum(forumKey); final SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext); forumSearchResourceContext.setBusinessControlFor( BusinessGroupMainRunController.ORES_TOOLFORUM); forumSearchResourceContext.setDocumentType(TYPE); forumSearchResourceContext.setDocumentContext(businessGroup.getKey() + " " + forumKey); forumSearchResourceContext.setParentContextType(GroupDocument.TYPE); forumSearchResourceContext.setParentContextName(businessGroup.getName()); doIndexAllMessages(forumSearchResourceContext, forum, indexWriter); } }
/** * Index a forum in a group. * * @param parentResourceContext * @param businessGroup * @param indexWriter * @throws IOException */ 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; NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(businessGroup); ForumManager fom = ForumManager.getInstance(); Property forumKeyProperty = npm.findProperty( null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_FORUM); // Check if forum-property exist if (forumKeyProperty != null) { Long forumKey = forumKeyProperty.getLongValue(); Forum forum = fom.loadForum(forumKey); SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext); forumSearchResourceContext.setBusinessControlFor( BusinessGroupMainRunController.ORES_TOOLFORUM); forumSearchResourceContext.setDocumentType(TYPE); forumSearchResourceContext.setParentContextType(GroupDocument.TYPE); forumSearchResourceContext.setParentContextName(businessGroup.getName()); if (forum == null) { // fxdiff: FXOLAT-104 warn about missing forums logError( "found a forum-key " + forumKey + " for businessgroup " + businessGroup.getName() + " [" + businessGroup.getKey() + "] to index a forum that could not be " + "found by key! skip indexing, check if forum should still be enabled. context: " + forumSearchResourceContext.getResourceUrl(), null); return; } doIndexAllMessages(forumSearchResourceContext, forum, indexWriter); } }