Package org.olat.properties

Examples of org.olat.properties.Property


  public void saveNodeComment(final CourseNode courseNode, final Identity identity, final Identity assessedIdentity, final String comment) {
    ICourse course = CourseFactory.loadCourse(ores);
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    CoordinatorManager.getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerExecutor(){
      public void execute() {
        Property commentProperty = cpm.findCourseNodeProperty(courseNode, assessedIdentity, null, COMMENT);
        if (commentProperty == null) {
          commentProperty = cpm.createCourseNodePropertyInstance(courseNode, assessedIdentity, null, COMMENT, null, null, null, comment);
          cpm.saveProperty(commentProperty);
        } else {
          commentProperty.setTextValue(comment);
          cpm.updateProperty(commentProperty);
        }
        // add to cache
        putPropertyIntoCache(assessedIdentity, commentProperty);
      }
View Full Code Here


  public void saveNodeCoachComment(final CourseNode courseNode, final Identity assessedIdentity, final String comment) {
    ICourse course = CourseFactory.loadCourse(ores);
    final CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    CoordinatorManager.getCoordinator().getSyncer().doInSync(createOLATResourceableForLocking(assessedIdentity), new SyncerExecutor(){
      public void execute() {
        Property commentProperty = cpm.findCourseNodeProperty(courseNode, assessedIdentity, null, COACH_COMMENT);
        if (commentProperty == null) {
          commentProperty = cpm.createCourseNodePropertyInstance(courseNode, assessedIdentity, null, COACH_COMMENT, null, null, null, comment);
          cpm.saveProperty(commentProperty);
        } else {
          commentProperty.setTextValue(comment);
          cpm.updateProperty(commentProperty);
        }
        // add to cache
        putPropertyIntoCache(assessedIdentity, commentProperty);
      }
View Full Code Here

   * @param cpm
   * @return the resulting new number of node attempts
   */
  private long incrementNodeAttemptsProperty(CourseNode courseNode, Identity identity, CoursePropertyManager cpm) {   
    Long attempts;
    Property attemptsProperty = cpm.findCourseNodeProperty(courseNode, identity, null, ATTEMPTS);
    if (attemptsProperty == null) {
      attempts = new Long(1);
      attemptsProperty = cpm.createCourseNodePropertyInstance(courseNode, identity, null, ATTEMPTS, null, attempts, null, null);
      cpm.saveProperty(attemptsProperty);
    } else {
      attempts = new Long(attemptsProperty.getLongValue().longValue() + 1);
      attemptsProperty.setLongValue(attempts);
      cpm.updateProperty(attemptsProperty);
    }
    // add to cache
    putPropertyIntoCache(identity, attemptsProperty);
   
View Full Code Here

   * @param assessmentID
   * @param coursePropManager
   */
  void saveAssessmentID(CourseNode courseNode, Identity assessedIdentity, Long assessmentID, CoursePropertyManager coursePropManager) {
    if(assessmentID!=null) {
      Property assessmentIDProperty = coursePropManager.findCourseNodeProperty(courseNode, assessedIdentity, null, ASSESSMENT_ID);
      if (assessmentIDProperty == null) {         
        assessmentIDProperty = coursePropManager.createCourseNodePropertyInstance(courseNode, assessedIdentity, null, ASSESSMENT_ID, null, assessmentID, null, null);
        coursePropManager.saveProperty(assessmentIDProperty);
      } else {
        assessmentIDProperty.setLongValue(assessmentID);
        coursePropManager.updateProperty(assessmentIDProperty);
     
      // add to cache
      putPropertyIntoCache(assessedIdentity, assessmentIDProperty);
    }
View Full Code Here

   * @return
   */
  private String getStatusFor(AssessableCourseNode courseNode, AssessedIdentityWrapper wrappedIdentity) {
   
    CoursePropertyManager cpm = wrappedIdentity.getUserCourseEnvironment().getCourseEnvironment().getCoursePropertyManager();
    Property statusProperty;
    Translator trans = Util.createPackageTranslator(StatusForm.class, getLocale());
    statusProperty = cpm.findCourseNodeProperty(courseNode, wrappedIdentity.getIdentity(), null, StatusManager.PROPERTY_KEY_STATUS);
    if (statusProperty == null) {
      String value = trans.translate(StatusForm.PROPERTY_KEY_UNDEFINED);
      return value;
    } else {
      String value = trans.translate(StatusForm.STATUS_LOCALE_PROPERTY_PREFIX + statusProperty.getStringValue());
      return value;
    }
  }
View Full Code Here

    return ((Property)samples.get(0)).getStringValue();
  }

  private void setAssignedTask(Identity identity, String task) {
    CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
    Property p = cpm.createCourseNodePropertyInstance(node, identity, null, PROP_ASSIGNED, null, null, task, null);
    cpm.saveProperty(p);
  }
View Full Code Here

    cpm.saveProperty(p);
  }
 
  private void markTaskAsSampled(String task) {
    CoursePropertyManager cpm = courseEnv.getCoursePropertyManager();
    Property p = cpm.createCourseNodePropertyInstance(node, null, null, PROP_SAMPLED, null, null, task, null);
    cpm.saveProperty(p);
  }
View Full Code Here

  private List compileSampledTasks() {
    List sampledTasks = new ArrayList();
    List samples = courseEnv.getCoursePropertyManager()
      .findCourseNodeProperties(node, null, null, PROP_SAMPLED);
    for (Iterator iter = samples.iterator(); iter.hasNext();) {
      Property sample = (Property) iter.next();
      sampledTasks.add(sample.getStringValue());
    }
    return sampledTasks;
  }
View Full Code Here

 
  /**
   * @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
   */
  public final Object getValueAt(int row, int col) {
    Property p = (Property)objects.get(row);
    switch(col) {
      case 0:
        Identity id = p.getIdentity();
        return ((id != null) (p.getIdentity().getName()): (null));
      case 1:
        return p.getResourceTypeName();
      case 2:
        return p.getResourceTypeId(); // may be null; in this case, the table renders nothing for this cell;
      case 3:
        return p.getCategory();
      case 4:
        return p.getName();
      case 5:
        return p.getFloatValue();
      case 6:
        return p.getStringValue();
      case 7:
        return p.getTextValue();
      case 8:
        return p.getCreationDate().toString();
      case 9:
        return p.getLastModified().toString();
      case 10:
        return p.getLongValue();
      default: return "error";
    }
  }
View Full Code Here

    }
  }

  private void setProperty(String propertyName, int value) {
    List properties = PropertyManager.getInstance().findProperties(null, null, null, PROPERTY_CATEGORY, propertyName);
    Property property = null;
    if (properties.size() == 0) {
      property = PropertyManager.getInstance().createPropertyInstance(null, null, null, PROPERTY_CATEGORY, propertyName, null,  new Long(value), null, null);
    } else {
      property = (Property)properties.get(0);
      property.setLongValue( new Long(value) );
    }
    PropertyManager.getInstance().saveProperty(property);
  }
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.