Java Code Examples for org.pentaho.di.core.database.DatabaseMeta#setChanged()
The following examples show how to use
org.pentaho.di.core.database.DatabaseMeta#setChanged() .
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: KettleFileRepository.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Read all the databases from the repository, insert into the has databases object, overwriting optionally * * @param TransMeta * The transformation to load into. * @param overWriteShared * if an object with the same name exists, overwrite * @throws KettleException */ public void readDatabases( HasDatabasesInterface transMeta, boolean overWriteShared ) throws KettleException { try { ObjectId[] dbids = getDatabaseIDs( false ); for ( int i = 0; i < dbids.length; i++ ) { DatabaseMeta databaseMeta = loadDatabaseMeta( dbids[i], null ); // reads last version if ( transMeta instanceof VariableSpace ) { databaseMeta.shareVariablesWith( (VariableSpace) transMeta ); } DatabaseMeta check = transMeta.findDatabase( databaseMeta.getName() ); // Check if there already is one in the // transformation if ( check == null || overWriteShared ) { // We only add, never overwrite database connections. if ( databaseMeta.getName() != null ) { transMeta.addOrReplaceDatabase( databaseMeta ); if ( !overWriteShared ) { databaseMeta.setChanged( false ); } } } } } catch ( KettleException e ) { throw e; } }
Example 2
Source File: KettleDatabaseRepositoryJobDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Read the database connections in the repository and add them to this job if they are not yet present. * * @param jobMeta * the job to put the database connections in * @param overWriteShared * set to true if you want to overwrite shared connections while loading. * @throws KettleException */ public void readDatabases( JobMeta jobMeta, boolean overWriteShared ) throws KettleException { try { ObjectId[] dbids = repository.getDatabaseIDs( false ); for ( int i = 0; i < dbids.length; i++ ) { DatabaseMeta databaseMeta = repository.loadDatabaseMeta( dbids[i], null ); // reads last version databaseMeta.shareVariablesWith( jobMeta ); // See if there already is one in the transformation // DatabaseMeta check = jobMeta.findDatabase( databaseMeta.getName() ); // We only add, never overwrite database connections. // if ( check == null || overWriteShared ) { if ( databaseMeta.getName() != null ) { jobMeta.addOrReplaceDatabase( databaseMeta ); if ( !overWriteShared ) { databaseMeta.setChanged( false ); } } } } jobMeta.setChanged( false ); } catch ( KettleDatabaseException dbe ) { throw new KettleException( BaseMessages.getString( PKG, "JobMeta.Log.UnableToReadDatabaseIDSFromRepository" ), dbe ); } catch ( KettleException ke ) { throw new KettleException( BaseMessages.getString( PKG, "JobMeta.Log.UnableToReadDatabasesFromRepository" ), ke ); } }
Example 3
Source File: KettleDatabaseRepositoryTransDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Read all the databases from the repository, insert into the TransMeta object, overwriting optionally * * @param transMeta * The transformation to load into. * @param overWriteShared * if an object with the same name exists, overwrite * @throws KettleException */ public void readDatabases( TransMeta transMeta, boolean overWriteShared ) throws KettleException { try { ObjectId[] dbids = repository.getDatabaseIDs( false ); for ( int i = 0; i < dbids.length; i++ ) { DatabaseMeta databaseMeta = repository.loadDatabaseMeta( dbids[i], null ); // reads last version databaseMeta.shareVariablesWith( transMeta ); DatabaseMeta check = transMeta.findDatabase( databaseMeta.getName() ); // Check if there already is one in the // transformation if ( check == null || overWriteShared ) { // We only add, never overwrite database connections. if ( databaseMeta.getName() != null ) { transMeta.addOrReplaceDatabase( databaseMeta ); if ( !overWriteShared ) { databaseMeta.setChanged( false ); } } } } transMeta.clearChangedDatabases(); } catch ( KettleDatabaseException dbe ) { throw new KettleException( BaseMessages.getString( PKG, "TransMeta.Log.UnableToReadDatabaseIDSFromRepository" ), dbe ); } catch ( KettleException ke ) { throw new KettleException( BaseMessages.getString( PKG, "TransMeta.Log.UnableToReadDatabasesFromRepository" ), ke ); } }
Example 4
Source File: SpoonDBDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void saveConnection( DatabaseMeta db, String versionComment ) { // Also add to repository? Repository rep = spoon.getRepository(); if ( rep != null ) { if ( !rep.getSecurityProvider().isReadOnly() ) { try { if ( Utils.isEmpty( versionComment ) ) { rep.insertLogEntry( "Saving database '" + db.getName() + "'" ); } else { rep.insertLogEntry( "Save database : " + versionComment ); } rep.save( db, versionComment, null ); spoon.getLog().logDetailed( BaseMessages.getString( PKG, "Spoon.Log.SavedDatabaseConnection", db.getDatabaseName() ) ); db.setChanged( false ); } catch ( KettleException ke ) { new ErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, "Spoon.Dialog.ErrorSavingConnection.Title" ), BaseMessages.getString( PKG, "Spoon.Dialog.ErrorSavingConnection.Message", db.getDatabaseName() ), ke ); } } else { // This repository user is read-only! // new ErrorDialog( spoon.getShell(), BaseMessages.getString( PKG, "Spoon.Dialog.UnableSave.Title" ), BaseMessages .getString( PKG, "Spoon.Dialog.ErrorSavingConnection.Message", db.getDatabaseName() ), new KettleException( BaseMessages.getString( PKG, "Spoon.Dialog.Exception.ReadOnlyRepositoryUser" ) ) ); } } }
Example 5
Source File: TransDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Insert all the databases from the repository into the TransMeta object, overwriting optionally * * @param TransMeta * The transformation to load into. * @param overWriteShared * if an object with the same name exists, overwrite * @throws KettleException */ protected void readDatabases( TransMeta transMeta, boolean overWriteShared, List<DatabaseMeta> databaseMetas ) { for ( DatabaseMeta databaseMeta : databaseMetas ) { if ( overWriteShared || transMeta.findDatabase( databaseMeta.getName() ) == null ) { if ( databaseMeta.getName() != null ) { databaseMeta.shareVariablesWith( transMeta ); transMeta.addOrReplaceDatabase( databaseMeta ); if ( !overWriteShared ) { databaseMeta.setChanged( false ); } } } } transMeta.clearChangedDatabases(); }
Example 6
Source File: JobDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Insert all the databases from the repository into the JobMeta object, overwriting optionally * * @param jobMeta * The transformation to load into. * @param overWriteShared * if an object with the same name exists, overwrite */ protected void readDatabases( JobMeta jobMeta, boolean overWriteShared, List<DatabaseMeta> databaseMetas ) { for ( DatabaseMeta databaseMeta : databaseMetas ) { if ( overWriteShared || jobMeta.findDatabase( databaseMeta.getName() ) == null ) { if ( databaseMeta.getName() != null ) { databaseMeta.shareVariablesWith( jobMeta ); jobMeta.addOrReplaceDatabase( databaseMeta ); if ( !overWriteShared ) { databaseMeta.setChanged( false ); } } } } jobMeta.clearChanged(); }