Search in sources :

Example 1 with RepositoryDirectory

use of org.pentaho.repo.model.RepositoryDirectory in project pentaho-kettle by pentaho.

the class RepositoryBrowserController method loadFolders.

public RepositoryDirectory loadFolders(String path) {
    RepositoryDirectoryInterface repositoryDirectoryInterface = findDirectory(path);
    RepositoryDirectory repositoryDirectory = RepositoryDirectory.build(null, repositoryDirectoryInterface);
    populateFolders(repositoryDirectory, repositoryDirectoryInterface);
    return repositoryDirectory;
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) RepositoryDirectory(org.pentaho.repo.model.RepositoryDirectory)

Example 2 with RepositoryDirectory

use of org.pentaho.repo.model.RepositoryDirectory in project pentaho-kettle by pentaho.

the class RepositoryBrowserController method create.

public RepositoryDirectory create(String parent, String name) {
    if (hasDupeFolder(parent, name)) {
        return null;
    }
    try {
        RepositoryDirectoryInterface repositoryDirectoryInterface = getRepository().createRepositoryDirectory(findDirectory(parent), name);
        RepositoryDirectory repositoryDirectory = new RepositoryDirectory();
        repositoryDirectory.setName(repositoryDirectoryInterface.getName());
        repositoryDirectory.setPath(repositoryDirectoryInterface.getPath());
        repositoryDirectory.setObjectId(repositoryDirectoryInterface.getObjectId());
        repositoryDirectory.setParent(parent);
        return repositoryDirectory;
    } catch (Exception e) {
        return null;
    }
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) RepositoryDirectory(org.pentaho.repo.model.RepositoryDirectory) KettleException(org.pentaho.di.core.exception.KettleException) KettleObjectExistsException(org.pentaho.di.core.exception.KettleObjectExistsException) KettleTransException(org.pentaho.di.core.exception.KettleTransException) KettleJobException(org.pentaho.di.core.exception.KettleJobException)

Example 3 with RepositoryDirectory

use of org.pentaho.repo.model.RepositoryDirectory in project pentaho-kettle by pentaho.

the class RepositoryBrowserController method search.

public List<org.pentaho.repo.model.RepositoryObject> search(String path, String filter) {
    RepositoryDirectoryInterface repositoryDirectoryInterface = findDirectory(path);
    List<org.pentaho.repo.model.RepositoryObject> repositoryObjects = new ArrayList<>();
    List<RepositoryObjectInterface> repositoryObjects1 = ((RepositoryExtended) getRepository()).getChildren(repositoryDirectoryInterface.getObjectId().getId(), filter);
    for (RepositoryObjectInterface repositoryObject : repositoryObjects1) {
        if (repositoryObject instanceof RepositoryDirectoryInterface) {
            RepositoryDirectory repositoryDirectory = new RepositoryDirectory();
            repositoryDirectory.setPath(path + "/" + repositoryObject.getName());
            repositoryDirectory.setName(repositoryObject.getName());
            repositoryDirectory.setObjectId(repositoryObject.getObjectId());
            repositoryObjects.add(repositoryDirectory);
        } else {
            RepositoryFile repositoryFile = new RepositoryFile();
            repositoryFile.setPath(path + "/" + repositoryObject.getName());
            repositoryFile.setName(repositoryObject.getName());
            repositoryFile.setType(((RepositoryObject) repositoryObject).getObjectType() == RepositoryObjectType.TRANSFORMATION ? TRANSFORMATION : JOB);
            repositoryFile.setObjectId(repositoryObject.getObjectId());
            repositoryObjects.add(repositoryFile);
        }
    }
    return repositoryObjects;
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) RepositoryDirectory(org.pentaho.repo.model.RepositoryDirectory) RepositoryObject(org.pentaho.di.repository.RepositoryObject) ArrayList(java.util.ArrayList) RepositoryExtended(org.pentaho.di.repository.RepositoryExtended) RepositoryFile(org.pentaho.repo.model.RepositoryFile) RepositoryObjectInterface(org.pentaho.di.repository.RepositoryObjectInterface)

Example 4 with RepositoryDirectory

use of org.pentaho.repo.model.RepositoryDirectory in project pentaho-kettle by pentaho.

the class RepositoryBrowserController method loadDirectoryTree.

public RepositoryTree loadDirectoryTree(String filter) {
    if (getRepository() != null) {
        try {
            if (getRepository() instanceof RepositoryExtended) {
                rootDirectory = ((RepositoryExtended) getRepository()).loadRepositoryDirectoryTree(false);
            } else {
                rootDirectory = getRepository().loadRepositoryDirectoryTree();
            }
            RepositoryTree repositoryTree = new RepositoryTree();
            RepositoryDirectory repositoryDirectory = RepositoryDirectory.build(null, rootDirectory);
            populateFolders(repositoryDirectory, rootDirectory);
            boolean isPentahoRepository = getRepository().getRepositoryMeta().getId().equals(PENTAHO_ENTERPRISE_REPOSITORY);
            repositoryTree.setIncludeRoot(!isPentahoRepository);
            repositoryTree.addChild(repositoryDirectory);
            return repositoryTree;
        } catch (Exception e) {
            return null;
        }
    }
    return null;
}
Also used : RepositoryDirectory(org.pentaho.repo.model.RepositoryDirectory) RepositoryExtended(org.pentaho.di.repository.RepositoryExtended) RepositoryTree(org.pentaho.repo.model.RepositoryTree) KettleException(org.pentaho.di.core.exception.KettleException) KettleObjectExistsException(org.pentaho.di.core.exception.KettleObjectExistsException) KettleTransException(org.pentaho.di.core.exception.KettleTransException) KettleJobException(org.pentaho.di.core.exception.KettleJobException)

Example 5 with RepositoryDirectory

use of org.pentaho.repo.model.RepositoryDirectory in project pentaho-kettle by pentaho.

the class RepositoryBrowserController method loadFiles.

public RepositoryDirectory loadFiles(String path) {
    RepositoryDirectoryInterface repositoryDirectoryInterface = findDirectory(path);
    RepositoryDirectory repositoryDirectory = RepositoryDirectory.build(null, repositoryDirectoryInterface);
    try {
        populateFiles(repositoryDirectory, repositoryDirectoryInterface, FILTER);
    } catch (KettleException ke) {
        ke.printStackTrace();
    }
    return repositoryDirectory;
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) KettleException(org.pentaho.di.core.exception.KettleException) RepositoryDirectory(org.pentaho.repo.model.RepositoryDirectory)

Aggregations

RepositoryDirectory (org.pentaho.repo.model.RepositoryDirectory)6 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)5 KettleException (org.pentaho.di.core.exception.KettleException)4 KettleJobException (org.pentaho.di.core.exception.KettleJobException)2 KettleObjectExistsException (org.pentaho.di.core.exception.KettleObjectExistsException)2 KettleTransException (org.pentaho.di.core.exception.KettleTransException)2 RepositoryExtended (org.pentaho.di.repository.RepositoryExtended)2 ArrayList (java.util.ArrayList)1 RepositoryObject (org.pentaho.di.repository.RepositoryObject)1 RepositoryObjectInterface (org.pentaho.di.repository.RepositoryObjectInterface)1 RepositoryFile (org.pentaho.repo.model.RepositoryFile)1 RepositoryTree (org.pentaho.repo.model.RepositoryTree)1