Java Code Examples for org.pentaho.di.trans.step.StepMeta#isEtlMetaInject()

The following examples show how to use org.pentaho.di.trans.step.StepMeta#isEtlMetaInject() . 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: RepositoryImporterExtension.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void callExtensionPoint( LogChannelInterface log, Object object ) throws KettleException {

  Object[] metaInjectObjectArray = (Object[]) object;
  String transDirOverride = (String) metaInjectObjectArray[0];
  RepositoryDirectoryInterface baseDirectory = (RepositoryDirectoryInterface) metaInjectObjectArray[1];
  StepMeta stepMeta = (StepMeta) metaInjectObjectArray[2];
  boolean needToCheckPathForVariables = (boolean) metaInjectObjectArray[3];

  if ( stepMeta.isEtlMetaInject() ) {
    MetaInjectMeta metaInjectMeta = (MetaInjectMeta) stepMeta.getStepMetaInterface();
    if ( metaInjectMeta.getSpecificationMethod() == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ) {
      if ( transDirOverride != null ) {
        metaInjectMeta.setDirectoryPath( transDirOverride );
      } else {
        String mappingMetaPath = resolvePath( baseDirectory.getPath(), metaInjectMeta.getDirectoryPath(), needToCheckPathForVariables );
        metaInjectMeta.setDirectoryPath( mappingMetaPath );
      }
    }
  }
}
 
Example 2
Source File: AbstractKettleTransformationProducer.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private boolean isDynamicTransformation( final TransMeta transMeta ) {
  List<StepMeta> steps = transMeta.getSteps();
  for ( final StepMeta step : steps ) {
    if ( step.isEtlMetaInject() ) {
      return true;
    }
  }
  return false;
}
 
Example 3
Source File: RepositoryExporterExtension.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void callExtensionPoint( LogChannelInterface log, Object object ) throws KettleException {

  Object[] metaInjectObjectArray = (Object[]) object;
  TransMeta transMeta = (TransMeta) metaInjectObjectArray[0];
  Class<?> PKG = (Class<?>) metaInjectObjectArray[1];
  KettleFileRepository fileRep = (KettleFileRepository) metaInjectObjectArray[2];
  StepMeta stepMeta = (StepMeta) metaInjectObjectArray[3];

  if ( stepMeta.isEtlMetaInject() ) {
    MetaInjectMeta metaInjectMeta = (MetaInjectMeta) stepMeta.getStepMetaInterface();
    // convert to a named based reference.
    //
    if ( metaInjectMeta.getSpecificationMethod() == ObjectLocationSpecificationMethod.FILENAME ) {
      try {
        TransMeta meta =
            MetaInjectMeta.loadTransformationMeta( metaInjectMeta, fileRep, fileRep.metaStore, transMeta );
        FileObject fileObject = KettleVFS.getFileObject( meta.getFilename() );
        metaInjectMeta.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME );
        metaInjectMeta.setFileName( null );
        metaInjectMeta.setTransName( meta.getName() );
        metaInjectMeta.setDirectoryPath( Const.NVL( calcRepositoryDirectory( fileRep, fileObject ), "/" ) );
      } catch ( Exception e ) {
        log.logError( BaseMessages.getString( PKG, "Repository.Exporter.Log.UnableToLoadTransInMDI",
            metaInjectMeta.getName() ), e );
      }
    }
  }
}