Java Code Examples for org.pentaho.di.trans.TransMeta#getName()

The following examples show how to use org.pentaho.di.trans.TransMeta#getName() . 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: DatabaseJoinMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {

  // Find the lookupfields...
  //
  RowMetaInterface out = prev.clone();
  getFields( out, stepMeta.getName(), new RowMetaInterface[] { info, }, null, transMeta, repository, metaStore );

  if ( out != null ) {
    for ( int i = 0; i < out.size(); i++ ) {
      ValueMetaInterface outvalue = out.getValueMeta( i );
      DatabaseImpact di =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(),
          databaseMeta.getDatabaseName(), "", outvalue.getName(), outvalue.getName(), stepMeta.getName(),
          transMeta.environmentSubstitute( sql ),
          BaseMessages.getString( PKG, "DatabaseJoinMeta.DatabaseImpact.Title" ) );
      impact.add( di );

    }
  }
}
 
Example 2
Source File: PGBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    /* DEBUG CHECK THIS */
    // Insert dateMask fields : read/write
    for ( int i = 0; i < fieldTable.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

      DatabaseImpact ii =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta
            .getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
          fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 3
Source File: DeleteMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    // Lookup: we do a lookup on the natural keys
    for ( int i = 0; i < keyLookup.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( keyStream[i] );

      DatabaseImpact ii =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_DELETE, transMeta.getName(), stepMeta.getName(), databaseMeta
            .getDatabaseName(), tableName, keyLookup[i], keyStream[i],
          v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 4
Source File: MonetDBBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    /* DEBUG CHECK THIS */
    // Insert dateMask fields : read/write
    for ( int i = 0; i < fieldTable.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

      DatabaseImpact ii =
          new DatabaseImpact(
              DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta
              .getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
              fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 5
Source File: DynamicSQLRowMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {

  RowMetaInterface out = prev.clone();
  getFields( out, stepMeta.getName(), new RowMetaInterface[] { info, }, null, transMeta, repository, metaStore );
  if ( out != null ) {
    for ( int i = 0; i < out.size(); i++ ) {
      ValueMetaInterface outvalue = out.getValueMeta( i );
      DatabaseImpact di =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta
            .getDatabaseName(), "", outvalue.getName(), outvalue.getName(), stepMeta.getName(), sql,
          BaseMessages.getString( PKG, "DynamicSQLRowMeta.DatabaseImpact.Title" ) );
      impact.add( di );

    }
  }
}
 
Example 6
Source File: OraBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    /* DEBUG CHECK THIS */
    // Insert dateMask fields : read/write
    for ( int i = 0; i < fieldTable.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

      DatabaseImpact ii =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta
            .getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
          fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 7
Source File: MySQLBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    /* DEBUG CHECK THIS */
    // Insert dateMask fields : read/write
    for ( int i = 0; i < fieldTable.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

      DatabaseImpact ii =
          new DatabaseImpact( DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(),
              databaseMeta.getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
              fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 8
Source File: GPLoadMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    /* DEBUG CHECK THIS */
    // Insert dateMask fields : read/write
    for ( int i = 0; i < fieldTable.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

      DatabaseImpact ii =
          new DatabaseImpact( DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(),
              databaseMeta.getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
              fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 9
Source File: LucidDBBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    /* DEBUG CHECK THIS */
    // Insert dateMask fields : read/write
    for ( int i = 0; i < fieldTable.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

      DatabaseImpact ii =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta
            .getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
          fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 10
Source File: GPBulkLoaderMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {
  if ( prev != null ) {
    /* DEBUG CHECK THIS */
    // Insert dateMask fields : read/write
    for ( int i = 0; i < fieldTable.length; i++ ) {
      ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

      DatabaseImpact ii =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta
            .getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
          fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
      impact.add( ii );
    }
  }
}
 
Example 11
Source File: DataSetHelper.java    From pentaho-pdi-dataset with Apache License 2.0 5 votes vote down vote up
public void createUnitTest( Spoon spoon, TransMeta transMeta ) {
  try {
    TransUnitTest unitTest = new TransUnitTest();
    unitTest.setName( transMeta.getName() + " Test" );
    unitTest.setTransFilename( transMeta.getFilename() );
    if ( spoon.getRepository() != null ) {
      unitTest.setTransObjectId( transMeta.getObjectId() == null ? null : transMeta.getObjectId().getId() );
      String path = transMeta.getRepositoryDirectory().getPath();
      if ( !path.endsWith( "/" ) ) {
        path += "/";
      }
      path += transMeta.getName();
      unitTest.setTransRepositoryPath( path );
    }

    FactoriesHierarchy hierarchy = getHierarchy();

    TransUnitTestDialog dialog = new TransUnitTestDialog( spoon.getShell(), transMeta, spoon.getMetaStore(), unitTest );
    if ( dialog.open() ) {
      saveUnitTest( hierarchy.getTestFactory(), unitTest, transMeta );

      activeTests.put( transMeta, unitTest );

      spoon.refreshGraph();
    }

  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error creating a new transformation unit test", e );
  }
}
 
Example 12
Source File: ExecSQLMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMeta prev,
  String[] input, String[] output, RowMeta info ) throws KettleStepException {
  DatabaseImpact ii =
    new DatabaseImpact(
      DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(),
      databaseMeta.getDatabaseName(),
      BaseMessages.getString( PKG, "ExecSQLMeta.DatabaseMeta.Unknown.Label" ),
      BaseMessages.getString( PKG, "ExecSQLMeta.DatabaseMeta.Unknown2.Label" ),
      BaseMessages.getString( PKG, "ExecSQLMeta.DatabaseMeta.Unknown3.Label" ), stepMeta.getName(), sql,
      BaseMessages.getString( PKG, "ExecSQLMeta.DatabaseMeta.Title" ) );
  impact.add( ii );
}
 
Example 13
Source File: TableInputMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
  RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
  IMetaStore metaStore ) throws KettleStepException {

  // if ( stepMeta.getName().equalsIgnoreCase( "cdc_cust" ) ) {
  //   System.out.println( "HERE!" );
  // }

  // Find the lookupfields...
  RowMetaInterface out = new RowMeta();
  // TODO: this builds, but does it work in all cases.
  getFields( out, stepMeta.getName(), new RowMetaInterface[] { info }, null, transMeta, repository, metaStore );

  if ( out != null ) {
    for ( int i = 0; i < out.size(); i++ ) {
      ValueMetaInterface outvalue = out.getValueMeta( i );
      DatabaseImpact ii =
        new DatabaseImpact(
          DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta
            .getDatabaseName(), "", outvalue.getName(), outvalue.getName(), stepMeta.getName(), sql,
          "read from one or more database tables via SQL statement" );
      impact.add( ii );

    }
  }
}
 
Example 14
Source File: DataSetHelper.java    From pentaho-pdi-dataset with Apache License 2.0 4 votes vote down vote up
public static List<TransUnitTest> findTransformationUnitTest( TransMeta transMeta, IMetaStore metaStore ) {
  MetaStoreFactory<TransUnitTest> factory = new MetaStoreFactory<TransUnitTest>( TransUnitTest.class, metaStore, PentahoDefaults.NAMESPACE );
  List<TransUnitTest> tests = new ArrayList<TransUnitTest>();

  try {

    List<TransUnitTest> allTests = factory.getElements();
    for ( TransUnitTest test : allTests ) {
      // Match the filename
      //
      if ( StringUtils.isNotEmpty( transMeta.getFilename() ) ) {

        // What's the transformation absolute URI
        //
        FileObject transFile = KettleVFS.getFileObject( transMeta.getFilename() );
        String transUri = transFile.getName().getURI();

        // What's the filename referenced in the test?
        //
        FileObject testTransFile = KettleVFS.getFileObject( test.calculateCompleteFilename( transMeta ) );
        if ( testTransFile.exists() ) {
          String testTransUri = testTransFile.getName().getURI();

          if ( transUri.equals( testTransUri ) ) {
            tests.add( test );
          }
        }
      } else {
        if ( transMeta.getRepository() != null ) {
          // No filename, check the object_id ...
          //
          if ( transMeta.getObjectId() != null && transMeta.getObjectId().getId().equals( test.getTransObjectId() ) ) {
            tests.add( test );
          } else {
            // Try the repository path..
            //
            // What is the repsository path?
            String repositoryPath = transMeta.getRepositoryDirectory().getPath() + "/" + transMeta.getName();
            if ( repositoryPath.equals( test.getTransRepositoryPath() ) ) {
              tests.add( test );
            }
          }
        }
      }
    }

  } catch ( Exception exception ) {
    new ErrorDialog( Spoon.getInstance().getShell(),
      BaseMessages.getString( PKG, "ShowUnitTestMenuExtensionPoint.ErrorFindingUnitTestsForTransformation.Title" ),
      BaseMessages.getString( PKG, "ShowUnitTestMenuExtensionPoint.ErrorFindingUnitTestsForTransformation.Message" ),
      exception );
  }
  return tests;
}