/** * Gets the job meta's repository directory interface. * * @return RepositoryDirectoryInterface */ public RepositoryDirectoryInterface getRepositoryDirectory() { if ( jobMeta == null ) { return null; } return jobMeta.getRepositoryDirectory(); }
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() ); } } );
RepositoryDirectoryInterface directory = null; if ( repository != null && specificationMethod.equals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ) && job != null && job.getJobMeta() != null && job.getJobMeta().getRepositoryDirectory() != null ) { directory = job.getJobMeta().getRepositoryDirectory(); } else if ( job != null && repository == null && specificationMethod.equals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME ) ) { && specificationMethod.equals( ObjectLocationSpecificationMethod.FILENAME ) ) { directory = job.getJobMeta().getRepositoryDirectory(); } else if ( job != null && filename == null ) { filename = job.getFilename(); if ( realParent != null && realParent.getRepositoryDirectory() != null ) { directory = realParent.getRepositoryDirectory();
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 void isFileOpenedInFolder( String path ) throws KettleException { List<TransMeta> openedTransFiles = getSpoon().delegates.trans.getTransformationList(); for ( TransMeta t : openedTransFiles ) { if ( t.getRepositoryDirectory().getPath() != null && ( t.getRepositoryDirectory().getPath() + "/" ).startsWith( path + "/" ) ) { throw new KettleTransException(); } } List<JobMeta> openedJobFiles = getSpoon().delegates.jobs.getJobList(); for ( JobMeta j : openedJobFiles ) { if ( j.getRepositoryDirectory().getPath() != null && ( j.getRepositoryDirectory().getPath() + "/" ).startsWith( path + "/" ) ) { throw new KettleJobException(); } } }
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 ); } }
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 ); } }
if ( parentJobMeta.getRepositoryDirectory() == null && jobMeta.getRepositoryDirectory() != null ) { return; if ( parentJobMeta.getRepositoryDirectory() != null && jobMeta.getRepositoryDirectory() == null ) { return; if ( jobMeta.getRepositoryDirectory().getObjectId() != parentJobMeta.getRepositoryDirectory().getObjectId() ) { return;
public void browseVersionHistory() { try { RepositoryRevisionBrowserDialogInterface dialog = RepositoryExplorerDialog.getVersionBrowserDialog( shell, spoon.rep, jobMeta ); String versionLabel = dialog.open(); if ( versionLabel != null ) { spoon.loadObjectFromRepository( jobMeta.getName(), jobMeta.getRepositoryElementType(), jobMeta .getRepositoryDirectory(), versionLabel ); } } catch ( Exception e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JobGraph.VersionBrowserException.Title" ), BaseMessages.getString( PKG, "JobGraph.VersionBrowserException.Message" ), e ); } }
showJobLogTableOptions( (JobLogTable) logTables.get( 0 ) ); if ( jobMeta.getRepositoryDirectory() != null ) { wDirectory.setText( jobMeta.getRepositoryDirectory().getPath() );
private void selectRepositoryJob() { RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject( "*.kjb", log ); try { if ( repositoryObject != null ) { loadRepositoryJob( repositoryObject.getName(), repositoryObject.getRepositoryDirectory() ); String path = DialogUtils .getPath( transMeta.getRepositoryDirectory().getPath(), executorJobMeta.getRepositoryDirectory().getPath() ); String fullPath = ( path.equals( "/" ) ? "/" : path + "/" ) + executorJobMeta.getName(); wPath.setText( fullPath ); specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME; } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogTitle" ), BaseMessages.getString( PKG, "SingleThreaderDialog.ErrorSelectingObject.DialogMessage" ), ke ); } }
private void getByReferenceData( ObjectId transObjectId ) { try { RepositoryObject transInf = rep.getObjectInformation( transObjectId, RepositoryObjectType.TRANSFORMATION ); String path = DialogUtils.getPath( jobMeta.getRepositoryDirectory().getPath(), transInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" ); wPath.setText( fullPath ); } catch ( KettleException e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Title" ), BaseMessages.getString( PKG, "JobEntryTransDialog.Exception.UnableToReferenceObjectId.Message" ), e ); } }
RepositoryDirectoryInterface dirFrom = jobMeta.getRepositoryDirectory(); wDirectory.setText( jobMeta.getRepositoryDirectory().getPath() ); } catch ( KettleException dbe ) { jobMeta.setRepositoryDirectory( dirFrom );
private void getByReferenceData( ObjectId referenceObjectId ) { try { RepositoryObject jobInf = rep.getObjectInformation( referenceObjectId, RepositoryObjectType.JOB ); String path = DialogUtils.getPath( jobMeta.getRepositoryDirectory().getPath(), jobInf.getRepositoryDirectory().getPath() ); String fullPath = Const.NVL( path, "" ) + "/" + Const.NVL( jobInf.getName(), "" ); wPath.setText( fullPath ); } catch ( KettleException e ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JobEntryJobDialog.Exception.UnableToReferenceObjectId.Title" ), BaseMessages.getString( PKG, "JobEntryJobDialog.Exception.UnableToReferenceObjectId.Message" ), e ); } }
/** * This method sets various internal kettle variables that can be used by the transformation. */ @Override public void setInternalKettleVariables( VariableSpace var ) { setInternalFilenameKettleVariables( var ); setInternalNameKettleVariable( var ); // The name of the directory in the repository variables .setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, directory != null ? directory.getPath() : "" ); boolean hasRepoDir = getRepositoryDirectory() != null && getRepository() != null; // setup fallbacks if ( hasRepoDir ) { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY, variables.getVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY ) ); } else { variables.setVariable( Const.INTERNAL_VARIABLE_JOB_REPOSITORY_DIRECTORY, variables.getVariable( Const.INTERNAL_VARIABLE_JOB_FILENAME_DIRECTORY ) ); } updateCurrentDir(); } // changed to protected for testing purposes
JobMeta jobMeta = (JobMeta) entry.getObject().getManagedObject(); filename = rep != null ? jobMeta.getName() : jobMeta.getFilename(); directory = jobMeta.getRepositoryDirectory().toString(); openType = LastUsedFile.OPENED_ITEM_TYPE_MASK_GRAPH; entry.setObjectName( jobMeta.getName() );
.getRepositoryDirectory(), null, null, RepositoryObjectType.JOB, null, false ) );
boolean hasRepoDir = jobMeta.getRepositoryDirectory() != null && jobMeta.getRepository() != null; .getRepositoryDirectory().getPath() : "" );
@Test public void testCurrentDirJob() throws Exception { final String dirName = "dirName"; final String jobName = "job"; JobMeta setupJobMeta = new JobMeta(); setupJobMeta.setName( jobName ); RepositoryDirectoryInterface repoDir = repository.createRepositoryDirectory( new RepositoryDirectory(), dirName ); setupJobMeta.setRepositoryDirectory( repoDir ); repository.save( setupJobMeta, "" ); JobMeta jobMeta = repository.loadJob( jobName, repoDir, null, "" ); assertEquals( repository, jobMeta.getRepository() ); assertEquals( repoDir.getPath(), jobMeta.getRepositoryDirectory().getPath() ); jobMeta.setInternalKettleVariables(); String currentDir = jobMeta.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ); assertEquals( repoDir.getPath(), currentDir ); }
if ( jobMeta != null ) { props.addLastFile( LastUsedFile.FILE_TYPE_JOB, jobMeta.getName(), jobMeta .getRepositoryDirectory().getPath(), true, rep.getName(), getUsername(), null ); saveSettings(); addMenuLast();