Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.ComponentException


    if ( ( resultSet != null ) && ( resultSet.getRowCount() > 0 ) ) {
      displayNames = new HashMap();
      items = new ArrayList();
      if ( nameColumnNo == -1 ) {
        // we did not find the specified name column
        throw new ComponentException( Messages.getInstance().getErrorString(
            "FilterDefinition.ERROR_0001_NAME_COLUMN_MISSING", descriptionItem ) ); //$NON-NLS-1$
      } else if ( valueColumnNo == -1 ) {
        // we did not find the specified name column
        throw new ComponentException( Messages.getInstance().getErrorString(
            "FilterDefinition.ERROR_0002_VALUE_COLUMN_MISSING", valueItem ) ); //$NON-NLS-1$
      }

      Object[] row = null;
      try {
        row = resultSet.next();
      } catch ( Exception e ) {
        // We will check for null below
      }
      if ( row == null ) {
        logger.warn( Messages.getInstance().getErrorString( "FilterDefinition.ERROR_0004_FILTER_DEFINITION_EMPTY" ) ); //$NON-NLS-1$
      } else {
        while ( row != null ) {
          value = row[valueColumnNo].toString();
          items.add( value );
          name = row[nameColumnNo].toString();
          if ( name != null ) {
            displayNames.put( value, name );
          }

          row = resultSet.next();
        }
      }
      // close the result set so we can loop through it again later if we need
      // to
      resultSet.close();

      // now create the XForm for the item
      if ( displayNames.size() == 0 ) {
        displayNames = null;
      }
    } else {
      // ResultSet is null and it is ok only for a filter type of TEXT_BOX
      if ( type != XForm.TYPE_TEXT ) {
        throw new ComponentException( Messages.getInstance().getErrorString(
            "FilterDefinition.ERROR_0003_FILTER_DEFINITION_NULL" ) ); //$NON-NLS-1$
      }
    }

    assert formName != null : Messages.getInstance().getErrorString( "FilterDefinition.ERROR_0005_NAME_ELEMENT_EMPTY" ); //$NON-NLS-1$
View Full Code Here


import org.pentaho.platform.api.engine.ComponentException;

public class BadObject {

  public BadObject() throws ComponentException {
    throw new ComponentException( "BadObject constructor" ); //$NON-NLS-1$
  }
View Full Code Here

  }

  public void testComponentException1() {
    startTest();
    info( "Expected: Exception will be caught and thrown as a Component Exception" ); //$NON-NLS-1$
    ComponentException ce = new ComponentException();
    System.out.println( "ComponentException :" + ce ); //$NON-NLS-1$
    assertTrue( true );
    finishTest();

  }
View Full Code Here

  }

  public void testComponentException2() {
    startTest();
    info( "Expected: Exception will be caught and thrown as a Component Exception" ); //$NON-NLS-1$
    ComponentException ce1 = new ComponentException( "A test Component Exception has been thrown" ); //$NON-NLS-1$
    System.out.println( "ComponentException :" + ce1 ); //$NON-NLS-1$   
    assertTrue( true );
    finishTest();
  }
View Full Code Here

  }

  public void testComponentException3() {
    startTest();
    info( "Expected: A Component Exception will be created with Throwable as a parameter" ); //$NON-NLS-1$
    ComponentException ce2 = new ComponentException( new Throwable( "This is a throwable exception" ) ); //$NON-NLS-1$
    System.out.println( "ComponentException" + ce2 ); //$NON-NLS-1$   
    assertTrue( true );
    finishTest();

  }
View Full Code Here

  }

  public void testComponentException4() {
    startTest();
    info( "Expected: Exception will be caught and thrown as a Component Exception" ); //$NON-NLS-1$
    ComponentException ce3 = new ComponentException( "A test UI Exception has been thrown", new Throwable() ); //$NON-NLS-1$
    System.out.println( "ComponentException :" + ce3 ); //$NON-NLS-1$   
    assertTrue( true );
    finishTest();

  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.ComponentException

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.