Package org.olat.properties

Examples of org.olat.properties.Property


      Tracing.logAudit("Trying to set maintenance message without using a token. Remote address::" + request.getRemoteAddr(), AdminModule.class);
      return false;
    }
    // get token and compate
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findProperty(null, null, null, AdminModule.SYSTEM_PROPERTY_CATEGORY, tokenPropertyName);
    String token = (p == null ? "" : p.getStringValue());
    if (token.matches(submittedToken)) { // limit access to token
      return true;
    } else {
      Tracing.logAudit("Trying to set maintenance message using a wrong token. Remote address::" + request.getRemoteAddr(), AdminModule.class);
      return false;
View Full Code Here


   * Internal helper: save node configuration
   * @param cpm
   * @param checklistKey
   */
  private void setChecklistKey(final CoursePropertyManager cpm, Long checklistKey) {
    Property checklistKeyProperty = cpm.createCourseNodePropertyInstance(this, null, null, PROPERTY_CHECKLIST_KEY, null, checklistKey, null, null);
    cpm.saveProperty(checklistKeyProperty);
    /*
     * Save reference to checklist additionally in module configuration since the CoursePropertyManager is not always available.
     */
    getModuleConfiguration().set(CONF_CHECKLIST, ChecklistManager.getInstance().loadChecklist(checklistKey));
View Full Code Here

   * Internal helper: load node configuration
   * @param cpm
   * @return checklistKey
   */
  private Long getChecklistKey(final CoursePropertyManager cpm) {
    Property checklistKeyProperty = cpm.findCourseNodeProperty(this, null, null, PROPERTY_CHECKLIST_KEY);
   
    return checklistKeyProperty != null ? checklistKeyProperty.getLongValue() : null;
  }
View Full Code Here

    // if (node == null) return new Double(Double.NEGATIVE_INFINITY);

    CoursePropertyManager pm = getUserCourseEnv().getCourseEnvironment().getCoursePropertyManager();
    Identity identity = getUserCourseEnv().getIdentityEnvironment().getIdentity();

    Property firstTime = pm.findCourseNodeProperty(node, identity, null, ENCourseNode.PROPERTY_INITIAL_ENROLLMENT_DATE);

    if (firstTime != null) {
      String firstTimeMillis = firstTime.getStringValue();
      return Double.valueOf(firstTimeMillis);
    } else {
      // what to do in case of no date available??? -> return date in the future
      return new Double(Double.POSITIVE_INFINITY);
    }
View Full Code Here

   * @param defaultValue value that is used when no value exists so far
   * @return String value of this property or default value when no value exists
   */
  public String findOrCreateProperty(Class clazz, String propertyName, String defaultValue) {
    PropertyManager pm = PropertyManager.getInstance();
    Property property = pm.findProperty(null, null, null, PROPERTY_CATEGORY, createPropertyName(clazz, propertyName));
    if (property == null) {
      property = pm.createPropertyInstance(null, null, null, PROPERTY_CATEGORY, createPropertyName(clazz, propertyName), null, null, defaultValue, null);
      pm.saveProperty(property);
    }
    return property.getStringValue();
  }
View Full Code Here

   * @param propertyName Name of the property
   * @param updateValue value that is used when no value exists so far
   */
  public void setProperty(Class clazz, String propertyName, String updateValue) {
    PropertyManager pm = PropertyManager.getInstance();
    Property property = pm.findProperty(null, null, null, PROPERTY_CATEGORY, createPropertyName(clazz, propertyName));
    if (property == null) {
      property = pm.createPropertyInstance(null, null, null, PROPERTY_CATEGORY, createPropertyName(clazz, propertyName), null, null, updateValue, null);
      pm.saveProperty(property);
    } else {
      property.setStringValue(updateValue);
      pm.updateProperty(property);
    }
  }
View Full Code Here

  }

  private void addQTIEditorSessionLock(FileResource fr, Identity user){
    PropertyManager pm = PropertyManager.getInstance();
    String derivedLockString = OresHelper.createStringRepresenting(fr);
    Property newp = pm.createPropertyInstance(null, null, null, "o_lock", derivedLockString, null, user.getKey(), null, null);
    pm.saveProperty(newp);
  }
View Full Code Here

      while (loopCounter++ < numberOfLoops ) {
        String propertyKey = "DbWorkerKey-" + workerId + "-" + loopCounter;
        DB db = DBFactory.getInstance();
        PropertyManager pm = PropertyManager.getInstance();
        String testValue = "DbWorkerValue-" + workerId + "-" + loopCounter;
        Property p = pm.createPropertyInstance(null, null, null, null, propertyKey, null, null, testValue, null);
        pm.saveProperty(p);
        // forget session cache etc.
        db.closeSession();
       
        db = DBFactory.getInstance();
        Property p2 = pm.findProperty(null, null, null, null, propertyKey);
        String lStr = p2.getStringValue();
        if (!testValue.equals(lStr)) {
          Tracing.logInfo("Property ERROR testValue=" + testValue + ": lStr=" + lStr, this.getClass());
          errorCounter++;
        }
        db.closeSession();
View Full Code Here

      return null;
    }
    RepositoryEntry re = CourseFactory.deployCourseFromZIP(exportedCourseZIPFile, access)
    if (re != null) {
      PropertyManager pm = PropertyManager.getInstance();
      Property prop = pm.createPropertyInstance(null, null, null, "_o3_", "deployedCourses", null, re.getKey(), absOrRelPath, null);
      pm.saveProperty(prop);
    }
    return re;
  }
View Full Code Here

  }

  private String listAllProperties() {
    StringBuilder buf = new StringBuilder();
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.findProperty(null, null, null, propertyCategory, propertyKey1);
    if (p1 == null) {
      buf.append(propertyKey1 + "=null");
    } else {
      buf.append(propertyKey1 + "=" + p1.getStringValue());
    }
    buf.append("<br />");
    Property p2 = pm.findProperty(null, null, null, propertyCategory, propertyKey2);
    if (p2 == null) {
      buf.append(propertyKey2 + "=null");
    } else {
      buf.append(propertyKey2 + "=" + p2.getStringValue() );
    }
    buf.append("<br />");
    return buf.toString();
  }
View Full Code Here

TOP

Related Classes of org.olat.properties.Property

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.