Package org.olat.properties

Examples of org.olat.properties.PropertyManager


    }
  }
 
  private static void destroyIcalAuthToken(Identity identity) {
    // find the property for the identity
    PropertyManager pm = PropertyManager.getInstance();
    Property tokenProperty = pm.findProperty(identity, null, null,
        PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
   
    // return the string value of the property
    pm.deleteProperty(tokenProperty);
  }
View Full Code Here


      // find the property for the resourceable
      OLATResourceable resourceable = getResourceable(calendarType, calendarID);
      NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(resourceable);
      tokenProperty = npm.findProperty(identity, null, PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
    } else {
      PropertyManager pm = PropertyManager.getInstance();
      tokenProperty = pm.findProperty(identity, null, null, PROP_CAT_ICALTOKEN, PROP_NAME_ICALTOKEN);
    }
    return tokenProperty != null;
   }
View Full Code Here

      throw new IllegalArgumentException("version must be > 1");
    }
    if (startingTimeMillis<0) {
      throw new IllegalArgumentException("startingTimeMillis must be >= 0");
    }
    PropertyManager pm = PropertyManager.getInstance();
    List properties = pm.findProperties(null, null, null, LOGGING_PROPERTIES_CATEGORY, LOGGING_VERSION_PROPERTY_NAME);
    if (properties!=null && properties.size()>0) {
      // when there are already versions defined, lets see if the one which should be set now is already defined
      for (Iterator it = properties.iterator(); it.hasNext();) {
        Property property = (Property) it.next();
        if (property.getStringValue().equals(String.valueOf(version))) {
          // yes, the version is already set... overwrite this property then
          log_.info("setLoggingVersion: overwriting existing version property for version="+version+" from starttime "+property.getLongValue()+" to "+startingTimeMillis);
          property.setLongValue(startingTimeMillis);
          pm.saveProperty(property);
          return;
        }
      }
    }
   
    log_.info("setLoggingVersion: setting version property for version="+version+" to "+startingTimeMillis);
    Property newp = pm.createPropertyInstance(null, null, null, LOGGING_PROPERTIES_CATEGORY, LOGGING_VERSION_PROPERTY_NAME, null, startingTimeMillis, String.valueOf(version), null);
    pm.saveProperty(newp);
   
  }
View Full Code Here

   
  }
 
  @Override
  public long getStartingTimeForVersion(int version) {
    PropertyManager pm = PropertyManager.getInstance();
    List properties = pm.findProperties(null, null, null, LOGGING_PROPERTIES_CATEGORY, LOGGING_VERSION_PROPERTY_NAME);
    if (properties!=null && properties.size()>0) {
      // when there are already versions defined, lets see if the one which should be set now is already defined
      for (Iterator it = properties.iterator(); it.hasNext();) {
        Property property = (Property) it.next();
        if (property.getStringValue().equals(String.valueOf(version))) {
View Full Code Here

   
  }

  @Override
  public long getLastUpdated() {
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findProperty(null, null, null, STATISTICS_PROPERTIES_CATEGORY, LAST_UPDATED_PROPERTY_NAME);
    if (p==null) {
      return -1;
    } else {
      return p.getLongValue();
    }
View Full Code Here

    }
  }
 
  @Override
  public long getAndUpdateLastUpdated(long lastUpdated) {
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findProperty(null, null, null, STATISTICS_PROPERTIES_CATEGORY, LAST_UPDATED_PROPERTY_NAME);
    if (p==null) {
      Property newp = pm.createPropertyInstance(null, null, null, STATISTICS_PROPERTIES_CATEGORY, LAST_UPDATED_PROPERTY_NAME, null, lastUpdated, null, null);
      pm.saveProperty(newp);
      return -1;
    } else {
      final long result = p.getLongValue();
      p.setLongValue(lastUpdated);
      pm.saveProperty(p);
      return result;
    }
  }
View Full Code Here

   * @param propertyName Name of the property
   * @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 clazz class for thich this configuration is stored
   * @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

    }
    log.info("migrateAllDialogElementsProperty: replace #" + counter + " deleted user-names, call setAuthor #" + counterSetAuthor + " for existing user-names  in #" + counterDialogElement + " DialogElements");
  }
 
  private List findAllProperty() {
    PropertyManager propMrg = PropertyManager.getInstance();
    List elements = propMrg.listProperties(null, null, "CourseModule", null, null, DialogElementsPropertyManager.PROPERTY_NAME);
    return elements;
  }
View Full Code Here

   * calling needsToConfirmDisclaimer() first!
   *
   * @param identity
   */
  public void setHasConfirmedDislaimer(Identity identity) {   
    PropertyManager propertyMgr = PropertyManager.getInstance();
    Property disclaimerProperty = propertyMgr.createUserPropertyInstance(identity, "user", "dislaimer_accepted", null, 1l, null, null);
    propertyMgr.saveProperty(disclaimerProperty);
  }
View Full Code Here

TOP

Related Classes of org.olat.properties.PropertyManager

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.