Example #1
0
  /**
   * Index a forum in a course.
   *
   * @param parentResourceContext
   * @param course
   * @param courseNode
   * @param indexWriter
   * @throws IOException
   */
  private void doIndexForum(
      final SearchResourceContext parentResourceContext,
      final ICourse course,
      final CourseNode courseNode,
      final OlatFullIndexer indexWriter)
      throws IOException, InterruptedException {
    if (log.isDebugEnabled()) {
      log.debug("Index Course Forum...");
    }
    final ForumService fom = getForumService();
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();

    final PropertyImpl forumKeyProperty =
        cpm.findCourseNodeProperty(courseNode, null, null, FOCourseNode.FORUM_KEY);
    // Check if forum-property exist
    if (forumKeyProperty != null) {
      final Long forumKey = forumKeyProperty.getLongValue();
      final Forum forum = fom.loadForum(forumKey);
      // SearchResourceContext forumSearchResourceContext = new
      // SearchResourceContext(parentResourceContext);
      // forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFORUM); // TODO:chg: Must be an other Class e.g.
      // CourseRunMainController
      parentResourceContext.setDocumentType(TYPE);
      parentResourceContext.setDocumentContext(
          course.getResourceableId() + " " + courseNode.getIdent() + " " + forumKey);
      doIndexAllMessages(parentResourceContext, forum, indexWriter);
    }
  }
Example #2
0
  /**
   * Initializes the user profile with the data from the database
   *
   * @param ident The current Subject
   */
  public void loadStatusFormData(
      final StatusForm statusForm,
      final CourseNode node,
      final UserCourseEnvironment userCourseEnv) {
    final Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    final CoursePropertyManager cpm =
        userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    PropertyImpl statusProperty;

    statusProperty = cpm.findCourseNodeProperty(node, identity, null, PROPERTY_KEY_STATUS);
    if (statusProperty == null) {
      // found no status property => init DEFAULT value
      statusForm.setSelectedStatus(STATUS_VALUE_INITIAL);
    } else {
      final String value = statusProperty.getStringValue();
      statusForm.setSelectedStatus(value);
    }
  }
Example #3
0
  public void saveStatusFormData(
      final StatusForm statusForm,
      final CourseNode node,
      final UserCourseEnvironment userCourseEnv) {
    final Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
    final String selectedKey = statusForm.getSelectedStatus();

    final CoursePropertyManager cpm =
        userCourseEnv.getCourseEnvironment().getCoursePropertyManager();
    PropertyImpl statusProperty;

    statusProperty = cpm.findCourseNodeProperty(node, identity, null, PROPERTY_KEY_STATUS);
    if (statusProperty == null) {
      statusProperty =
          cpm.createCourseNodePropertyInstance(
              node, identity, null, PROPERTY_KEY_STATUS, null, null, selectedKey, null);
      cpm.saveProperty(statusProperty);
    } else {
      statusProperty.setStringValue(selectedKey);
      cpm.updateProperty(statusProperty);
    }
  }