コード例 #1
0
  /**
   * 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);
    }
  }
コード例 #2
0
 /** @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int) */
 @Override
 public final Object getValueAt(final int row, final int col) {
   final Property p = (Property) objects.get(row);
   switch (col) {
     case 0:
       final Identity id = p.getIdentity();
       return ((id != null) ? (p.getIdentity().getName()) : (null));
     case 1:
       return p.getResourceTypeName();
     case 2:
       return p
           .getResourceTypeId(); // may be null; in this case, the table renders nothing for this
       // cell;
     case 3:
       return p.getCategory();
     case 4:
       return p.getName();
     case 5:
       return p.getFloatValue();
     case 6:
       return p.getStringValue();
     case 7:
       return p.getTextValue();
     case 8:
       return p.getCreationDate().toString();
     case 9:
       return p.getLastModified().toString();
     case 10:
       return p.getLongValue();
     default:
       return "error";
   }
 }
コード例 #3
0
  /**
   * 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);
    }
  }