Java Code Examples for org.pentaho.di.trans.Trans#setArguments()

The following examples show how to use org.pentaho.di.trans.Trans#setArguments() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransformationResource.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@GET
@Path( "/prepare/{id : .+}" )
@Produces( { MediaType.APPLICATION_JSON } )
public TransformationStatus prepareTransformation( @PathParam( "id" ) String id ) {
  Trans trans = CarteResource.getTransformation( id );
  try {

    CarteObjectEntry entry = CarteResource.getCarteObjectEntry( id );
    TransConfiguration transConfiguration =
      CarteSingleton.getInstance().getTransformationMap().getConfiguration( entry );
    TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration();
    // Set the appropriate logging, variables, arguments, replay date, ...
    // etc.
    trans.setArguments( executionConfiguration.getArgumentStrings() );
    trans.setReplayDate( executionConfiguration.getReplayDate() );
    trans.setSafeModeEnabled( executionConfiguration.isSafeModeEnabled() );
    trans.setGatheringMetrics( executionConfiguration.isGatheringMetrics() );
    trans.injectVariables( executionConfiguration.getVariables() );
    trans.setPreviousResult( executionConfiguration.getPreviousResult() );

    trans.prepareExecution( null );
  } catch ( KettleException e ) {
    e.printStackTrace();
  }
  return getTransformationStatus( id );
}
 
Example 2
Source File: TransExecutor.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
Trans createInternalTrans() throws KettleException {
  Trans executorTrans = new Trans( getData().getExecutorTransMeta(), this );

  executorTrans.setParentTrans( getTrans() );
  executorTrans.setRepository( getTrans().getRepository() );
  executorTrans.setLogLevel( getLogLevel() );
  executorTrans.setArguments( getTrans().getArguments() );

  executorTrans.setInternalKettleVariables( this );

  executorTrans.setPreview( getTrans().isPreview() );

  TransStepUtil.initServletConfig( getTrans(), executorTrans );

  return executorTrans;
}
 
Example 3
Source File: AbstractKettleTransformationProducer.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Trans prepareTransformation( final DataRow parameters,
                                     final DataFactoryContext context,
                                     final TransMeta transMeta )
  throws EvaluationException, ParseException, KettleException {
  final FormulaContext formulaContext = new WrappingFormulaContext( context.getFormulaContext(), parameters );
  final String[] params = fillArguments( formulaContext );

  final Trans trans = new Trans( transMeta );
  trans.setArguments( params );
  updateTransformationParameter( formulaContext, trans );
  transMeta.setInternalKettleVariables();
  trans.prepareExecution( params );
  return trans;
}