Package org.olat.properties

Examples of org.olat.properties.PropertyManager.findProperty()


  /**
   * @see org.olat.user.UserManager#setUserCharset(org.olat.core.id.Identity, java.lang.String)
   */
  public void setUserCharset(Identity identity, String charset){
      PropertyManager pm = PropertyManager.getInstance();
      Property p = pm.findProperty(identity, null, null, null, CHARSET);
     
      if(p != null){
          p.setStringValue(charset);
          pm.updateProperty(p);
    } else {
View Full Code Here


   */
  public String getUserCharset(Identity identity){
     String charset;
     charset = WebappHelper.getDefaultCharset();
     PropertyManager pm = PropertyManager.getInstance();
     Property p = pm.findProperty(identity, null, null, null, CHARSET);
     if(p != null){
         charset = p.getStringValue();
      // if after migration the system does not support the charset choosen by a
      // user
         // (a rather rare case)
View Full Code Here

* setting mechanism, see method below
* @param tokenPropertyName
*/
  private void initializeSystemTokenProperty(String tokenPropertyName) {
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findProperty(null, null, null, SYSTEM_PROPERTY_CATEGORY, tokenPropertyName);
    if (p == null) {
      String token = RandomStringUtils.randomAlphanumeric(8);
      p = pm.createPropertyInstance(null, null, null, SYSTEM_PROPERTY_CATEGORY, tokenPropertyName, null, null, token, null);
      pm.saveProperty(p);
    }
View Full Code Here

      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);
View Full Code Here

    }
    // check if p1&p2 is rollbacked
    PropertyManager pm = PropertyManager.getInstance();
    Property p_1 =pm.findProperty(null, null, null, null, propertyKey1);
    this.assertNull("Property1 is NOT rollbacked", p_1);
    Property p_2 =pm.findProperty(null, null, null, null, propertyKey2);
    this.assertNull("Property2 is NOT rollbacked", p_2);
  }

  public void testRollbackNonTransactional() {
    DB db = DBFactory.getInstance();
View Full Code Here

    } catch (Exception ex) {
      db.closeSession();
    }
    // check if p1 & p2 is NOT rollbacked
    PropertyManager pm = PropertyManager.getInstance();
    Property p_1 =pm.findProperty(null, null, null, null, propertyKey1);
    this.assertNull("Property1 is NOT rollbacked", p_1);
    Property p_2 =pm.findProperty(null, null, null, null, propertyKey2);
    this.assertNull("Property2 is NOT rollbacked", p_2);
  }
View Full Code Here

    }
    // check if p1 & p2 is NOT rollbacked
    PropertyManager pm = PropertyManager.getInstance();
    Property p_1 =pm.findProperty(null, null, null, null, propertyKey1);
    this.assertNull("Property1 is NOT rollbacked", p_1);
    Property p_2 =pm.findProperty(null, null, null, null, propertyKey2);
    this.assertNull("Property2 is NOT rollbacked", p_2);
  }

 
  /**
 
View Full Code Here

    Property p = pm.createPropertyInstance(null, null, null, null, "superbluberkey", null, null, unicodetest, null);
    pm.saveProperty(p);
    // forget session cache etc.
    db.closeSession();
   
    Property p2 = pm.findProperty(null, null, null, null, "superbluberkey");
    String lStr = p2.getStringValue();
    assertEquals(unicodetest, lStr);
   
  }
View Full Code Here

        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++;
        }
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());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.