protected void savePartitionSchema( final RepositoryElementInterface element, final String versionComment, Calendar versionDate ) { try { // Even if the object id is null, we still have to check if the element is not present in the PUR // For example, if we import data from an XML file and there is a element with the same name in it. // if ( element.getObjectId() == null ) { element.setObjectId( getPartitionSchemaID( element.getName() ) ); } saveRepositoryElement( element, versionComment, partitionSchemaTransformer, getPartitionSchemaParentFolderId() ); } catch ( KettleException ke ) { ke.printStackTrace(); } }
private String calcFilename( RepositoryElementInterface element ) { return calcFilename( element.getRepositoryDirectory(), element.getName(), element .getRepositoryElementType().getExtension() ); }
public boolean existsUserInfo( RepositoryElementInterface user ) throws KettleException { return ( user.getObjectId() != null || getUserID( user.getName() ) != null ); }
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 " ); } }
throws KettleException { boolean isUpdate = ( element.getObjectId() != null ); RepositoryFile file; try { if ( isUpdate ) { file = pur.getFileById( element.getObjectId().getId() ); new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build(); file = new RepositoryFile.Builder( checkAndSanitize( element.getName() + element.getRepositoryElementType().getExtension() ) ) .title( RepositoryFile.DEFAULT_LOCALE, element.getName() ) .description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).versioned( VERSION_SHARED_OBJECTS ).build(); element.setObjectId( objectId ); element.setObjectRevision( getObjectRevision( objectId, null ) ); if ( element instanceof ChangedFlagInterface ) { ( (ChangedFlagInterface) element ).clearChanged();
if ( element != null && ( element.getObjectId() == null || element.getObjectId().getId() == null ) ) { throw new IllegalArgumentException( element.getName() + " has a null id" ); ObjectId idToFind = element != null ? element.getObjectId() : id; RepositoryObjectType typeToUpdate = element != null ? element.getRepositoryElementType() : type; RepositoryElementInterface elementToUpdate = null; List<? extends SharedObjectInterface> origSharedObjects = null; continue; ObjectId objectId = repositoryElementInterface.getObjectId(); if ( objectId != null && objectId.equals( idToFind ) ) { if ( remove ) { newSharedObjects.remove( i ); } else { elementToUpdate.setObjectId( idToFind ); // because some clones don't clone the ID!!! newSharedObjects.set( i, (SharedObjectInterface) elementToUpdate ); elementToUpdate.setObjectId( idToFind ); // because some clones don't clone the ID!!! newSharedObjects.add( (SharedObjectInterface) elementToUpdate );
if ( element.getObjectId() == null ) { element.setObjectId( getDatabaseID( element.getName() ) ); boolean isUpdate = element.getObjectId() != null; RepositoryFile file = null; if ( isUpdate ) { file = pur.getFileById( element.getObjectId().getId() ); checkAndSanitize( RepositoryFilenameUtils.escape( element.getName(), pur.getReservedChars() ) + RepositoryObjectType.DATABASE.getExtension() ) ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate( createdDate ).versioned( VERSION_SHARED_OBJECTS ).build(); element.setObjectId( objectId ); element.setObjectRevision( getObjectRevision( objectId, null ) ); if ( element instanceof ChangedFlagInterface ) { ( (ChangedFlagInterface) element ).clearChanged(); BaseMessages.getString( PKG, "PurRepository.ERROR_0004_DATABASE_UPDATE_ACCESS_DENIED", element.getName() ), e );
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();
private static <T extends SharedObjectInterface & RepositoryElementInterface> void synchronizeByObjectId( T object, List<T> objectsForSync, SynchronizationHandler<T> handler ) { synchronize( object, toSync -> object.getObjectId().equals( toSync.getObjectId() ), objectsForSync, handler ); }
if ( repositoryElement.getObjectId() != null && !repositoryElement.getObjectId().equals( objectId ) ) { delObject( repositoryElement.getObjectId() ); repositoryElement.setObjectId( objectId );
buf.append( getParentPath( file.getPath() ) ); buf.append( RepositoryFile.SEPARATOR ); buf.append( checkAndSanitize( element.getName() ) ); switch ( element.getRepositoryElementType() ) { case DATABASE: buf.append( RepositoryObjectType.DATABASE.getExtension() );
throws KettleException { ISharedObjectsTransformer objectTransformer; switch ( element.getRepositoryElementType() ) { case TRANSFORMATION: objectTransformer = transDelegate;
boolean checkLock, boolean checkRename, boolean loadRevision, boolean checkDeleted ) throws KettleException { if ( Import.ROOT_DIRECTORY.equals( element.getRepositoryDirectory().toString() ) ) { element.getName() + element.getRepositoryElementType().getExtension() ) ); final boolean isUpdate = ( element.getObjectId() != null ); RepositoryFile file = null; if ( isUpdate ) { ObjectId id = element.getObjectId(); file = pur.getFileById( id.getId() ); new RepositoryFile.Builder( file ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate( versionDate != null ? versionDate.getTime() : new Date() ).description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build(); renameKettleEntity( element, null, element.getName() ); try { file = new RepositoryFile.Builder( checkAndSanitize( element.getName() + element.getRepositoryElementType().getExtension() ) ).versioned( true ).title( RepositoryFile.DEFAULT_LOCALE, element.getName() ).createdDate( versionDate != null ? versionDate.getTime() : new Date() ).description( RepositoryFile.DEFAULT_LOCALE, Const.NVL( element.getDescription(), "" ) ).build(); pur.createFile( element.getRepositoryDirectory().getObjectId().getId(), file, new NodeRepositoryFileData( objectTransformer.elementToDataNode( element ) ), versionComment );
@Override public List<ObjectRevision> getRevisions( final RepositoryElementInterface element ) throws KettleException { return getRevisions( element.getObjectId() ); }
switch ( element.getRepositoryElementType() ) { case TRANSFORMATION: saveTrans( element, versionComment, versionDate );
protected void saveSlaveServer( final RepositoryElementInterface element, final String versionComment, Calendar versionDate ) throws KettleException { try { // Even if the object id is null, we still have to check if the element is not present in the PUR // For example, if we import data from an XML file and there is a element with the same name in it. // if ( element.getObjectId() == null ) { element.setObjectId( getSlaveID( element.getName() ) ); } saveRepositoryElement( element, versionComment, slaveTransformer, getSlaveServerParentFolderId() ); } catch ( KettleException ke ) { ke.printStackTrace(); } }
public String calcObjectId( RepositoryElementInterface element ) { RepositoryDirectoryInterface directory = element.getRepositoryDirectory(); String name = element.getName(); String extension = element.getRepositoryElementType().getExtension(); return calcObjectId( directory, name, extension ); }
@Override public void deleteVersion( RepositoryElementInterface element, String versionId ) throws KettleException { String fileId = element.getObjectId().getId(); deleteVersion( fileId, versionId ); }
switch ( repositoryElement.getRepositoryElementType() ) { case JOB: securityProvider.validateAction( RepositoryOperation.MODIFY_JOB ); default: throw new KettleException( "We can't save the element with type [" + repositoryElement.getRepositoryElementType() + "] in the repository" );
protected void saveClusterSchema( final RepositoryElementInterface element, final String versionComment, Calendar versionDate ) { try { // Even if the object id is null, we still have to check if the element is not present in the PUR // For example, if we import data from an XML file and there is a element with the same name in it. // if ( element.getObjectId() == null ) { element.setObjectId( getClusterID( element.getName() ) ); } saveRepositoryElement( element, versionComment, clusterTransformer, getClusterSchemaParentFolderId() ); } catch ( KettleException ke ) { ke.printStackTrace(); } }