Package org.pentaho.platform.api.data

Examples of org.pentaho.platform.api.data.IPreparedComponent


    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$

    IActionParameter rtn = context.getOutputParameter( "prepared_component" ); //$NON-NLS-1$
    assertNotNull( rtn );
    IPreparedComponent preparedComponent = (IPreparedComponent) rtn.getValue();

    assertNotNull( preparedComponent );

    finishTest();
  }
View Full Code Here


    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$

    IActionParameter rtn = context.getOutputParameter( "prepared_component" ); //$NON-NLS-1$
    assertNotNull( rtn );
    IPreparedComponent preparedComponent = (IPreparedComponent) rtn.getValue();

    assertNotNull( preparedComponent );

    finishTest();
  }
View Full Code Here

    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_FAILURE, context.getStatus() ); //$NON-NLS-1$

    IActionParameter rtn = context.getOutputParameter( "prepared_component" ); //$NON-NLS-1$
    assertNotNull( rtn );
    IPreparedComponent preparedComponent = (IPreparedComponent) rtn.getValue();

    assertNull( preparedComponent );

    finishTest();
  }
View Full Code Here

    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$

    IActionParameter rtn1 = context.getOutputParameter( "prepared_component" ); //$NON-NLS-1$
    assertNotNull( rtn1 );
    IPreparedComponent preparedComponent1 = (IPreparedComponent) rtn1.getValue();
    assertNotNull( preparedComponent1 );
    IPentahoResultSet resultset1 = preparedComponent1.executePrepared( null );
    assertTrue( resultset1.getRowCount() >= 1 );
    Object val1 = resultset1.getValueAt( 0, 0 );

    IActionParameter rtn2 = context.getOutputParameter( "second_prepared_component" ); //$NON-NLS-1$
    assertNotNull( rtn2 );
    IPreparedComponent preparedComponent2 = (IPreparedComponent) rtn2.getValue();
    assertNotNull( preparedComponent2 );
    HashMap map = new HashMap();
    map.put( "POSITIONTITLE", "Engineer" ); //$NON-NLS-1$ //$NON-NLS-2$
    IPentahoResultSet resultset2 = preparedComponent2.executePrepared( map );
    assertTrue( resultset2.getRowCount() >= 1 );
    assertEquals( resultset1.getRowCount(), resultset2.getRowCount() );

    Object val2 = resultset2.getValueAt( 0, 0 );
View Full Code Here

    assertEquals(
        Messages.getInstance().getString( "BaseTest.USER_RUNNING_ACTION_SEQUENCE" ), IRuntimeContext.RUNTIME_STATUS_SUCCESS, context.getStatus() ); //$NON-NLS-1$

    IActionParameter rtn1 = context.getOutputParameter( "prepared_component" ); //$NON-NLS-1$
    assertNotNull( rtn1 );
    IPreparedComponent preparedComponent1 = (IPreparedComponent) rtn1.getValue();
    assertNotNull( preparedComponent1 );
    IPentahoResultSet resultset1 = preparedComponent1.executePrepared( null );
    assertTrue( resultset1.getRowCount() >= 1 );
    Object val1 = resultset1.getValueAt( 0, 0 );
    assertNotNull( val1 );

    finishTest();
View Full Code Here

        // if there is a prepared component specified as an input, use its connection
        // instead of creating our own.
        if ( queryAction.getMdxConnection() != ActionInputConstant.NULL_INPUT ) {
          if ( queryAction.getMdxConnection().getValue() != null ) {
            connectionOwner = false;
            IPreparedComponent component = (IPreparedComponent) queryAction.getMdxConnection().getValue();
            IPentahoConnection conn = component.shareConnection();
            if ( conn.getDatasourceType() == IPentahoConnection.MDX_DATASOURCE ) {
              connection = conn;
            } else {
              error( Messages.getInstance().getErrorString(
                  "IPreparedComponent.ERROR_0001_INVALID_CONNECTION_TYPE", getActionName() ) ); //$NON-NLS-1$           
View Full Code Here

          error( Messages.getInstance().getErrorString(
              "SQLBaseComponent.ERROR_0001_QUERY_NOT_SPECIFIED", actionDefinition.getDescription() ) ); //$NON-NLS-1$
          return false;
        }

        IPreparedComponent sharedConnection = (IPreparedComponent) relationalDbAction.getSharedConnection().getValue();

        if ( readOnlyInput != ActionInputConstant.NULL_INPUT ) {
          this.setReadOnly( readOnlyInput.getBooleanValue() );
        }

        if ( sharedConnection != null ) {
          connectionOwner = false;
          IPentahoConnection conn = sharedConnection.shareConnection();
          if ( conn == null ) {
            error( Messages.getInstance().getErrorString(
                "IPreparedComponent.ERROR_0002_CONNECTION_NOT_AVAILABLE", getActionName() ) ); //$NON-NLS-1$
            return false;
          } else if ( conn.getDatasourceType() == IPentahoConnection.SQL_DATASOURCE ) {
View Full Code Here

        String[] classNames = null;
        String query = queryAction.getQuery().getStringValue();

        if ( queryAction.getInputSharedConnection() != ActionInputConstant.NULL_INPUT ) {
          connectionOwner = false;
          IPreparedComponent component = (IPreparedComponent) queryAction.getInputSharedConnection().getValue();
          IPentahoConnection conn = component.shareConnection();
          if ( IPentahoConnection.HQL_DATASOURCE.equals( conn.getDatasourceType() ) ) {
            connection = conn;
          } else {
            connection = null;
            returnValue = false;
View Full Code Here

        // if input name is "data", rename to "default" which is the name that jfreereport is expecting.
        if ( name.equals( AbstractJFreeReportComponent.DATACOMPONENT_DATAINPUT ) ) {
          name = AbstractJFreeReportComponent.DATACOMPONENT_DEFAULTINPUT;
        }
        if ( dataObject instanceof IPreparedComponent ) {
          final IPreparedComponent comp = (IPreparedComponent) dataObject;
          factory.addPreparedComponent( name, comp );
        } else if ( dataObject instanceof IPentahoResultSet ) {
          final IPentahoResultSet resultset = (IPentahoResultSet) dataObject;
          resultset.beforeFirst();
          factory.addTable( name, new PentahoTableModel( resultset ) );
View Full Code Here

   * @return the report data or null.
   */
  public TableModel queryData( final String query, final DataRow parameters ) {
    TableModel model = tables.get( query );
    if ( model == null ) {
      final IPreparedComponent component = components.get( query );
      if ( component != null ) {
        final HashMap<String, Object> map = new HashMap<String, Object>();
        if ( parameters != null ) {
          String[] columnNames = parameters.getColumnNames();
          for ( String columnName : columnNames ) {
            map.put( columnName, parameters.get( columnName ) );
          }
        }
        final IPentahoResultSet rs = component.executePrepared( map );
        model = new PentahoTableModel( rs );
      }
    }
    return model;
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.data.IPreparedComponent

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.