Package org.olat.properties

Examples of org.olat.properties.Property


    }
  }

  private void doTestNonTransactional() {
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey1, null, null, "doTestNonTransactional_1", null);
    pm.saveProperty(p1);
    // name is null => generated DB error => rollback
    Property p2 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey2, null, null, "doTestNonTransactional_2", null);
    pm.saveProperty(p2);
    getWindowControl().setInfo("Properties<br />TestTransactionalKey-1=doTestNonTransactional_1,<br />TestTransactionalKey-2=doTestNonTransactional_2 created");
  }
View Full Code Here


  }

  private void doTestTransactional() {
    DB db = DBFactory.getInstance();
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey1, null, null, "doTestTransactional_1", null);
    pm.saveProperty(p1);
    Property p2 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey2, null, null, "doTestTransactional_2", null);
    pm.saveProperty(p2);
    getWindowControl().setInfo("Properties<br />TestTransactionalKey-1=doTestTransactional_1,<br />TestTransactionalKey-2=doTestTransactional_2 created");
  }
View Full Code Here

  }

  private void doTestMixTransactional() {
    DB db = DBFactory.getInstance();
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey1, null, null, "doTestMixTransactional_1", null);
    pm.saveProperty(p1);
    Property p2 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey2, null, null, "doTestMixTransactional_2", null);
    pm.saveProperty(p2);
    getWindowControl().setInfo("Properties<br />TestTransactionalKey-1=doTestTransactional_1,<br />TestTransactionalKey-2=doTestTransactional_2 created");
  }
View Full Code Here

    getWindowControl().setInfo("Properties<br />TestTransactionalKey-1=doTestTransactional_1,<br />TestTransactionalKey-2=doTestTransactional_2 created");
  }

  private void doTestNonTransactionalError() {
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey1, null, null, "doTestNonTransactionalError_1", null);
    pm.saveProperty(p1);
    // name is null => generated DB error => no rollback of p1
    Property p2 = pm.createPropertyInstance(null, null, null, propertyCategory, null, null, null, "doTestNonTransactionalError_2", null);
    pm.saveProperty(p2);
    getWindowControl().setError("Should generate error for rollback!");
    Tracing.logError("Should generate error and not reach this code",getClass());
  }
View Full Code Here

  }

  private void doTestTransactionalError() {
    DB db = DBFactory.getInstance();
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey1, null, null, "doTestTransactionalError_1", null);
    pm.saveProperty(p1);
    // name is null => generated DB error => rollback
    Property p2 = pm.createPropertyInstance(null, null, null, propertyCategory, null, null, null, "doTestTransactionalError_2", null);
    pm.saveProperty(p2);
    getWindowControl().setError("Should generate error for rollback!");
    Tracing.logError("Should generate error for rollback and not reach this code",getClass());
  }
View Full Code Here

  }
 
  private void doTestMixTransactionalError() {
    DB db = DBFactory.getInstance();
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.createPropertyInstance(null, null, null, propertyCategory, propertyKey1, null, null, "doTestMixTransactional_1", null);
    pm.saveProperty(p1);
    // name is null => generated DB error => rollback
    Property p2 = pm.createPropertyInstance(null, null, null, propertyCategory, null, null, null, "doTestMixTransactional_2", null);
    pm.saveProperty(p2);
    getWindowControl().setError("Should generate error for rollback!");
    Tracing.logError("Should generate error for rollback and not reach this code",getClass());
  }
View Full Code Here

   * @param userCourseEnv
   * @param courseNode
   * @return an empty DialogPropertyElements if noting found or the populated object
   */
  public DialogPropertyElements findDialogElements(CoursePropertyManager coursePropMgr, CourseNode courseNode) {
    Property property = coursePropMgr.findCourseNodeProperty(courseNode, null, null, PROPERTY_NAME);
    if (property == null) return new DialogPropertyElements(PROPERTY_NAME);
    else return (DialogPropertyElements) XStreamHelper.fromXML(property.getTextValue());
  }
View Full Code Here

   * @param courseId
   * @param courseNodeId
   * @return a Object containing a collection of DialogElements
   */
  public DialogPropertyElements findDialogElements(Long courseId, String courseNodeId) {
    Property prop = findProperty(courseId, courseNodeId);
    if (prop == null) return new DialogPropertyElements(PROPERTY_NAME);
    return (DialogPropertyElements) XStreamHelper.fromXML(prop.getTextValue());
  }
View Full Code Here

          OLATResourceable courseNodeResourceable = OresHelper.createOLATResourceableInstance(DialogCourseNode.class, new Long(courseNode.getIdent()));
          CoordinatorManager.getCoordinator().getSyncer().doInSync(courseNodeResourceable, new SyncerExecutor(){
            public void execute() {
            list.remove(element);
            String dialogElementsAsXML = XStreamHelper.toXML(elements);
            Property property = coursePropMgr.findCourseNodeProperty(courseNode, null, null, PROPERTY_NAME);

            property.setTextValue(dialogElementsAsXML);
            coursePropMgr.updateProperty(property);           
            }})
          break;
        }         
      }     
View Full Code Here

      public void execute() {
        DialogPropertyElements dialogProps = findDialogElements(coursePropMgr, courseNode);

        dialogProps.addElement(element);
        String dialogElementsAsXML = XStreamHelper.toXML(dialogProps);
        Property property = coursePropMgr.findCourseNodeProperty(courseNode, null, null, PROPERTY_NAME);
        if (property == null) {
          property = coursePropMgr.createCourseNodePropertyInstance(courseNode, null, null, PROPERTY_NAME, null, null, null,
              dialogElementsAsXML);
          coursePropMgr.saveProperty(property);
        } else {
          property.setTextValue(dialogElementsAsXML);
          coursePropMgr.updateProperty(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.