Package org.pentaho.platform.repository.runtime

Examples of org.pentaho.platform.repository.runtime.RuntimeElement


    info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_TESTINGREADONLY" ) ); //$NON-NLS-1$
    HibernateUtil.beginTransaction();
    try {
      IRuntimeRepository repo = new RuntimeRepository();
      repo.setSession( getPentahoSession() );
      RuntimeElement baseElement = (RuntimeElement) repo.loadElementById( elementId, null );
      info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_SETTINGELEMENTTOREADONLY" ) ); //$NON-NLS-1$
      baseElement.setReadOnly( true );
    } finally {
      HibernateUtil.commitTransaction();
    }
    // Now, the element is read-only.
    // Flush the session and re-load the element to
    // test the "loaded" methods.
    HibernateUtil.flushSession();
    HibernateUtil.clear();
    // Now, reload the element.
    HibernateUtil.beginTransaction();
    try {
      info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_LOADINGREADONLY" ) ); //$NON-NLS-1$
      IRuntimeRepository repo = new RuntimeRepository();
      repo.setSession( getPentahoSession() );
      RuntimeElement baseElement = (RuntimeElement) repo.loadElementById( elementId, null );
      boolean caughtException = false;
      try {
        info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_TRYINGSETSTRINGPROPERTY" ) ); //$NON-NLS-1$
        baseElement
            .setStringProperty(
                Messages.getInstance().getString( "RUNTIMEREPOTEST.MODIFY_NEW_STRING_KEY" ), Messages.getInstance().getString( "RUNTIMEREPOTEST.MODIFY_STRING_VALUE" ) ); //$NON-NLS-1$ //$NON-NLS-2$
      } catch ( IllegalStateException ex ) {
        caughtException = true;
        info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_EXCEPTIONTRIPPED" ) ); //$NON-NLS-1$
      }
      assertTrue(
          Messages.getInstance().getErrorString( "RUNTIMEREPOTEST.ERROR_0001_EXCEPTIONNOTTRIPPED" ), caughtException ); //$NON-NLS-1$
      caughtException = false;
      try {
        info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_TRYINGSETPARENTTYPE" ) ); //$NON-NLS-1$
        baseElement.setParentType( Messages.getInstance().getString( "RUNTIMEREPOTEST.CREATE_PARENT_TYPE" ) ); //$NON-NLS-1$
      } catch ( IllegalStateException ex ) {
        caughtException = true;
        info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_EXCEPTIONTRIPPED" ) ); //$NON-NLS-1$
      }
      assertTrue(
View Full Code Here


  @SuppressWarnings( "unused" )
  private void cleanupElement( String elementId ) {
    HibernateUtil.beginTransaction();
    IRuntimeRepository repo = new RuntimeRepository();
    repo.setSession( getPentahoSession() );
    RuntimeElement re = (RuntimeElement) repo.loadElementById( elementId, null );
    HibernateUtil.makeTransient( re );
    HibernateUtil.commitTransaction();
    HibernateUtil.flushSession();
    HibernateUtil.clear();
  }
View Full Code Here

  @SuppressWarnings( "unused" )
  private RuntimeElement createRuntimeElement() {
    IRuntimeRepository repo = new RuntimeRepository();
    repo.setSession( getPentahoSession() );
    RuntimeElement ele = null;
    ele =
        (RuntimeElement) repo
            .newRuntimeElement(
                Messages.getInstance().getString( "RUNTIMEREPOTEST.CREATE_PARENT" ), Messages.getInstance().getString( "RUNTIMEREPOTEST.CREATE_PARENT_TYPE" ), false ); //$NON-NLS-1$ //$NON-NLS-2$
    try {
      assertNotNull( ele );
      info( Messages.getInstance().getString( "RUNTIMEREPOTEST.DEBUG_INSTANCE_ID" ) + ele.getInstanceId() ); //$NON-NLS-1$
      ele.setSolutionId( Messages.getInstance().getString( "RUNTIMEREPOTEST.SALES_SOLUTION" ) ); //$NON-NLS-1$
      ele.setStringProperty(
          Messages.getInstance().getString( "RUNTIMEREPOTEST.SHORT_STRING_KEY" ), Messages.getInstance().getString( "RUNTIMEREPOTEST.SHORT_STRING_VALUE" ) ); //$NON-NLS-1$ //$NON-NLS-2$
      // Get a Long String to Store...
      ele.setStringProperty(
          Messages.getInstance().getString( "RUNTIMEREPOTEST.LONG_STRING_KEY" ), longString.toString() ); //$NON-NLS-1$
      ele.setDateProperty( Messages.getInstance().getString( "RUNTIMEREPOTEST.DATE_KEY" ), new Date() ); //$NON-NLS-1$
      ele.setBigDecimalProperty( Messages.getInstance().getString( "RUNTIMEREPOTEST.DECIMAL_KEY" ), bdProperty ); //$NON-NLS-1$
      List myList = new ArrayList();
      myList.add( Messages.getInstance().getString( "RUNTIMEREPOTEST.LIST_ELEMENT_STRING" ) ); //$NON-NLS-1$
      myList.add( new BigDecimal( "1283764.1294839483" ) ); //$NON-NLS-1$
      myList.add( new Date() );
      ele.setListProperty( Messages.getInstance().getString( "RUNTIMEREPOTEST.LIST_ELEMENT_KEY" ), myList ); //$NON-NLS-1$
    } finally {
      HibernateUtil.commitTransaction();
    }
    return ele;
  }
View Full Code Here

  @SuppressWarnings( "unused" )
  private void readElementTest( String instanceId ) {
    HibernateUtil.beginTransaction();
    IRuntimeRepository repo = new RuntimeRepository();
    repo.setSession( getPentahoSession() );
    RuntimeElement re = (RuntimeElement) repo.loadElementById( instanceId, null );
    checkValue( Messages.getInstance().getString( "RUNTIMEREPOTEST.SALES_SOLUTION" ), re.getSolutionId() ); //$NON-NLS-1$
    checkValue( longString.toString(), re.getStringProperty( Messages.getInstance().getString(
        "RUNTIMEREPOTEST.LONG_STRING_KEY" ) ) ); //$NON-NLS-1$
    checkValue(
        Messages.getInstance().getString( "RUNTIMEREPOTEST.SHORT_STRING_VALUE" ), re.getStringProperty( Messages.getInstance().getString( "RUNTIMEREPOTEST.SHORT_STRING_KEY" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
    checkValue( bdProperty, re
        .getBigDecimalProperty( Messages.getInstance().getString( "RUNTIMEREPOTEST.DECIMAL_KEY" ) ) ); //$NON-NLS-1$
    String xml = re.toXML();
    info( xml );
    Set namesSet = re.getParameterNames();
    Iterator it = namesSet.iterator();
    String pName, pType;
    while ( it.hasNext() ) {
      pName = (String) it.next();
      pType = re.getParameterType( pName );
      info( Messages.getInstance().getString( "RUNTIMEREPOTEST.DEBUG_NAME_TYPE", pName, pType ) ); //$NON-NLS-1$
    }
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.repository.runtime.RuntimeElement

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.