Java Code Examples for org.pentaho.di.trans.step.StepMetaInterface#getClass()
The following examples show how to use
org.pentaho.di.trans.step.StepMetaInterface#getClass() .
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: StepMetaProps.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Retuns an instance of this class with stepMeta properties mapped * to a list of {@link PropGroup} */ public static StepMetaProps from( StepMetaInterface stepMeta ) { StepMetaProps propMap = new StepMetaProps( stepMeta ); propMap.stepMeta = stepMeta; // use metadata injection to extract properties BeanInjectionInfo info = new BeanInjectionInfo( stepMeta.getClass() ); BeanInjector injector = new BeanInjector( info ); propMap.populateGroups( stepMeta, info, injector ); return propMap; }
Example 2
Source File: StepMetaProps.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Sets the properties of this StepMetaProps on {@param stepMetaInterface} * <p> * This method mutates the stepMeta, as opposed to returning a new instance, to match * more cleanly to Kettle's {@link StepMetaInterface#loadXML} design, which loads props into * an instance. */ public StepMetaInterface to( StepMetaInterface stepMetaInterface ) { BeanInjectionInfo info = new BeanInjectionInfo( stepMetaInterface.getClass() ); BeanInjector injector = new BeanInjector( info ); info.getProperties().values().forEach( property -> assignValueForProp( property, stepMetaInterface, injector ) ); return stepMetaInterface; }
Example 3
Source File: MetaInject.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Inject constant values. */ private void newInjectionConstants( String targetStep, StepMetaInterface targetStepMeta ) throws KettleException { if ( log.isDetailed() ) { logDetailed( "Handing step '" + targetStep + "' constants injection!" ); } BeanInjectionInfo injectionInfo = new BeanInjectionInfo( targetStepMeta.getClass() ); BeanInjector injector = new BeanInjector( injectionInfo ); // Collect all the metadata for this target step... boolean wasInjection = false; for ( Map.Entry<TargetStepAttribute, SourceStepField> entry : meta.getTargetSourceMapping().entrySet() ) { TargetStepAttribute target = entry.getKey(); SourceStepField source = entry.getValue(); if ( target.getStepname().equalsIgnoreCase( targetStep ) ) { // This is the step to collect data for... // We also know which step to read the data from. (source) // if ( source.getStepname() == null ) { // inject constant if ( injector.hasProperty( targetStepMeta, target.getAttributeKey() ) ) { // target step has specified key injector.setProperty( targetStepMeta, target.getAttributeKey(), null, source.getField() ); wasInjection = true; } else { // target step doesn't have specified key - just report but don't fail like in 6.0 (BACKLOG-6753) logError( BaseMessages.getString( PKG, "MetaInject.TargetKeyIsNotDefined.Message", target.getAttributeKey(), getTransMeta().getName() ) ); } } } } // NOTE: case when only 1 field out of group is supplied constant, need to populate other fields if ( wasInjection ) { injector.runPostInjectionProcessing( targetStepMeta ); } }
Example 4
Source File: MetaInject.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Inject values from steps. */ private void newInjection( String targetStep, StepMetaInterface targetStepMeta ) throws KettleException { if ( log.isDetailed() ) { logDetailed( "Handing step '" + targetStep + "' injection!" ); } BeanInjectionInfo injectionInfo = new BeanInjectionInfo( targetStepMeta.getClass() ); BeanInjector injector = new BeanInjector( injectionInfo ); // Collect all the metadata for this target step... // Map<TargetStepAttribute, SourceStepField> targetMap = meta.getTargetSourceMapping(); boolean wasInjection = false; for ( TargetStepAttribute target : targetMap.keySet() ) { SourceStepField source = targetMap.get( target ); if ( target.getStepname().equalsIgnoreCase( targetStep ) ) { // This is the step to collect data for... // We also know which step to read the data from. (source) // if ( source.getStepname() != null ) { // from specified steo List<RowMetaAndData> rows = data.rowMap.get( source.getStepname() ); if ( rows != null && !rows.isEmpty() ) { // Which metadata key is this referencing? Find the attribute key in the metadata entries... // if ( injector.hasProperty( targetStepMeta, target.getAttributeKey() ) ) { // target step has specified key boolean skip = false; for ( RowMetaAndData r : rows ) { if ( r.getRowMeta().indexOfValue( source.getField() ) < 0 ) { logError( BaseMessages.getString( PKG, "MetaInject.SourceFieldIsNotDefined.Message", source .getField(), getTransMeta().getName() ) ); // source step doesn't contain specified field skip = true; } } if ( !skip ) { // specified field exist - need to inject injector.setProperty( targetStepMeta, target.getAttributeKey(), rows, source.getField() ); wasInjection = true; } } else { // target step doesn't have specified key - just report but don't fail like in 6.0 (BACKLOG-6753) logError( BaseMessages.getString( PKG, "MetaInject.TargetKeyIsNotDefined.Message", target .getAttributeKey(), getTransMeta().getName() ) ); } } } } } if ( wasInjection ) { injector.runPostInjectionProcessing( targetStepMeta ); } }