Java Code Examples for org.pentaho.di.core.database.DatabaseMeta#setChangedDate()

The following examples show how to use org.pentaho.di.core.database.DatabaseMeta#setChangedDate() . 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: DatabaseDelegate.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public DatabaseMeta assemble( RepositoryFile file, NodeRepositoryFileData data, VersionSummary version )
  throws KettleException {
  DatabaseMeta databaseMeta = (DatabaseMeta) dataNodeToElement( data.getNode() );
  String fileName = file.getName();
  if ( fileName.endsWith( ".kdb" ) ) {
    fileName = fileName.substring( 0, fileName.length() - 4 );
  }
  databaseMeta.setChangedDate( file.getLastModifiedDate() );
  databaseMeta.setName( fileName );
  databaseMeta.setDisplayName( file.getTitle() );
  databaseMeta.setObjectId( new StringObjectId( file.getId().toString() ) );
  databaseMeta.setObjectRevision( repo.createObjectRevision( version ) );
  databaseMeta.clearChanged();
  return databaseMeta;
}
 
Example 2
Source File: PurRepository.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private Map<RepositoryObjectType, List<? extends SharedObjectInterface>> deepCopy(
  Map<RepositoryObjectType, List<? extends SharedObjectInterface>> orig ) throws KettleException {
  Map<RepositoryObjectType, List<? extends SharedObjectInterface>>
    copy =
    new EnumMap<RepositoryObjectType, List<? extends SharedObjectInterface>>( RepositoryObjectType.class );
  sharedObjectsLock.writeLock().lock();
  try {
    for ( Entry<RepositoryObjectType, List<? extends SharedObjectInterface>> entry : orig.entrySet() ) {
      RepositoryObjectType type = entry.getKey();
      List<? extends SharedObjectInterface> value = entry.getValue();

      List<SharedObjectInterface> newValue = new ArrayList<SharedObjectInterface>( value.size() );
      for ( SharedObjectInterface obj : value ) {
        SharedObjectInterface newValueItem;
        if ( obj instanceof DatabaseMeta ) {
          DatabaseMeta databaseMeta = (DatabaseMeta) ( (DatabaseMeta) obj ).clone();
          databaseMeta.setObjectId( ( (DatabaseMeta) obj ).getObjectId() );
          databaseMeta.setChangedDate( obj.getChangedDate() );
          databaseMeta.clearChanged();
          newValueItem = databaseMeta;
        } else if ( obj instanceof SlaveServer ) {
          SlaveServer slaveServer = (SlaveServer) ( (SlaveServer) obj ).clone();
          slaveServer.setObjectId( ( (SlaveServer) obj ).getObjectId() );
          slaveServer.clearChanged();
          newValueItem = slaveServer;
        } else if ( obj instanceof PartitionSchema ) {
          PartitionSchema partitionSchema = (PartitionSchema) ( (PartitionSchema) obj ).clone();
          partitionSchema.setObjectId( ( (PartitionSchema) obj ).getObjectId() );
          partitionSchema.clearChanged();
          newValueItem = partitionSchema;
        } else if ( obj instanceof ClusterSchema ) {
          ClusterSchema clusterSchema = ( (ClusterSchema) obj ).clone();
          clusterSchema.setObjectId( ( (ClusterSchema) obj ).getObjectId() );
          clusterSchema.clearChanged();
          newValueItem = clusterSchema;
        } else {
          throw new KettleException( "unknown shared object class" );
        }
        newValue.add( newValueItem );
      }
      copy.put( type, newValue );
    }
  } finally {
    sharedObjectsLock.writeLock().unlock();
  }
  return copy;
}