Package org.olat.properties

Examples of org.olat.properties.PropertyManager


      return; // nice, cache saved a needless update
    }
   
    // handle Boolean Values via String Field in Property DB Table
    final String toolValueStr = toolValue ? TRUE : FALSE;
    final PropertyManager pm = PropertyManager.getInstance();
    //
    CoordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerExecutor() {
      public void execute() {       
        //was: synchronized (CollaborationTools.class) {
        Property property = getPropertyOf(selectedTool);
        if (property == null) {
          // not existing -> create it
          property = pm.createPropertyInstance(null, null, ores, PROP_CAT_BG_COLLABTOOLS, selectedTool, null, null, toolValueStr, null);
        } else {
          // if existing -> update to desired value
          property.setStringValue(toolValueStr);
        }
        // property becomes persistent
        pm.saveProperty(property);
      }});
    this.dirty = true;
    cacheToolStates.put(selectedTool, Boolean.valueOf(toolValue));
  }
View Full Code Here


  /**
   * Remove all disclaimer confirmations. This means that every user on the
   * system must accept the disclaimer again.
   */
  public void revokeAllconfirmedDisclaimers() {
    PropertyManager propertyMgr = PropertyManager.getInstance();
    propertyMgr.deleteProperties(null, null, null, "user", "dislaimer_accepted");   
  }
View Full Code Here

    this.dirty = true;
    cacheToolStates.put(selectedTool, Boolean.valueOf(toolValue));
  }

  Property getPropertyOf(String selectedTool) {
    PropertyManager pm = PropertyManager.getInstance();
    Property property = pm.findProperty(null, null, ores, PROP_CAT_BG_COLLABTOOLS, selectedTool);
    Boolean res;
    if (property == null) { // meaning false
      res = Boolean.FALSE;
    } else {
      String val = property.getStringValue();
View Full Code Here

   * that this user must accept the disclaimer again.
   *
   * @param identity
   */
  public void revokeConfirmedDisclaimer(Identity identity) {
    PropertyManager propertyMgr = PropertyManager.getInstance();
    propertyMgr.deleteProperties(identity, null, null, "user", "dislaimer_accepted");   
  }
View Full Code Here

  }
 
 
  public void save() {
    if (!isTransient) {
      PropertyManager pm = PropertyManager.getInstance();
      // generate x-stream serialization of this object
      String props = XStreamHelper.toXML(this);
      if (this.dbProperty == null) {
        // save as new property
        this.dbProperty = pm.createPropertyInstance(owner, null, null, null, DbStorage.USER_PROPERTY_KEY, null, null, null, props);
        pm.saveProperty(this.dbProperty);
      } else {
        // update exising property
        this.dbProperty.setTextValue(props);
        pm.updateProperty(this.dbProperty);
      }
    }
  }
View Full Code Here

    File oldCalendarFile = calManager.getCalendarFile(importedCalendarType, tempCalendarID);
    oldCalendarFile.renameTo(calManager.getCalendarFile(importedCalendarType, importedCalendarID));
   
    // make the entry in the database
    long timestamp = System.currentTimeMillis();
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.createUserPropertyInstance(ureq.getIdentity(), PROP_CATEGORY, sanitize(calendarName), null, timestamp, importUrl, null);
    pm.saveProperty(p);
  }
View Full Code Here

   * @return
   */
  public static void deleteCalendar(String calendarID, UserRequest ureq) {
    String calendarName = getImportedCalendarNameFromID(ureq.getIdentity(), calendarID);
    // remove the entry from the database
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findUserProperty(ureq.getIdentity(), PROP_CATEGORY, calendarName);
    pm.deleteProperty(p);

    // delete the calendar file
    CalendarManager calManager = CalendarManagerFactory.getInstance().getCalendarManager();
    String importedCalendarID = getImportedCalendarID(ureq, calendarName);
    String importedCalendarType = getImportedCalendarType();
View Full Code Here

  public static List getImportedCalendarsForIdentity(UserRequest ureq) {
    // initialize the calendars list
    List calendars = new ArrayList();
   
    // read all the entries from the database
    PropertyManager pm = PropertyManager.getInstance();
    List properties = pm.listProperties(ureq.getIdentity(), null, null, PROP_CATEGORY, null);
   
    // return the list of calendar objects
    Iterator propertyIter = properties.iterator();
    CalendarManager calManager = CalendarManagerFactory.getInstance().getCalendarManager();
    while (propertyIter.hasNext()) {
View Full Code Here

  private void migrateGroupNews(UpgradeManager upgradeManager, UpgradeHistoryData uhd) {
    if (!uhd.getBooleanDataValue(TASK_MIGRATE_WIKICODE_GROUPNEWS)) {
      log.audit("+---------------------------------------------------------------+");
      log.audit("+...     " + TASK_MIGRATE_WIKICODE_GROUPNEWS + "     ...+");
      log.audit("+---------------------------------------------------------------+");
      PropertyManager pm = PropertyManager.getInstance();
     
      // hardcoded query since manager does not provide appropriate method
      StringBuilder query = new StringBuilder();
      query.append("from v in class org.olat.properties.Property where ");
      query.append("v.category = '").append(CollaborationTools.PROP_CAT_BG_COLLABTOOLS).append("'");
      query.append(" and ");
      query.append("v.name = 'news'");     
      List<Property> props = DBFactory.getInstance().find(query.toString());
      if (log.isDebug()) log.info("Found " + props.size() + " groupnews to migrate.");
     
      int counter = 0;
      for (Property property : props) {
        try{
          String oldVal = property.getTextValue();
          String newVal = migrateStringSavely(oldVal);
          property.setTextValue(newVal);
          pm.updateProperty(property);
          counter++;
          DBFactory.getInstance().intermediateCommit();
        } catch (Exception e) {
          log.error("Error during Migration: "+e, e);
          DBFactory.getInstance().rollback();
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.