Package org.olat.modules

Examples of org.olat.modules.ModuleConfiguration


  /**
   * @see org.olat.course.nodes.AssessableCourseNode#hasPassedConfigured()
   */
  public boolean hasPassedConfigured() {
    ModuleConfiguration config = getModuleConfiguration();
    Boolean passed = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_PASSED_FIELD);
    if (passed == null) return false;
    return passed.booleanValue();
  }
View Full Code Here


  /**
   * @see org.olat.course.nodes.AssessableCourseNode#hasScoreConfigured()
   */
  public boolean hasScoreConfigured() {
    ModuleConfiguration config = getModuleConfiguration();
    Boolean score = (Boolean) config.get(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD);
    if (score == null) return false;
    return score.booleanValue();
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.AssessableCourseNode#getMaxScoreConfiguration()
   */
  public Float getMaxScoreConfiguration() {
    if (!hasScoreConfigured()) { throw new OLATRuntimeException(TACourseNode.class, "getMaxScore not defined when hasScore set to false", null); }
    ModuleConfiguration config = getModuleConfiguration();
    Float max = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
    return max;
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.AssessableCourseNode#getMinScoreConfiguration()
   */
  public Float getMinScoreConfiguration() {
    if (!hasScoreConfigured()) { throw new OLATRuntimeException(TACourseNode.class, "getMinScore not defined when hasScore set to false", null); }
    ModuleConfiguration config = getModuleConfiguration();
    Float min = (Float) config.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
    return min;
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.AssessableCourseNode#getCutValueConfiguration()
   */
  public Float getCutValueConfiguration() {
    if (!hasPassedConfigured()) { throw new OLATRuntimeException(TACourseNode.class, "getCutValue not defined when hasPassed set to false", null); }
    ModuleConfiguration config = getModuleConfiguration();
    Float cut = (Float) config.get(MSCourseNode.CONFIG_KEY_PASSED_CUT_VALUE);
    return cut;
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.AssessableCourseNode#hasDetails()
   */
  public boolean hasDetails() {
    ModuleConfiguration modConfig = getModuleConfiguration();
    Boolean hasTask = (Boolean) modConfig.get(TACourseNode.CONF_TASK_ENABLED);
    if (hasTask == null) hasTask = Boolean.FALSE;
    Boolean hasDropbox = (Boolean) modConfig.get(TACourseNode.CONF_DROPBOX_ENABLED);
    if (hasDropbox == null) hasDropbox = Boolean.FALSE;   
    Boolean hasReturnbox = (Boolean) modConfig.get(TACourseNode.CONF_RETURNBOX_ENABLED);
    if (hasReturnbox == null) hasReturnbox = hasDropbox;
   
    return (hasTask.booleanValue() || hasDropbox.booleanValue() || hasReturnbox.booleanValue());
  }
View Full Code Here

  /**
   * Init config parameter with default values for a new course node.
   */
  @Override
  public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
      // use defaults for new course building blocks
      // task defaults
      config.set(CONF_TASK_ENABLED, Boolean.TRUE);
      config.set(CONF_TASK_TYPE, TaskController.TYPE_MANUAL);
      config.set(CONF_TASK_TEXT, "");
      config.set(CONF_TASK_SAMPLING_WITH_REPLACEMENT, Boolean.TRUE);
      // dropbox defaults
      config.set(CONF_DROPBOX_ENABLED, Boolean.TRUE);
      config.set(CONF_RETURNBOX_ENABLED, Boolean.TRUE);
      config.set(CONF_DROPBOX_ENABLEMAIL, Boolean.FALSE);
      config.set(CONF_DROPBOX_CONFIRMATION, "");
      // scoring defaults
      config.set(CONF_SCORING_ENABLED, Boolean.TRUE);
      // New config parameter version 2
      config.setBooleanEntry(CONF_TASK_PREVIEW, false);
      // solution defaults
      config.set(CONF_SOLUTION_ENABLED, Boolean.TRUE);
      MSCourseNode.initDefaultConfig(config);
      config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
    } else {
      int version = config.getConfigurationVersion();
      if (version < CURRENT_CONFIG_VERSION) {
        // Loaded config is older than current config version => migrate
        if (version == 1) {
          // migrate V1 => V2
          config.setBooleanEntry(CONF_TASK_PREVIEW, false);
          // solution defaults
          config.set(CONF_SOLUTION_ENABLED, Boolean.FALSE);
          MSCourseNode.initDefaultConfig(config);
          version = 2;
        }
        config.setConfigurationVersion(CURRENT_CONFIG_VERSION);
      }
    }
  }
View Full Code Here

   * @param isNewNode true: an initial configuration is set; false: upgrading
   *          from previous node configuration version, set default to maintain
   *          previous behaviour
   */
  public void updateModuleConfigDefaults(boolean isNewNode) {
    ModuleConfiguration config = getModuleConfiguration();
    if (isNewNode) {
      // use defaults for new course building blocks
      config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.FALSE.booleanValue());
      config.setConfigurationVersion(2);
    } else {
      // clear old popup configuration
      config.remove(NodeEditController.CONFIG_INTEGRATION);
      config.remove("width");
      config.remove("height");
      if (config.getConfigurationVersion() < 2) {
        // update new configuration options using default values for existing nodes
        config.setBooleanEntry(NodeEditController.CONFIG_STARTPAGE, Boolean.TRUE.booleanValue());
        config.setConfigurationVersion(2);
      }
      // else node is up-to-date - nothing to do
    }
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.AssessableCourseNode#hasCommentConfigured()
   */
  public boolean hasCommentConfigured() {
    ModuleConfiguration config = getModuleConfiguration();
    Boolean comment = (Boolean) config.get(CONFIG_KEY_HAS_COMMENT_FIELD);
    if (comment == null) return false;
    return comment.booleanValue();
  }
View Full Code Here

  /**
   * @see org.olat.course.nodes.AssessableCourseNode#hasPassedConfigured()
   */
  public boolean hasPassedConfigured() {
    ModuleConfiguration config = getModuleConfiguration();
    Boolean passed = (Boolean) config.get(CONFIG_KEY_HAS_PASSED_FIELD);
    if (passed == null) return false;
    return passed.booleanValue();
  }
View Full Code Here

TOP

Related Classes of org.olat.modules.ModuleConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.