use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class MetaInjectDialog 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(), injectTransMeta.getRepositoryDirectory().getPath());
String fullPath = (path.equals("/") ? "/" : path + "/") + injectTransMeta.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);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class MappingDialog 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, "MappingDialog.ErrorSelectingObject.DialogTitle"), BaseMessages.getString(PKG, "MappingDialog.ErrorSelectingObject.DialogMessage"), ke);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobEntryJobDialog method selectJob.
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);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobEntryJobDialog method getByReferenceData.
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);
}
}
use of org.pentaho.di.repository.RepositoryObject in project pdi-dataservice-server-plugin by pentaho.
the class ServiceTransTest method testRepoPathStorageMethod.
@Test
public void testRepoPathStorageMethod() throws KettleException {
ObjectId transId = new StringObjectId("transId");
when(repository.loadTransformation(eq(transId), isNull(String.class))).thenReturn(transMeta);
RepositoryDirectoryInterface root = mock(RepositoryDirectoryInterface.class);
ObjectId rootId = new StringObjectId("dirId");
when(root.getObjectId()).thenReturn(rootId);
when(repository.loadRepositoryDirectoryTree()).thenReturn(root);
RepositoryDirectoryInterface dir = mock(RepositoryDirectoryInterface.class);
when(root.findDirectory(eq("/existing"))).thenReturn(dir, null);
when(repository.getTransformationID(eq("Trans"), eq(dir))).thenReturn(null);
RepositoryElementMetaInterface transInfo = mock(RepositoryElementMetaInterface.class);
when(transInfo.getName()).thenReturn("Trans");
when(transInfo.getObjectId()).thenReturn(transId);
when(repository.getTransformationObjects(eq(rootId), eq(true))).thenReturn(Arrays.asList(transInfo));
ServiceTrans.StorageMethod method = ServiceTrans.StorageMethod.REPO_PATH;
assertThat(method.exists(repository, "/existing/Trans"), is(true));
RepositoryObject transObjectInfo = mock(RepositoryObject.class);
when(transObjectInfo.isDeleted()).thenReturn(false, true);
when(repository.getObjectInformation(eq(transId), eq(RepositoryObjectType.TRANSFORMATION))).thenReturn(transObjectInfo);
assertThat(method.load(repository, "/existing/Trans"), is(transMeta));
assertThat(method.load(repository, "/existing/Trans"), is(nullValue()));
}
Aggregations