Search in sources :

Example 6 with RepositoryDirectory

use of org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory in project pentaho-kettle by pentaho.

the class RepositoryBrowserController method search.

public List<org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryObject> search(String path, String filter) {
    RepositoryDirectoryInterface repositoryDirectoryInterface = findDirectory(path);
    List<org.pentaho.di.plugins.fileopensave.providers.repository.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().getId());
            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().getId());
            repositoryObjects.add(repositoryFile);
        }
    }
    return repositoryObjects;
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) RepositoryDirectory(org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory) RepositoryObject(org.pentaho.di.repository.RepositoryObject) ArrayList(java.util.ArrayList) RepositoryObjectInterface(org.pentaho.di.repository.RepositoryObjectInterface) RepositoryExtended(org.pentaho.di.repository.RepositoryExtended) RepositoryFile(org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryFile)

Aggregations

RepositoryDirectory (org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory)6 KettleException (org.pentaho.di.core.exception.KettleException)3 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)3 KettleJobException (org.pentaho.di.core.exception.KettleJobException)2 KettleObjectExistsException (org.pentaho.di.core.exception.KettleObjectExistsException)2 KettleTransException (org.pentaho.di.core.exception.KettleTransException)2 FileException (org.pentaho.di.plugins.fileopensave.api.providers.exception.FileException)2 FileExistsException (org.pentaho.di.plugins.fileopensave.api.providers.exception.FileExistsException)2 InvalidFileOperationException (org.pentaho.di.plugins.fileopensave.api.providers.exception.InvalidFileOperationException)2 InvalidFileTypeException (org.pentaho.di.plugins.fileopensave.api.providers.exception.InvalidFileTypeException)2 RepositoryFile (org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryFile)2 RepositoryExtended (org.pentaho.di.repository.RepositoryExtended)2 ArrayList (java.util.ArrayList)1 RepositoryTree (org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryTree)1 RepositoryObject (org.pentaho.di.repository.RepositoryObject)1 RepositoryObjectInterface (org.pentaho.di.repository.RepositoryObjectInterface)1 RepositoryFileTree (org.pentaho.platform.api.repository2.unified.RepositoryFileTree)1 RepositoryRequest (org.pentaho.platform.api.repository2.unified.RepositoryRequest)1