org.pentaho.di.repository.Repository.save()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(14.3k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.pentaho.di.repository.Repository.save方法的一些代码示例,展示了Repository.save的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.save方法的具体详情如下:
包路径:org.pentaho.di.repository.Repository
类名称:Repository
方法名:save

Repository.save介绍

[英]Save the object to the repository with version comments as well as version dates. This form exists largely to support the importing of revisions, preserving their revision date.
[中]使用版本注释和版本日期将对象保存到存储库。此表单主要用于支持修订的导入,保留修订日期。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

protected void saveTransMeta( TransMeta transMeta ) throws KettleException {
 rep.save( transMeta, versionComment, this, overwrite );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
  try {
   rep.save( jobMeta, versionComment, new ProgressMonitorAdapter( monitor ) );
  } catch ( KettleException e ) {
   throw new InvocationTargetException( e, "Error saving job" );
  }
 }
};

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void save( RepositoryElementInterface repositoryElementInterface, String s, ProgressMonitorListener progressMonitorListener ) throws KettleException {
 getDelegate().save( repositoryElementInterface, s, progressMonitorListener );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void save( RepositoryElementInterface repositoryElementInterface, String s, ProgressMonitorListener progressMonitorListener, boolean b ) throws KettleException {
 getDelegate().save( repositoryElementInterface, s, progressMonitorListener, b );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void save( RepositoryElementInterface repositoryElementInterface, String s, Calendar calendar, ProgressMonitorListener progressMonitorListener, boolean b ) throws KettleException {
 getDelegate().save( repositoryElementInterface, s, calendar, progressMonitorListener, b );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
  try {
   rep.save( meta, versionComment, new ProgressMonitorAdapter( monitor ) );
  } catch ( KettleException e ) {
   throw new InvocationTargetException( e, BaseMessages.getString(
    PKG, "TransSaveProgressDialog.Exception.ErrorSavingTransformation" )
    + e.toString() );
  }
 }
};

代码示例来源:origin: pentaho/pentaho-kettle

protected void saveJobMeta( JobMeta jobMeta ) throws KettleException {
 // Keep info on who & when this transformation was created...
 if ( jobMeta.getCreatedUser() == null || jobMeta.getCreatedUser().equals( "-" ) ) {
  jobMeta.setCreatedDate( new Date() );
  if ( rep.getUserInfo() != null ) {
   jobMeta.setCreatedUser( rep.getUserInfo().getLogin() );
  } else {
   jobMeta.setCreatedUser( null );
  }
 }
 rep.save( jobMeta, versionComment, null, overwrite );
}

代码示例来源:origin: pentaho/pentaho-kettle

protected <T extends SharedObjectInterface & RepositoryElementInterface & ChangedFlagInterface>
  void saveSharedObjectToRepository( T sharedObject, String versionComment ) throws KettleException {
 Repository rep = spoon.getRepository();
 if ( rep != null  ) {
  if ( !rep.getSecurityProvider().isReadOnly() ) {
   rep.save( sharedObject, versionComment, null );
   sharedObject.clearChanged();
  } else {
   throw new KettleException( BaseMessages.getString(
     PKG, "Spoon.Dialog.Exception.ReadOnlyRepositoryUser" ) );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

private void saveJobToRepo( JobMeta jobMeta, RepositoryImportFeedbackInterface feedback ) throws KettleException {
 try {
  jobMeta.lookupRepositoryReferences( rep );
 } catch ( LookupReferencesException e ) {
  // log and continue; might fail from exports performed before PDI-5294
  feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log", jobMeta.getName(),
    RepositoryObjectType.JOB ) );
  feedback.addLog( BaseMessages
    .getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log.Cause", e.objectTypePairsToString() ) );
 }
 rep.save( jobMeta, "import object reference specification", null );
}

代码示例来源:origin: pentaho/pentaho-kettle

private void saveTransformationToRepo( TransMeta transMeta, RepositoryImportFeedbackInterface feedback )
  throws KettleException {
 try {
  transMeta.lookupRepositoryReferences( rep );
 } catch ( LookupReferencesException e ) {
  // log and continue; might fail from exports performed before PDI-5294
  feedback.addLog( BaseMessages.getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log", transMeta.getName(),
    RepositoryObjectType.TRANSFORMATION ) );
  feedback.addLog( BaseMessages
    .getString( PKG, "RepositoryImporter.LookupRepoRefsError.Log.Cause", e.objectTypePairsToString() ) );
 }
 rep.save( transMeta, "import object reference specification", null );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void saveSharedObjects( final RepositoryElementInterface element, final String versionComment )
 throws KettleException {
 JobMeta jobMeta = (JobMeta) element;
 // Now store the databases in the job.
 // Only store if the database has actually changed or doesn't have an object ID (imported)
 //
 for ( DatabaseMeta databaseMeta : jobMeta.getDatabases() ) {
  if ( databaseMeta.hasChanged() || databaseMeta.getObjectId() == null ) {
   if ( databaseMeta.getObjectId() == null
     || unifiedRepositoryConnectionAclService.hasAccess( databaseMeta.getObjectId(),
       RepositoryFilePermission.WRITE ) ) {
    repo.save( databaseMeta, versionComment, null );
   } else {
    log.logError( BaseMessages.getString( PKG, "PurRepository.ERROR_0004_DATABASE_UPDATE_ACCESS_DENIED",
      databaseMeta.getName() ) );
   }
  }
 }
 // Store the slave server
 //
 for ( SlaveServer slaveServer : jobMeta.getSlaveServers() ) {
  if ( slaveServer.hasChanged() || slaveServer.getObjectId() == null ) {
   repo.save( slaveServer, versionComment, null );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void editSlaveServer( String slaveName ) {
 try {
  ObjectId id = rep.getSlaveID( slaveName );
  SlaveServer slaveServer = rep.loadSlaveServer( id, null ); // Load the last version
  SlaveServerDialog dd = new SlaveServerDialog( shell, slaveServer );
  if ( dd.open() ) {
   rep.insertLogEntry( "Updating slave server '" + slaveServer.getName() + "'" );
   rep.save( slaveServer, Const.VERSION_COMMENT_EDIT_VERSION, null );
   if ( !slaveName.equalsIgnoreCase( slaveServer.getName() ) ) {
    refreshTree();
   }
  }
 } catch ( KettleException e ) {
  new ErrorDialog(
   shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Slave.Edit.UnexpectedError.Title" ), BaseMessages
    .getString( PKG, "RepositoryExplorerDialog.Slave.Edit.UnexpectedError.Message" )
    + slaveName + "]", e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void editPartitionSchema( String partitionSchemaName ) {
 try {
  ObjectId id = rep.getPartitionSchemaID( partitionSchemaName );
  PartitionSchema partitionSchema = rep.loadPartitionSchema( id, null ); // Load the last version
  PartitionSchemaDialog dd =
   new PartitionSchemaDialog( shell, partitionSchema, rep.readDatabases(), variableSpace );
  if ( dd.open() ) {
   rep.insertLogEntry( "Updating partition schema '" + partitionSchema.getName() + "'" );
   rep.save( partitionSchema, Const.VERSION_COMMENT_EDIT_VERSION, null );
   if ( !partitionSchemaName.equalsIgnoreCase( partitionSchema.getName() ) ) {
    refreshTree();
   }
  }
 } catch ( KettleException e ) {
  new ErrorDialog(
   shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.PartitionSchema.Edit.UnexpectedError.Title" ),
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.PartitionSchema.Edit.UnexpectedError.Message" )
    + partitionSchemaName + "]", e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void editCluster( String clusterName ) {
 try {
  ObjectId id = rep.getClusterID( clusterName );
  ClusterSchema cluster = rep.loadClusterSchema( id, rep.getSlaveServers(), null ); // Load the last version
  ClusterSchemaDialog dd = new ClusterSchemaDialog( shell, cluster, rep.getSlaveServers() );
  if ( dd.open() ) {
   rep.insertLogEntry( "Updating cluster '" + cluster.getName() + "'" );
   rep.save( cluster, Const.VERSION_COMMENT_EDIT_VERSION, null );
   if ( !clusterName.equalsIgnoreCase( cluster.getName() ) ) {
    refreshTree();
   }
  }
 } catch ( KettleException e ) {
  //CHECKSTYLE:LineLength:OFF
  new ErrorDialog( shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Cluster.Edit.UnexpectedError.Title" ),
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Cluster.Edit.UnexpectedError.Message" ) + clusterName + "]", e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void newSlaveServer( HasSlaveServersInterface hasSlaveServersInterface ) {
 SlaveServer slaveServer = new SlaveServer();
 SlaveServerDialog dialog =
   new SlaveServerDialog( spoon.getShell(), slaveServer, hasSlaveServersInterface.getSlaveServers() );
 if ( dialog.open() ) {
  slaveServer.verifyAndModifySlaveServerName( hasSlaveServersInterface.getSlaveServers(), null );
  hasSlaveServersInterface.getSlaveServers().add( slaveServer );
  if ( spoon.rep != null ) {
   try {
    if ( !spoon.rep.getSecurityProvider().isReadOnly() ) {
     spoon.rep.save( slaveServer, Const.VERSION_COMMENT_INITIAL_VERSION, null );
     // repository objects are "global"
     if ( sharedObjectSyncUtil != null ) {
      sharedObjectSyncUtil.reloadJobRepositoryObjects( false );
      sharedObjectSyncUtil.reloadTransformationRepositoryObjects( false );
     }
    } else {
     showSaveErrorDialog( slaveServer,
       new KettleException( BaseMessages.getString( PKG, "Spoon.Dialog.Exception.ReadOnlyRepositoryUser" ) ) );
    }
   } catch ( KettleException e ) {
    showSaveErrorDialog( slaveServer, e );
   }
  }
  refreshTree();
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void editDatabase( String databasename ) {
 try {
  ObjectId idDatabase = rep.getDatabaseID( databasename );
  DatabaseMeta databaseMeta = rep.loadDatabaseMeta( idDatabase, null ); // reads last version
  getDatabaseDialog().setDatabaseMeta( databaseMeta );
  String name = getDatabaseDialog().open();
  if ( name != null ) {
   if ( !readonly ) {
    rep.insertLogEntry( "Updating database connection '"
     + getDatabaseDialog().getDatabaseMeta().getName() + "'" );
    rep.save( databaseMeta, Const.VERSION_COMMENT_EDIT_VERSION, null );
   } else {
    MessageBox mb = new MessageBox( shell, SWT.ICON_WARNING | SWT.OK );
    mb.setMessage( BaseMessages.getString(
     PKG, "RepositoryExplorerDialog.Connection.Edit.NotAllowed.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "RepositoryExplorerDialog.Connection.Edit.NotAllowed.Title" ) );
    mb.open();
   }
   if ( !databasename.equalsIgnoreCase( name ) ) {
    refreshTree();
   }
  }
 } catch ( KettleException e ) {
  new ErrorDialog(
   shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Connection.Edit.UnexpectedError.Title" ), BaseMessages
    .getString( PKG, "RepositoryExplorerDialog.Connection.Edit.UnexpectedError.Message" )
    + databasename + "]", e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void newSlaveServer() {
 try {
  SlaveServer slaveServer = new SlaveServer();
  SlaveServerDialog dd = new SlaveServerDialog( shell, slaveServer, rep.getSlaveServers() );
  if ( dd.open() ) {
   // See if this slave server already exists...
   ObjectId idSlave = rep.getSlaveID( slaveServer.getName() );
   if ( idSlave == null ) {
    rep.insertLogEntry( "Creating new slave server '" + slaveServer.getName() + "'" );
    rep.save( slaveServer, Const.VERSION_COMMENT_INITIAL_VERSION, null );
   } else {
    MessageBox mb = new MessageBox( shell, SWT.ICON_ERROR | SWT.OK );
    mb.setMessage( BaseMessages.getString(
     PKG, "RepositoryExplorerDialog.Slave.Create.AlreadyExists.Message" ) );
    mb.setText( BaseMessages.getString( PKG, "RepositoryExplorerDialog.Slave.Create.AlreadyExists.Title" ) );
    mb.open();
   }
   // Refresh tree...
   refreshTree();
  }
 } catch ( KettleException e ) {
  new ErrorDialog( shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Title" ),
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Message" ), e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void newCluster() {
 try {
  ClusterSchema cluster = new ClusterSchema();
  ClusterSchemaDialog dd = new ClusterSchemaDialog( shell, cluster, rep.getSlaveServers() );
  if ( dd.open() ) {
   // See if this slave server already exists...
   ObjectId idCluster = rep.getClusterID( cluster.getName() );
   if ( idCluster == null ) {
    rep.insertLogEntry( "Creating new cluster '" + cluster.getName() + "'" );
    rep.save( cluster, Const.VERSION_COMMENT_INITIAL_VERSION, null );
   } else {
    MessageBox mb = new MessageBox( shell, SWT.ICON_ERROR | SWT.OK );
    mb.setMessage( BaseMessages.getString(
     PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Message" ) );
    mb
     .setText( BaseMessages
      .getString( PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Title" ) );
    mb.open();
   }
   // Refresh tree...
   refreshTree();
  }
 } catch ( KettleException e ) {
  new ErrorDialog( shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Title" ),
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Message" ), e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void newPartitionSchema() {
 try {
  PartitionSchema partitionSchema = new PartitionSchema();
  PartitionSchemaDialog dd =
   new PartitionSchemaDialog( shell, partitionSchema, rep.readDatabases(), variableSpace );
  if ( dd.open() ) {
   // See if this slave server already exists...
   ObjectId idPartitionSchema = rep.getPartitionSchemaID( partitionSchema.getName() );
   if ( idPartitionSchema == null ) {
    rep.insertLogEntry( "Creating new partition schema '" + partitionSchema.getName() + "'" );
    rep.save( partitionSchema, Const.VERSION_COMMENT_INITIAL_VERSION, null );
   } else {
    MessageBox mb = new MessageBox( shell, SWT.ICON_ERROR | SWT.OK );
    mb.setMessage( BaseMessages.getString(
     PKG, "RepositoryExplorerDialog.PartitionSchema.Create.AlreadyExists.Message" ) );
    mb.setText( BaseMessages.getString(
     PKG, "RepositoryExplorerDialog.PartitionSchema.Create.AlreadyExists.Title" ) );
    mb.open();
   }
   // Refresh tree...
   refreshTree();
  }
 } catch ( KettleException e ) {
  new ErrorDialog( shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.PartitionSchema.Create.UnexpectedError.Title" ),
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.PartitionSchema.Create.UnexpectedError.Message" ), e );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void newDatabase() {
 try {
  DatabaseMeta databaseMeta = new DatabaseMeta();
  databaseMeta.initializeVariablesFrom( null );
  getDatabaseDialog().setDatabaseMeta( databaseMeta );
  String name = getDatabaseDialog().open();
  if ( name != null ) {
   // See if this user already exists...
   ObjectId idDatabase = rep.getDatabaseID( name );
   if ( idDatabase == null ) {
    rep.insertLogEntry( "Creating new database '" + databaseMeta.getName() + "'" );
    rep.save( databaseMeta, Const.VERSION_COMMENT_INITIAL_VERSION, null );
   } else {
    MessageBox mb = new MessageBox( shell, SWT.ICON_ERROR | SWT.OK );
    mb.setMessage( BaseMessages.getString(
     PKG, "RepositoryExplorerDialog.Connection.Create.AlreadyExists.Message" ) );
    mb.setText( BaseMessages.getString(
     PKG, "RepositoryExplorerDialog.Connection.Create.AlreadyExists.Title" ) );
    mb.open();
   }
   // Refresh tree...
   refreshTree();
  }
 } catch ( KettleException e ) {
  new ErrorDialog( shell,
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Title" ),
   BaseMessages.getString( PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Message" ), e );
 }
}

相关文章

Repository类方法