当前位置: 首页>>代码示例>>Java>>正文


Java RepositoryElementInterface.getRepositoryElementType方法代码示例

本文整理汇总了Java中org.pentaho.di.repository.RepositoryElementInterface.getRepositoryElementType方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryElementInterface.getRepositoryElementType方法的具体用法?Java RepositoryElementInterface.getRepositoryElementType怎么用?Java RepositoryElementInterface.getRepositoryElementType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.repository.RepositoryElementInterface的用法示例。


在下文中一共展示了RepositoryElementInterface.getRepositoryElementType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOnlyRevision_DateAndCommentAreSaved

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
private void testOnlyRevision_DateAndCommentAreSaved( RepositoryElementInterface transOrJob ) throws Exception {
  final String elementName = "onlyRevision_" + transOrJob.getRepositoryElementType();
  final String comment = "onlyRevision";
  final Calendar date = Calendar.getInstance();
  date.setTimeInMillis( 0 );

  transOrJob.setName( elementName );
  transOrJob.setRepositoryDirectory( purRepository.getDefaultSaveDirectory( transOrJob ) );
  purRepository.save( transOrJob, comment, date, null, false );

  assertCommentAndDate( transOrJob.getObjectRevision(), date, comment );

  List<VersionSummary> versions = assertExistsAndGetRevisions( transOrJob );
  assertEquals( 1, versions.size() );
  assertCommentAndDate( versions.get( 0 ), date, comment );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:PurRepository_Revisions_IT.java

示例2: testOnlyRevision_DateAndCommentAreNull

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
private void testOnlyRevision_DateAndCommentAreNull( RepositoryElementInterface transOrJob ) throws Exception {
  final String elementName = "revisionWithOutComment_" + transOrJob.getRepositoryElementType();

  transOrJob.setName( elementName );
  transOrJob.setRepositoryDirectory( purRepository.getDefaultSaveDirectory( transOrJob ) );

  final long before = System.currentTimeMillis();
  purRepository.save( transOrJob, null, null, null, false );
  final long after = System.currentTimeMillis();

  assertNull( transOrJob.getObjectRevision().getComment() );

  final long revisionDate = transOrJob.getObjectRevision().getCreationDate().getTime();
  assertTrue( "Revision date should be inside 'before' and 'after' measurements", before <= revisionDate
      && revisionDate <= after );

  List<VersionSummary> versions = assertExistsAndGetRevisions( transOrJob );
  assertEquals( 1, versions.size() );
  assertNull( versions.get( 0 ).getMessage() );

  final long versionSummaryDate = versions.get( 0 ).getDate().getTime();
  assertTrue( "Revision date should be inside 'before' and 'after' measurements", before <= versionSummaryDate
      && versionSummaryDate <= after );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:PurRepository_Revisions_IT.java

示例3: testTwoRevisions_DateAndCommentAreSaved

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
private void testTwoRevisions_DateAndCommentAreSaved( RepositoryElementInterface transOrJob ) throws Exception {
  final String elementName = "twoRevisions_" + transOrJob.getRepositoryElementType();

  final String comment1 = "first";
  final Calendar date1 = Calendar.getInstance();
  date1.setTimeInMillis( 0 );

  final String comment2 = "second";
  final Calendar date2 = Calendar.getInstance();
  date2.setTimeInMillis( 100 );

  transOrJob.setName( elementName );
  transOrJob.setRepositoryDirectory( purRepository.getDefaultSaveDirectory( transOrJob ) );

  purRepository.save( transOrJob, comment1, date1, null, false );
  assertCommentAndDate( transOrJob.getObjectRevision(), date1, comment1 );

  purRepository.save( transOrJob, comment2, date2, null, false );
  assertCommentAndDate( transOrJob.getObjectRevision(), date2, comment2 );

  List<VersionSummary> versions = assertExistsAndGetRevisions( transOrJob );
  assertEquals( 2, versions.size() );
  assertCommentAndDate( versions.get( 0 ), date1, comment1 );
  assertCommentAndDate( versions.get( 1 ), date2, comment2 );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:PurRepository_Revisions_IT.java

示例4: save

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
@Override
public void save( RepositoryElementInterface element, String versionComment, Calendar versionDate,
                  ProgressMonitorListener monitor, boolean overwrite ) throws KettleException {

  try {
    switch ( element.getRepositoryElementType() ) {
      case TRANSFORMATION:
        saveTrans( element, versionComment, versionDate );
        break;
      case JOB:
        saveJob( element, versionComment, versionDate );
        break;
      case DATABASE:
        saveDatabaseMeta( element, versionComment, versionDate );
        break;
      case SLAVE_SERVER:
        saveSlaveServer( element, versionComment, versionDate );
        break;
      case CLUSTER_SCHEMA:
        saveClusterSchema( element, versionComment, versionDate );
        break;
      case PARTITION_SCHEMA:
        savePartitionSchema( element, versionComment, versionDate );
        break;
      default:
        throw new KettleException(
            "It's not possible to save Class [" + element.getClass().getName() + "] to the repository" );
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unable to save repository element [" + element + "]", e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:33,代码来源:PurRepository.java

示例5: isRenamed

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
private boolean isRenamed( final RepositoryElementInterface element, final RepositoryFile file )
  throws KettleException {
  if ( element.getObjectId() == null ) {
    return false; // never been saved
  }
  String filename = element.getName();
  switch ( element.getRepositoryElementType() ) {
    case TRANSFORMATION:
      filename += RepositoryObjectType.TRANSFORMATION.getExtension();
      break;
    case JOB:
      filename += RepositoryObjectType.JOB.getExtension();
      break;
    case DATABASE:
      filename += RepositoryObjectType.DATABASE.getExtension();
      break;
    case SLAVE_SERVER:
      filename += RepositoryObjectType.SLAVE_SERVER.getExtension();
      break;
    case CLUSTER_SCHEMA:
      filename += RepositoryObjectType.CLUSTER_SCHEMA.getExtension();
      break;
    case PARTITION_SCHEMA:
      filename += RepositoryObjectType.PARTITION_SCHEMA.getExtension();
      break;
    default:
      throw new KettleException( "unknown element type [" + element.getClass().getName() + "]" );
  }
  if ( !file.getName().equals( checkAndSanitize( filename ) ) ) {
    return true;
  }
  return false;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:34,代码来源:PurRepository.java

示例6: renameIfNecessary

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
private void renameIfNecessary( final RepositoryElementInterface element, final RepositoryFile file )
  throws KettleException {
  if ( !isRenamed( element, file ) ) {
    return;
  }

  // ObjectId id = element.getObjectId();
  StringBuilder buf = new StringBuilder( file.getPath().length() );
  buf.append( getParentPath( file.getPath() ) );
  buf.append( RepositoryFile.SEPARATOR );
  buf.append( checkAndSanitize( element.getName() ) );
  switch ( element.getRepositoryElementType() ) {
    case DATABASE:
      buf.append( RepositoryObjectType.DATABASE.getExtension() );
      break;
    case SLAVE_SERVER:
      buf.append( RepositoryObjectType.SLAVE_SERVER.getExtension() );
      break;
    case CLUSTER_SCHEMA:
      buf.append( RepositoryObjectType.CLUSTER_SCHEMA.getExtension() );
      break;
    case PARTITION_SCHEMA:
      buf.append( RepositoryObjectType.PARTITION_SCHEMA.getExtension() );
      break;
    default:
      throw new KettleException( "It's not possible to rename Class [" + element.getClass().getName()
          + "] to the repository" );
  }
  pur.moveFile( file.getId(), buf.toString(), null );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:31,代码来源:PurRepository.java

示例7: renameKettleEntity

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
protected ObjectId renameKettleEntity( final RepositoryElementInterface transOrJob,
                                       final RepositoryDirectoryInterface newDirectory, final String newName ) throws KettleException {
  switch ( transOrJob.getRepositoryElementType() ) {
    case TRANSFORMATION:
      return renameTransformation( transOrJob.getObjectId(), null, newDirectory, newName );
    case JOB:
      return renameJob( transOrJob.getObjectId(), null, newDirectory, newName );
    default:
      throw new KettleException( "Unknown RepositoryObjectType. Should be TRANSFORMATION or JOB " );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:12,代码来源:PurRepository.java

示例8: save

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public void save(RepositoryElementInterface repositoryElement, String versionComment, ProgressMonitorListener monitor, ObjectId parentId, boolean used, boolean overwrite) throws KettleException {
 	
 	try {
 		lockRepository();
 		
 		if (!Const.isEmpty(versionComment)) {
 			insertLogEntry(versionComment);
 		}
 		
 		switch(repositoryElement.getRepositoryElementType()) {
 		case JOB : 
      	securityProvider.validateAction(RepositoryOperation.MODIFY_JOB);
  		jobDelegate.saveJob((JobMeta)repositoryElement, versionComment, monitor, overwrite);
 			break;
 		case TRANSFORMATION : 
      	securityProvider.validateAction(RepositoryOperation.MODIFY_TRANSFORMATION);
  		transDelegate.saveTransformation((TransMeta)repositoryElement, versionComment, monitor, overwrite);
 			break;
 		case DATABASE : 
      	securityProvider.validateAction(RepositoryOperation.MODIFY_DATABASE);
  		databaseDelegate.saveDatabaseMeta((DatabaseMeta)repositoryElement);
 			break;
 		case SLAVE_SERVER :
      	securityProvider.validateAction(RepositoryOperation.MODIFY_SLAVE_SERVER);
  		slaveServerDelegate.saveSlaveServer((SlaveServer)repositoryElement, parentId, used, overwrite);
 			break;
 		case CLUSTER_SCHEMA :
      	securityProvider.validateAction(RepositoryOperation.MODIFY_CLUSTER_SCHEMA);
  		clusterSchemaDelegate.saveClusterSchema((ClusterSchema)repositoryElement, versionComment, parentId, used, overwrite);
 			break;
 		case PARTITION_SCHEMA :
      	securityProvider.validateAction(RepositoryOperation.MODIFY_PARTITION_SCHEMA);
  		partitionSchemaDelegate.savePartitionSchema((PartitionSchema)repositoryElement, parentId, used, overwrite);
  		break;
  	default:
  		throw new KettleException("We can't save the element with type ["+repositoryElement.getRepositoryElementType()+"] in the repository");
 		}
  	
// Automatically commit changes to these elements.
  	//
commit();
 	} finally {
         unlockRepository();
 	}
 }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:46,代码来源:KettleDatabaseRepository.java

示例9: save

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public void save(RepositoryElementInterface repositoryElement, String versionComment, ProgressMonitorListener monitor, ObjectId parentId, boolean used, boolean overwrite) throws KettleException {

    try {
      lockRepository();

      if (!Const.isEmpty(versionComment)) {
        insertLogEntry(versionComment);
      }

      switch (repositoryElement.getRepositoryElementType()) {
      case JOB:
        securityProvider.validateAction(RepositoryOperation.MODIFY_JOB);
        jobDelegate.saveJob((JobMeta) repositoryElement, versionComment, monitor, overwrite);
        break;
      case TRANSFORMATION:
        securityProvider.validateAction(RepositoryOperation.MODIFY_TRANSFORMATION);
        transDelegate.saveTransformation((TransMeta) repositoryElement, versionComment, monitor, overwrite);
        break;
      case DATABASE:
        securityProvider.validateAction(RepositoryOperation.MODIFY_DATABASE);
        databaseDelegate.saveDatabaseMeta((DatabaseMeta) repositoryElement);
        break;
      case SLAVE_SERVER:
        securityProvider.validateAction(RepositoryOperation.MODIFY_SLAVE_SERVER);
        slaveServerDelegate.saveSlaveServer((SlaveServer) repositoryElement, parentId, used, overwrite);
        break;
      case CLUSTER_SCHEMA:
        securityProvider.validateAction(RepositoryOperation.MODIFY_CLUSTER_SCHEMA);
        clusterSchemaDelegate.saveClusterSchema((ClusterSchema) repositoryElement, versionComment, parentId, used, overwrite);
        break;
      case PARTITION_SCHEMA:
        securityProvider.validateAction(RepositoryOperation.MODIFY_PARTITION_SCHEMA);
        partitionSchemaDelegate.savePartitionSchema((PartitionSchema) repositoryElement, parentId, used, overwrite);
        break;
      default:
        throw new KettleException("We can't save the element with type [" + repositoryElement.getRepositoryElementType() + "] in the repository");
      }

      // Automatically commit changes to these elements.
      //
      commit();
    } finally {
      unlockRepository();
    }
  }
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:46,代码来源:KettleDatabaseRepository.java

示例10: save

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
public void save( RepositoryElementInterface repositoryElement, String versionComment,
  ProgressMonitorListener monitor, ObjectId parentId, boolean used, boolean overwrite ) throws KettleException {

  try {
    lockRepository();

    if ( !Utils.isEmpty( versionComment ) ) {
      insertLogEntry( versionComment );
    }

    switch ( repositoryElement.getRepositoryElementType() ) {
      case JOB:
        securityProvider.validateAction( RepositoryOperation.MODIFY_JOB );
        jobDelegate.saveJob( (JobMeta) repositoryElement, versionComment, monitor, overwrite );
        break;
      case TRANSFORMATION:
        securityProvider.validateAction( RepositoryOperation.MODIFY_TRANSFORMATION );
        transDelegate.saveTransformation( (TransMeta) repositoryElement, versionComment, monitor, overwrite );
        break;
      case DATABASE:
        securityProvider.validateAction( RepositoryOperation.MODIFY_DATABASE );
        databaseDelegate.saveDatabaseMeta( (DatabaseMeta) repositoryElement );
        break;
      case SLAVE_SERVER:
        securityProvider.validateAction( RepositoryOperation.MODIFY_SLAVE_SERVER );
        slaveServerDelegate.saveSlaveServer( (SlaveServer) repositoryElement, parentId, used, overwrite );
        break;
      case CLUSTER_SCHEMA:
        securityProvider.validateAction( RepositoryOperation.MODIFY_CLUSTER_SCHEMA );
        clusterSchemaDelegate.saveClusterSchema(
          (ClusterSchema) repositoryElement, versionComment, parentId, used, overwrite );
        break;
      case PARTITION_SCHEMA:
        securityProvider.validateAction( RepositoryOperation.MODIFY_PARTITION_SCHEMA );
        partitionSchemaDelegate.savePartitionSchema(
          (PartitionSchema) repositoryElement, parentId, used, overwrite );
        break;
      default:
        throw new KettleException( "We can't save the element with type ["
          + repositoryElement.getRepositoryElementType() + "] in the repository" );
    }

    // Automatically commit changes to these elements.
    //
    commit();
  } finally {
    unlockRepository();
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:50,代码来源:KettleDatabaseRepository.java

示例11: saveKettleEntity

import org.pentaho.di.repository.RepositoryElementInterface; //导入方法依赖的package包/类
/**
 * Saves {@code element} in repository. {@code element} show represent either a transformation or a job. <br/>
 * The method throws {@code KettleException} in the following cases:
 * <ul>
 *   <li>{@code element} is not a {@linkplain TransMeta} or {@linkplain JobMeta}</li>
 *   <li>{@code checkLock == true} and the file is locked and cannot be unlocked</li>
 *   <li>{@code checkDeleted == true} and the file was removed</li>
 *   <li>{@code checkRename == true} and the file was renamed and renaming failed</li>
 * </ul>
 *
 * @param element
 *          job or transformation
 * @param versionComment
 *          revision comment
 * @param versionDate
 *          revision timestamp
 * @param saveSharedObjects
 *          flag of saving element's shared objects
 * @param checkLock
 *          flag of checking whether the corresponding file is locked
 * @param checkRename
 *          flag of checking whether it is necessary to rename the file
 * @param loadRevision
 *          flag of setting element's revision
 * @param checkDeleted
 *          flag of checking whether the file was deleted
 * @throws KettleException
 *           if any of aforementioned conditions is {@code true}
 */
protected void saveKettleEntity( RepositoryElementInterface element,
                                 String versionComment, Calendar versionDate,
                                 boolean saveSharedObjects,
                                 boolean checkLock, boolean checkRename,
                                 boolean loadRevision, boolean checkDeleted )
  throws KettleException {
  ISharedObjectsTransformer objectTransformer;
  switch ( element.getRepositoryElementType() ) {
    case TRANSFORMATION:
      objectTransformer = transDelegate;
      break;
    case JOB:
      objectTransformer = jobDelegate;
      break;
    default:
      throw new KettleException(
          "Unknown RepositoryObjectType. Should be TRANSFORMATION or JOB " );
  }
  saveTransOrJob( objectTransformer, element, versionComment, versionDate, saveSharedObjects, checkLock, checkRename,
      loadRevision, checkDeleted );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:51,代码来源:PurRepository.java


注:本文中的org.pentaho.di.repository.RepositoryElementInterface.getRepositoryElementType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。