public String calcRelativeElementDirectory( RepositoryDirectoryInterface dir ) { if ( dir != null ) { return dir.getPath(); } else { return "/"; } }
private String getRepositoryRelativePath( String path ) { String parentPath = this.transMeta.getRepositoryDirectory().getPath(); if ( path.startsWith( parentPath ) ) { path = path.replace( parentPath, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" ); } return path; } }
protected String getRepositoryRelativePath( String path ) { String parentPath = this.transMeta.getRepositoryDirectory().getPath(); if ( path.startsWith( parentPath ) ) { path = path.replace( parentPath, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" ); } return path; }
public void widgetSelected( SelectionEvent arg0 ) { RepositoryDirectoryInterface directoryFrom = jobMeta.getRepositoryDirectory(); RepositoryDirectoryInterface rd = RepositoryDirectoryUI.chooseDirectory( shell, rep, directoryFrom ); if ( rd == null ) { return; } // We need to change this in the repository as well!! // We do this when the user pressed OK newDirectory = rd; wDirectory.setText( rd.getPath() ); } } );
public void widgetSelected( SelectionEvent arg0 ) { RepositoryDirectoryInterface directoryFrom = transMeta.getRepositoryDirectory(); RepositoryDirectoryInterface rd = RepositoryDirectoryUI.chooseDirectory( shell, rep, directoryFrom ); if ( rd == null ) { return; } // We need to change this in the repository as well!! // We do this when the user pressed OK newDirectory = rd; wDirectory.setText( rd.getPath() ); } } );
@Override public int hashCode() { boolean inRepo = Utils.isEmpty( getFilename() ); return Objects.hash( name, inRepo, inRepo ? filename : getRepositoryDirectory().getPath() ); }
private void selectJob() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.kjb", log ); if ( repositoryObject != null ) { String path = DialogUtils .getPath( jobMeta.getRepositoryDirectory().getPath(), repositoryObject.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + repositoryObject.getName(); wPath.setText( fullPath ); } }
private void selectTransformation() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.ktr", log ); if ( repositoryObject != null ) { String path = DialogUtils .getPath( jobMeta.getRepositoryDirectory().getPath(), repositoryObject.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + repositoryObject.getName(); wPath.setText( fullPath ); } }
/** * Gets the repository directory path and name of the transformation. * * @return The repository directory path plus the name of the transformation */ public String getPathAndName() { if ( getRepositoryDirectory().isRoot() ) { return getRepositoryDirectory().getPath() + getName(); } else { return getRepositoryDirectory().getPath() + RepositoryDirectory.DIRECTORY_SEPARATOR + getName(); } }
public List<RepositoryElementMetaInterface> getTransformationObjects( ObjectId id_directory, boolean includeDeleted ) throws KettleException { List<RepositoryElementMetaInterface> objects = getRepositoryObjects( quoteTable( KettleDatabaseRepository.TABLE_R_TRANSFORMATION ), RepositoryObjectType.TRANSFORMATION, id_directory ); if ( ( log != null ) && log.isDebug() && objects.size() > 0 ) { log.logDebug( objects.get( 0 ).getRepositoryDirectory().getPath() ); } return objects; }
private Trans createLegacyTrans() { try { return new Trans( transMeta, spoon.rep, transMeta.getName(), transMeta.getRepositoryDirectory().getPath(), transMeta.getFilename() ); } catch ( KettleException e ) { throw new RuntimeException( e ); } }
@Before public void beforeTest() { NodeList nodeList = mock( NodeList.class ); entityNode = mock( Node.class ); when( entityNode.getChildNodes() ).thenReturn( nodeList ); baseDirectory = mock( RepositoryDirectoryInterface.class ); when( baseDirectory.getPath() ).thenReturn( ROOT_PATH ); }
private boolean isJobOpened( String id, String path, String name ) { List<JobMeta> openedJobFiles = getSpoon().delegates.jobs.getJobList(); for ( JobMeta j : openedJobFiles ) { if ( j.getObjectId() != null && id.equals( j.getObjectId().getId() ) || ( path.equals( j.getRepositoryDirectory().getPath() ) && name.equals( j.getName() ) ) ) { return true; } } return false; }
private boolean isTransOpened( String id, String path, String name ) { List<TransMeta> openedTransFiles = getSpoon().delegates.trans.getTransformationList(); for ( TransMeta t : openedTransFiles ) { if ( t.getObjectId() != null && id.equals( t.getObjectId().getId() ) || ( path.equals( t.getRepositoryDirectory().getPath() ) && name.equals( t.getName() ) ) ) { return true; } } return false; }
private void getByReferenceData( RepositoryElementMetaInterface transInf ) { String path = DialogUtils.getPath( transMeta.getRepositoryDirectory().getPath(), transInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" ); wPath.setText( fullPath ); }
@Test public void testEquals_sameNameOtherDir() { RepositoryDirectoryInterface otherDirectory = mock( RepositoryDirectoryInterface.class ); when( otherDirectory.getPath() ).thenReturn( "otherDirectoryPath" ); assertFalse( testEquals( JOB_META_NAME, otherDirectory, null, null ) ); }
public static RepositoryDirectory build( String parentPath, RepositoryDirectoryInterface repositoryDirectoryInterface ) { RepositoryDirectory repositoryDirectory = new RepositoryDirectory(); repositoryDirectory.setParent( parentPath ); repositoryDirectory.setName( repositoryDirectoryInterface.getName() ); repositoryDirectory.setPath( repositoryDirectoryInterface.getPath() ); repositoryDirectory.setObjectId( repositoryDirectoryInterface.getObjectId() ); repositoryDirectory.setHidden( !repositoryDirectoryInterface.isVisible() ); return repositoryDirectory; }
@Test public void testSetInternalEntryCurrentDirectoryWithRepository( ) { JobMeta jobMetaTest = new JobMeta( ); RepositoryDirectoryInterface path = mock( RepositoryDirectoryInterface.class ); when( path.getPath() ).thenReturn( "aPath" ); jobMetaTest.setRepository( mock( Repository.class ) ); jobMetaTest.setRepositoryDirectory( path ); jobMetaTest.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "Original value defined at run execution" ); jobMetaTest.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "file:///C:/SomeFilenameDirectory" ); jobMetaTest.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "/SomeRepDirectory" ); jobMetaTest.setInternalEntryCurrentDirectory(); assertEquals( "/SomeRepDirectory", jobMetaTest.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) ); }
@Test public void testUpdateCurrentDirWithRepository( ) { JobMeta jobMetaTest = new JobMeta( ); RepositoryDirectoryInterface path = mock( RepositoryDirectoryInterface.class ); when( path.getPath() ).thenReturn( "aPath" ); jobMetaTest.setRepository( mock( Repository.class ) ); jobMetaTest.setRepositoryDirectory( path ); jobMetaTest.setVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, "Original value defined at run execution" ); jobMetaTest.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, "file:///C:/SomeFilenameDirectory" ); jobMetaTest.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, "/SomeRepDirectory" ); jobMetaTest.updateCurrentDir(); assertEquals( "/SomeRepDirectory", jobMetaTest.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) ); }
public static RepositoryFile build( org.pentaho.di.repository.RepositoryObject repositoryObject ) { RepositoryFile repositoryFile = new RepositoryFile(); repositoryFile.setObjectId( repositoryObject.getObjectId() ); repositoryFile.setName( repositoryObject.getName() ); repositoryFile.setType( repositoryObject.getObjectType().getTypeDescription() ); repositoryFile.setExtension( repositoryObject.getObjectType().getExtension() ); repositoryFile.setDate( repositoryObject.getModifiedDate() ); repositoryFile.setPath( repositoryObject.getRepositoryDirectory().getPath() ); return repositoryFile; }