Package org.olat.properties

Examples of org.olat.properties.Property


   */
  public void releasePersistentLock(LockResult le) {
    //synchronisation is solved in the LockManager
    String derivedLockString = ((LockResultImpl)le).getLockEntry().getKey();
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findProperty(null, null, null, CATEGORY_PERSISTENTLOCK, derivedLockString);
    if (p == null) throw new AssertException("could not release lock: no lock in db, " + derivedLockString);
    Identity ident = le.getOwner();
    Long ownerKey = p.getLongValue();
    if (!ownerKey.equals(ident.getKey())) throw new AssertException("user " + ident.getName()
        + " cannot release lock belonging to user with key " + ownerKey + " on resourcestring " + derivedLockString);
    pm.deleteProperty(p);
  }
View Full Code Here


    /*
     * ensure that the infomessage property exists on the system
     */
    PropertyManager pm = PropertyManager.getInstance();
    Property p = pm.findProperty(null, null, null, "_o3_", "InfoMsg");
    if (p == null) {
      p =  pm.createPropertyInstance(null,  null,  null,  "_o3_", "InfoMsg", null, null, null, InfoMessageManager.EMPTY_MESSAGE);
      pm.saveProperty(p);
    }
    /*
 
View Full Code Here

              imPrefs.setVisibleToOthers(true);
              imPrefs.setOnlineTimeVisible(false);
              imPrefs.setAwarenessVisible(false);
              imPrefs.setRosterDefaultStatus(Presence.Mode.available.toString());
              String props = XStreamHelper.toXML(imPrefs);
              Property imProperty = PropertyManager.getInstance().createPropertyInstance(identity, null, null, null, ImPreferences.USER_PROPERTY_KEY, null, null, null, props);
              PropertyManager.getInstance().saveProperty(imProperty);
              imPrefs.dbProperty = imProperty;
            }
            return imPrefs;
          }
View Full Code Here

          public void execute() {
            PropertyManager pm = PropertyManager.getInstance();
            // generate x-stream serialization of this object
            String props = XStreamHelper.toXML(toUpdate);
            Property imProperty = PropertyManager.getInstance().findProperty(identity, null, null, null, ImPreferences.USER_PROPERTY_KEY);
            if (imProperty == null) { throw new AssertException("Try to update Im Prefs for (" + identity.getName() + ") but they do not exist!!"); }
            imProperty.setTextValue(props);
            pm.updateProperty(imProperty);
          }
         
        });
 
View Full Code Here

   *
   * @param identity
   * @return the imPreferences or null if not found
   */
  private ImPreferences findPropertiesFor(Identity identity) {
    Property imProperty = PropertyManager.getInstance().findProperty(identity, null, null, null, ImPreferences.USER_PROPERTY_KEY);
    if (imProperty == null) {
      return null;
    } else {
      ImPreferences imPrefs = (ImPreferences) XStreamHelper.fromXML(imProperty.getTextValue());
      imPrefs.owner = identity; // reset transient value
      imPrefs.dbProperty = imProperty;
      return imPrefs;
    }
  }
View Full Code Here

    BusinessGroup businessGroup = (BusinessGroup)businessObj;
   
    NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(businessGroup);
    ForumManager fom = ForumManager.getInstance();

    Property forumKeyProperty = npm.findProperty(null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_FORUM);
    // Check if forum-property exist
    if (forumKeyProperty != null) {
      Long forumKey = forumKeyProperty.getLongValue();
      Forum forum = fom.loadForum(forumKey);
      SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext);
      forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFORUM);
      forumSearchResourceContext.setDocumentType(TYPE);
      forumSearchResourceContext.setDocumentContext(businessGroup.getKey() + " " + forumKey);
View Full Code Here

  private void doIndexForum(SearchResourceContext parentResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException,InterruptedException  {
    if (log.isDebug()) log.debug("Index Course Forum...");
    ForumManager fom = ForumManager.getInstance();
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();

    Property forumKeyProperty = cpm.findCourseNodeProperty(courseNode, null, null, FOCourseNode.FORUM_KEY);
    // Check if forum-property exist
    if (forumKeyProperty != null) {
      Long forumKey = forumKeyProperty.getLongValue();
      Forum forum = fom.loadForum(forumKey);
//      SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext);
//      forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFORUM); // TODO:chg: Must be an other Class e.g. CourseRunMainController
      parentResourceContext.setDocumentType(TYPE);
      parentResourceContext.setDocumentContext(course.getResourceableId() + " " + courseNode.getIdent() + " " + forumKey);
View Full Code Here

      efficiencyStatement.setDisplayableUserInfo(user.getProperty(UserConstants.FIRSTNAME, null) + " " + user.getProperty(UserConstants.LASTNAME, null) + " (" + identity.getName() + ")");
      efficiencyStatement.setLastUpdated(System.currentTimeMillis());
         
      // save efficiency statement as xtream persisted list
      final String efficiencyStatementX = XStreamHelper.toXML(efficiencyStatement);           
      Property efficiencyProperty = null;
      if (checkForExistingProperty) {
        efficiencyProperty = pm.findUserProperty(identity, PROPERTY_CATEGORY, courseRepoEntryKey);
      }
      if (assessmentNodes != null) {       
        if (efficiencyProperty == null) {
          // create new
          efficiencyProperty = pm.createUserPropertyInstance(identity, PROPERTY_CATEGORY, courseRepoEntryKey, null, null, null,  efficiencyStatementX);
          pm.saveProperty(efficiencyProperty);
          if (logDebug) log.debug("creating new efficiency statement property::" + efficiencyProperty.getKey() + " for id::"
                  + identity.getName() + " repoEntry::" + courseRepoEntryKey);
        } else {
          // update existing
          if (logDebug) log.debug("updatting efficiency statement property::" + efficiencyProperty.getKey() + " for id::"
                  + identity.getName() + " repoEntry::" + courseRepoEntryKey);
          efficiencyProperty.setTextValue(efficiencyStatementX);
          pm.updateProperty(efficiencyProperty);
        }
      } else {
        if (efficiencyProperty != null) {
          // remove existing since now empty empty efficiency statements
          if (logDebug) log.debug("removing efficiency statement property::" + efficiencyProperty.getKey() + " for id::"
                  + identity.getName() + " repoEntry::" + courseRepoEntryKey + " since empty");
          pm.deleteProperty(efficiencyProperty);
        }
        // else nothing to create and nothing to delete
      }         
View Full Code Here

   * @return Map containing a list of maps that contain the nodeData for this user and course using the
   * keys defined in the AssessmentHelper and the title of the course
   */
  public EfficiencyStatement getUserEfficiencyStatement(Long courseRepoEntryKey, Identity identity){
    PropertyManager pm = PropertyManager.getInstance();
    Property efficiencyProperty;

    efficiencyProperty = pm.findUserProperty(identity,PROPERTY_CATEGORY, getPropertyName(courseRepoEntryKey));
    if (efficiencyProperty == null) {
      return null;
    } else {
      return (EfficiencyStatement) XStreamHelper.fromXML(efficiencyProperty.getTextValue());
    }
  }
View Full Code Here

    PropertyManager pm = PropertyManager.getInstance();
    List<Property> esProperties = pm.listProperties(identity, null, null, PROPERTY_CATEGORY, null);
    List<EfficiencyStatement> efficiencyStatements = new ArrayList<EfficiencyStatement>();
    Iterator<Property> iter = esProperties.iterator();
    while (iter.hasNext()) {
      Property efficiencyProperty = iter.next();
      EfficiencyStatement efficiencyStatement = (EfficiencyStatement) XStreamHelper.fromXML(efficiencyProperty.getTextValue());
      efficiencyStatements.add(efficiencyStatement);
    }
    return efficiencyStatements;
  }
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.