Package org.olat.properties

Examples of org.olat.properties.PropertyManager


    putInitialPanel(myContent);
  }

  private String listAllProperties() {
    StringBuilder buf = new StringBuilder();
    PropertyManager pm = PropertyManager.getInstance();
    Property p1 = pm.findProperty(null, null, null, propertyCategory, propertyKey1);
    if (p1 == null) {
      buf.append(propertyKey1 + "=null");
    } else {
      buf.append(propertyKey1 + "=" + p1.getStringValue());
    }
    buf.append("<br />");
    Property p2 = pm.findProperty(null, null, null, propertyCategory, propertyKey2);
    if (p2 == null) {
      buf.append(propertyKey2 + "=null");
    } else {
      buf.append(propertyKey2 + "=" + p2.getStringValue() );
    }
View Full Code Here


      getWindowControl().setInfo(listAllProperties());
    }
  }

  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

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

  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

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

  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

    pm.saveProperty(p2);
    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

    Tracing.logError("Should generate error and not reach this code",getClass());
  }

  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

    Tracing.logError("Should generate error for rollback and not reach this code",getClass());
  }
 
  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

        }    
    }});       
  }

  private Property findProperty(Long courseId, String courseNodeId) {
    PropertyManager propMrg = PropertyManager.getInstance();
    String category = "NID:dial::" + courseNodeId;
    List elements = propMrg.findProperties(null, null, "CourseModule", courseId, category, PROPERTY_NAME);
    if (elements.size() == 0) return null; //no match
    if (elements.size() != 1) throw new AssertException(
        "Found more then one property for a course node 'dialog element' which should never happen!");
    return (Property) elements.get(0);
  }
View Full Code Here

   * @param courseId
   * @param courseNodeId
   */
  public void deleteProperty(Long courseId, String courseNodeId) {
    Property prop = findProperty(courseId, courseNodeId);
    PropertyManager propMrg = PropertyManager.getInstance();
    if (prop != null) propMrg.deleteProperty(prop);
  }
View Full Code Here

                // racing with another userrequest in the same VM!
                // let's quit quickly ;)
                return;
              }
              // load comic start date only once
              PropertyManager pm = PropertyManager.getInstance();
              Property p = pm.findProperty(null, null, null, PROPERTY_CATEGORY, PROPERTY_NAME);
              if (p == null) {
                // wow first time ever, save current date
                p = pm.createPropertyInstance(null, null, null, PROPERTY_CATEGORY, PROPERTY_NAME, null, null, null, null);
                pm.saveProperty(p);
              }
              comicStartDate = p.getCreationDate().getTime();
            }
           
          });
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.