use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class SimpleMappingDialog method selectRepositoryTrans.
private void selectRepositoryTrans() {
RepositoryObject repositoryObject = DialogHelper.selectRepositoryObject("*.ktr", log);
try {
if (repositoryObject != null) {
loadRepositoryTrans(repositoryObject.getName(), repositoryObject.getRepositoryDirectory());
String path = DialogUtils.getPath(transMeta.getRepositoryDirectory().getPath(), mappingTransMeta.getRepositoryDirectory().getPath());
String fullPath = (path.equals("/") ? "/" : path + "/") + mappingTransMeta.getName();
wPath.setText(fullPath);
specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME;
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SimpleMappingDialog.ErrorSelectingObject.DialogTitle"), BaseMessages.getString(PKG, "SimpleMappingDialog.ErrorSelectingObject.DialogMessage"), ke);
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class SimpleMappingDialog method ok.
private void ok() {
if (Utils.isEmpty(wStepname.getText())) {
return;
}
// return value
stepname = wStepname.getText();
try {
loadTransformation();
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SimpleMappingDialog.ErrorLoadingSpecifiedTransformation.Title"), BaseMessages.getString(PKG, "SimpleMappingDialog.ErrorLoadingSpecifiedTransformation.Message"), e);
return;
}
mappingMeta.setSpecificationMethod(getSpecificationMethod());
switch(getSpecificationMethod()) {
case FILENAME:
mappingMeta.setFileName(wPath.getText());
mappingMeta.setDirectoryPath(null);
mappingMeta.setTransName(null);
mappingMeta.setTransObjectId(null);
break;
case REPOSITORY_BY_NAME:
String transPath = wPath.getText();
String transName = transPath;
String directory = "";
int index = transPath.lastIndexOf("/");
if (index != -1) {
transName = transPath.substring(index + 1);
directory = transPath.substring(0, index);
}
mappingMeta.setDirectoryPath(directory);
mappingMeta.setTransName(transName);
mappingMeta.setFileName(null);
mappingMeta.setTransObjectId(null);
default:
break;
}
// Load the information on the tabs, optionally do some
// verifications...
//
collectInformation();
mappingMeta.setMappingParameters(mappingParameters);
mappingMeta.setInputMapping(inputMapping);
mappingMeta.setOutputMapping(outputMapping);
mappingMeta.setChanged(true);
dispose();
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class SingleThreaderDialog method getByReferenceData.
private void getByReferenceData(ObjectId transObjectId) {
try {
RepositoryObject transInf = repository.getObjectInformation(transObjectId, RepositoryObjectType.TRANSFORMATION);
String path = DialogUtils.getPath(transMeta.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);
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class SingleThreaderDialog method selectFileTrans.
private void selectFileTrans(boolean useVfs) {
String curFile = transMeta.environmentSubstitute(wPath.getText());
if (useVfs) {
FileObject root = null;
String parentFolder = null;
try {
parentFolder = KettleVFS.getFileObject(transMeta.environmentSubstitute(transMeta.getFilename())).getParent().toString();
} catch (Exception e) {
// Take no action
}
try {
root = KettleVFS.getFileObject(curFile != null ? curFile : Const.getUserHomeDirectory());
VfsFileChooserDialog vfsFileChooser = Spoon.getInstance().getVfsFileChooserDialog(root.getParent(), root);
FileObject file = vfsFileChooser.open(shell, null, Const.STRING_TRANS_FILTER_EXT, Const.getTransformationFilterNames(), VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE);
if (file == null) {
return;
}
String fileName = file.getName().toString();
if (fileName != null) {
loadFileTrans(fileName);
if (parentFolder != null && fileName.startsWith(parentFolder)) {
fileName = fileName.replace(parentFolder, "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}");
}
wPath.setText(fileName);
specificationMethod = ObjectLocationSpecificationMethod.FILENAME;
}
} catch (IOException | KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SingleThreaderDialog.ErrorLoadingTransformation.DialogTitle"), BaseMessages.getString(PKG, "SingleThreaderDialog.ErrorLoadingTransformation.DialogMessage"), e);
}
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class SingleThreaderDialog method ok.
private void ok() {
if (Utils.isEmpty(wStepname.getText())) {
return;
}
// return value
stepname = wStepname.getText();
try {
getInfo(singleThreaderMeta);
loadTransformation();
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SingleThreaderDialog.ErrorLoadingSpecifiedTransformation.Title"), BaseMessages.getString(PKG, "SingleThreaderDialog.ErrorLoadingSpecifiedTransformation.Message"), e);
}
dispose();
}
Aggregations