Package org.pentaho.actionsequence.dom

Examples of org.pentaho.actionsequence.dom.IActionOutput


  protected IContentItem getContentItem( final String mimeType, final String extension ) {
    JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
    // Try to get the output from the action-sequence document.
    IContentItem contentItem = null;
    IActionOutput actionOutput = jFreeReportAction.getOutputReport();
    if ( actionOutput != null ) {
      contentItem = getOutputItem( actionOutput.getName(), mimeType, extension );
      contentItem.setMimeType( mimeType );
    } else if ( getOutputNames().size() == 1 ) {
      String outputName = (String) getOutputNames().iterator().next();
      contentItem = getOutputContentItem( outputName, mimeType );
      contentItem.setMimeType( mimeType );
View Full Code Here


    }

    boolean success = component.execute();

    if ( success ) {
      IActionOutput actionOutput = actionDefinition.getOutputResultSet();
      if ( actionOutput != null ) {
        actionOutput.setValue( component.getResultSet() );
      }
    }

    return success;
  }
View Full Code Here

        ( (MDXResultSet) resultSet ).setFormattedCellValues( formattedCellValues );
      }
      rSet = resultSet;
      if ( resultSet != null ) {
        MdxQueryAction mdxQueryAction = (MdxQueryAction) getActionDefinition();
        IActionOutput actionOutput = mdxQueryAction.getOutputResultSet();
        if ( actionOutput != null ) {
          actionOutput.setValue( resultSet );
        }
        return true;
      } else {
        // close the connection
        error( Messages.getInstance().getErrorString( "MDXBaseComponent.ERROR_0006_EXECUTE_FAILED",
View Full Code Here

  private boolean executeCopyAction( final CopyParamAction copyParamAction ) {
    boolean result = true;

    IActionInput actionInput = copyParamAction.getCopyFrom();
    IActionOutput actionOutput = copyParamAction.getOutputCopy();

    if ( ( actionInput instanceof ActionInput ) && ( actionOutput != null ) ) {
      try {
        actionOutput.setValue( actionInput.getValue() );
      } catch ( Exception ex ) {
        result = false;
      }
    }
View Full Code Here

  private boolean executeFormatAction( final FormatMsgAction formatMsgAction ) {

    boolean result = true;
    String formatString = formatMsgAction.getFormatString().getStringValue();
    IActionOutput actionOutput = formatMsgAction.getOutputString();
    IActionInput[] msgInputs = formatMsgAction.getMsgInputs();

    ArrayList formatArgs = new ArrayList();
    for ( IActionInput element : msgInputs ) {
      formatArgs.add( element.getStringValue() );
    }

    try {
      MessageFormat mf = new MessageFormat( formatString );
      String theResult = mf.format( formatArgs.toArray() );
      if ( actionOutput != null ) {
        actionOutput.setValue( theResult );
      }
    } catch ( Exception ex ) {
      result = false;
    }
    return result;
View Full Code Here

    return LogFactory.getLog( SQLLookupRule.class );
  }

  @Override
  public String getResultOutputName() {
    IActionOutput actionOutput = ( (AbstractRelationalDbAction) getActionDefinition() ).getOutputResultSet();
    return actionOutput != null ? actionOutput.getPublicName() : null;
    // return ((AbstractRelationalDbAction)getActionDefinition()).getOutputResultSetName();
  }
View Full Code Here

        // Check if this is a prepared query that will be executed later. If so cache the
        // query and set this component as the output. This query will be run later from a subreport.
        if ( relationalDbAction.getOutputPreparedStatement() != null ) {
          prepareQuery( baseQuery );
          IActionOutput actionOutput = relationalDbAction.getOutputPreparedStatement();
          if ( actionOutput != null ) {
            actionOutput.setValue( this );
          }
          return true;
        }

        // TODO not sure if this should be allowed without connection ownership?
        // int maxRows = relationalDbAction.getMaxRows().getIntValue(-1);
        if ( maxRowsInput != ActionInputConstant.NULL_INPUT ) {
          this.setMaxRows( maxRowsInput.getIntValue() );
        }

        // Added by Arijit Chatterjee.Sets the value of timeout. Default is -1, if parameter not found.
        if ( queryTimeoutInput != ActionInputConstant.NULL_INPUT ) {
          this.setQueryTimeout( queryTimeoutInput.getIntValue() );
        }

        if ( relationalDbAction.getPerformTransform().getBooleanValue( false ) ) {
          runQuery( baseQuery, false ); // The side effect of
          // transform rSet here

          rSet =
              PentahoDataTransmuter.crossTab( rSet, relationalDbAction.getTransformPivotColumn().getIntValue( -1 ) - 1,
                  relationalDbAction.getTransformMeasuresColumn().getIntValue( -1 ) - 1, relationalDbAction
                      .getTransformSortColumn().getIntValue( 0 ) - 1, (Format) relationalDbAction
                      .getTransformPivotDataFormat().getValue(), (Format) relationalDbAction
                      .getTransformSortDataFormat().getValue(), relationalDbAction.getTransformOrderOutputColumns()
                      .getBooleanValue( false ) );

          IActionOutput actionOutput = relationalDbAction.getOutputResultSet();
          if ( actionOutput != null ) {
            actionOutput.setValue( rSet );
          }
          return true;
        } else {
          return runQuery( baseQuery, relationalDbAction.getLive().getBooleanValue( false ) );
        }
      } else if ( actionDefinition instanceof SqlConnectionAction ) {
        SqlConnectionAction sqlConnectionAction = (SqlConnectionAction) actionDefinition;
        dispose();
        connection = getDatasourceConnection();
        if ( connection == null ) {
          return false;
        } else {
          IActionOutput actionOutput = sqlConnectionAction.getOutputConnection();
          if ( actionOutput != null ) {
            actionOutput.setValue( this );
            return true;
          } else {
            return false;
          }
        }
View Full Code Here

        // After preparation and execution, we need to clear out the
        // prepared parameters.
        preparedParameters.clear();
        if ( resultSet != null ) {
          getMetadata( resultSet, true );
          IActionOutput actionOutput = relationalDbAction.getOutputResultSet();
          if ( actionOutput != null ) {
            actionOutput.setValue( resultSet );
          }
          return true;
        } else {
          // close the connection if owner
          error( Messages.getInstance().getErrorString( "SQLBaseComponent.ERROR_0006_EXECUTE_FAILED",
            getActionName() ) ); //$NON-NLS-1$
          if ( connectionOwner ) {
            connection.close();
          }
          return false;
        }

      } else {
        // execute the query, read the results and cache them
        try {
          // After preparation and execution, we need to clear out the
          // prepared parameters.
          preparedParameters.clear();

          IPentahoResultSet cachedResultSet = resultSet.memoryCopy();
          rSet = cachedResultSet;

          IActionOutput actionOutput = relationalDbAction.getOutputResultSet();
          if ( actionOutput != null ) {
            actionOutput.setValue( cachedResultSet );
          }
        } finally {
          // close the connection if owner
          if ( connectionOwner ) {
            connection.close();
View Full Code Here

    }
    boolean anyMismatches = false;
    boolean foundIt;
    Object srcValue = null, compValue = null;
    ResultSetCompareAction compareAction = (ResultSetCompareAction) getActionDefinition();
    IActionOutput output = compareAction.getOutputCompareResult();
    for ( int sourceRows = 0; sourceRows < sourceRowCount; sourceRows++ ) {
      foundIt = false;
      srcValue = rs1.getValueAt( sourceRows, compareCol );
      // n+1 traversal. This accommodates non-ordered input
      for ( int compRows = 0; compRows < compRowCount; compRows++ ) {
        compValue = rs2.getValueAt( compRows, compareCol );
        if ( compValue.equals( srcValue ) ) {
          foundIt = true;
          break;
        }
      }
      if ( !foundIt ) {
        if ( outputBuf.length() > 0 ) {
          outputBuf.append( "," ).append( srcValue.toString().trim() ); //$NON-NLS-1$
        } else {
          outputBuf.append( srcValue.toString().trim() );
        }
        if ( output != null ) {
          output.setValue( outputBuf.toString() );
        }
        if ( outputMismatches ) {
          error( Messages.getInstance().getErrorString(
              "ResultSetCompareComponent.ERROR_0010_MISMATCH_OUTPUT", srcValue.toString() ) ); //$NON-NLS-1$
          anyMismatches = true;
        } else {
          if ( stopOnError ) {
            return false;
          }
        }
      }
    }
    if ( !anyMismatches ) {
      if ( output != null ) {
        output.setValue( ResultSetCompareComponent.COMPARE_RESULT_OK );
      }
    }
    return stopOnError ? !anyMismatches : true;
  }
View Full Code Here

        } else {
          createBasicConnection( queryAction, classNames );
        }

        if ( connection != null ) {
          IActionOutput actionOutput = queryAction.getOutputPreparedStatementParam();
          if ( actionOutput != null ) {
            // prepare the query for execution, but don't execute quite yet.
            prepareQuery( query );

            // set the output as self, which will be used later by another component.
            actionOutput.setValue( this );
          } else {
            return runQuery( connection, classNames, query );
          }
        }
      } else if ( getActionDefinition() instanceof HQLConnectionAction ) {
        HQLConnectionAction connAction = (HQLConnectionAction) getActionDefinition();
        String[] classNames = null;
        createBasicConnection( connAction, classNames );
        if ( connection != null ) {
          IActionOutput outputConnection = connAction.getOutputConnectionParam();
          if ( outputConnection != null ) {
            outputConnection.setValue( this );
          }
        }
      } else {
        returnValue = false;
        error( Messages.getInstance().getErrorString(
View Full Code Here

TOP

Related Classes of org.pentaho.actionsequence.dom.IActionOutput

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.