Search in sources :

Example 41 with RepositoryObject

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);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog)

Example 42 with RepositoryObject

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);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog)

Example 43 with RepositoryObject

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);
    }
}
Also used : RepositoryObject(org.pentaho.di.repository.RepositoryObject)

Example 44 with RepositoryObject

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);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryObject(org.pentaho.di.repository.RepositoryObject) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog)

Example 45 with RepositoryObject

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()));
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) RepositoryObject(org.pentaho.di.repository.RepositoryObject) ObjectId(org.pentaho.di.repository.ObjectId) StringObjectId(org.pentaho.di.repository.StringObjectId) StringObjectId(org.pentaho.di.repository.StringObjectId) RepositoryElementMetaInterface(org.pentaho.di.repository.RepositoryElementMetaInterface) Test(org.junit.Test)

Aggregations

RepositoryObject (org.pentaho.di.repository.RepositoryObject)46 KettleException (org.pentaho.di.core.exception.KettleException)31 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)15 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)11 StringObjectId (org.pentaho.di.repository.StringObjectId)9 ObjectId (org.pentaho.di.repository.ObjectId)7 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 Test (org.junit.Test)6 KettleFileException (org.pentaho.di.core.exception.KettleFileException)5 RepositoryElementMetaInterface (org.pentaho.di.repository.RepositoryElementMetaInterface)5 IOException (java.io.IOException)4 FileSystemException (org.apache.commons.vfs2.FileSystemException)4 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 FileDialogOperation (org.pentaho.di.ui.core.FileDialogOperation)4 FileObject (org.apache.commons.vfs2.FileObject)3 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)3 RepositoryObjectInterface (org.pentaho.di.repository.RepositoryObjectInterface)3 Serializable (java.io.Serializable)2 List (java.util.List)2