Skip to content

Commit

Permalink
[BACKLOG-12418] Use variable for common root on reference conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Morrise committed Jan 19, 2017
1 parent 1f6e6f3 commit 4d27aab
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
Expand Up @@ -102,7 +102,7 @@ JobTrans.EnvironmentType.Group.Label=Environment Type
JobTrans.Local.Option.Label=Local
JobTrans.Server.Option.Label=Server
JobTrans.Server.Label=Server\:
JobTrans.Clustered.Option.Label=Custered
JobTrans.Clustered.Option.Label=Clustered
JobTrans.Clustered.Label=This will execute the transformation in a clustered environment.
JobTrans.Local.Label=This transformation will run on the machine you are using.
JobTrans.Execution.Group.Label=Execution
Expand Down
Expand Up @@ -247,11 +247,7 @@ protected void selectJob() {
SelectObjectDialog sod = new SelectObjectDialog( shell, rep, false, true );
String jobname = sod.open();
if ( jobname != null ) {
String path = sod.getDirectory().getPath();
String parentPath = this.jobMeta.getRepositoryDirectory().getPath();
if ( path.startsWith( parentPath ) ) {
path = path.replace( parentPath, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" );
}
String path = getPath( sod.getDirectory().getPath() );
String fullPath = path + "/" + jobname;
wPath.setText( fullPath );
specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME;
Expand Down Expand Up @@ -446,8 +442,9 @@ public void getData() {
private void getByReferenceData( ObjectId referenceObjectId ) {
try {
RepositoryObject jobInf = rep.getObjectInformation( referenceObjectId, RepositoryObjectType.JOB );
String path = getPath( jobInf.getRepositoryDirectory().getPath() );
String fullPath =
Const.NVL( jobInf.getRepositoryDirectory().getPath(), "" ) + "/" + Const.NVL( jobInf.getName(), "" );
Const.NVL( path, "" ) + "/" + Const.NVL( jobInf.getName(), "" );
wPath.setText( fullPath );
} catch ( KettleException e ) {
new ErrorDialog( shell,
Expand Down
Expand Up @@ -771,6 +771,14 @@ protected void selectLogFile( String[] filters ) {
}
}

protected String getPath( String path ) {
String parentPath = this.jobMeta.getRepositoryDirectory().getPath();
if ( path.startsWith( parentPath ) ) {
path = path.replace( parentPath, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" );
}
return path;
}

protected void setRadioButtons() {
wLocal.setVisible( wbLocal.getSelection() );
wServer.setVisible( wbServer.getSelection() );
Expand Down
Expand Up @@ -181,10 +181,10 @@ public void widgetSelected( SelectionEvent e ) {
props.setLook( wlClusteredDescription );
wlClusteredDescription.setText( BaseMessages.getString( PKG, "JobTrans.Clustered.Label" ) );
wlClusteredDescription.setVisible( true );
FormData fdlCusteredDescription = new FormData();
fdlCusteredDescription.top = new FormAttachment( 0, 0 );
fdlCusteredDescription.left = new FormAttachment( 0, 0 );
wlClusteredDescription.setLayoutData( fdlCusteredDescription );
FormData fdlClusteredDescription = new FormData();
fdlClusteredDescription.top = new FormAttachment( 0, 0 );
fdlClusteredDescription.left = new FormAttachment( 0, 0 );
wlClusteredDescription.setLayoutData( fdlClusteredDescription );

wClearRows = new Button( gExecution, SWT.CHECK );
props.setLook( wClearRows );
Expand Down Expand Up @@ -290,11 +290,7 @@ protected void selectTransformation() {
SelectObjectDialog sod = new SelectObjectDialog( shell, rep, true, false );
String transname = sod.open();
if ( transname != null ) {
String path = sod.getDirectory().getPath();
String parentPath = this.jobMeta.getRepositoryDirectory().getPath();
if ( path.startsWith( parentPath ) ) {
path = path.replace( parentPath, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}" );
}
String path = getPath( sod.getDirectory().getPath() );
String fullPath = path + "/" + transname;
wPath.setText( fullPath );
}
Expand Down Expand Up @@ -473,8 +469,9 @@ public void getData() {
private void getByReferenceData( ObjectId transObjectId ) {
try {
RepositoryObject transInf = rep.getObjectInformation( transObjectId, RepositoryObjectType.TRANSFORMATION );
String path = getPath( transInf.getRepositoryDirectory().getPath() );
String fullPath =
Const.NVL( transInf.getRepositoryDirectory().getPath(), "" ) + "/" + Const.NVL( transInf.getName(), "" );
Const.NVL( path, "" ) + "/" + Const.NVL( transInf.getName(), "" );
wPath.setText( fullPath );
} catch ( KettleException e ) {
new ErrorDialog( shell,
Expand Down

0 comments on commit 4d27aab

Please sign in to comment.