use of org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method getFiles.
@Override
public List<RepositoryFile> getFiles(RepositoryFile file, String filters) {
RepositoryDirectoryInterface repositoryDirectoryInterface = findDirectory(file.getType().equalsIgnoreCase(RepositoryDirectory.DIRECTORY) ? file.getPath() : file.getParent());
RepositoryDirectory repositoryDirectory = RepositoryDirectory.build(null, repositoryDirectoryInterface);
populateFolders(repositoryDirectory, repositoryDirectoryInterface);
try {
populateFiles(repositoryDirectory, repositoryDirectoryInterface, FILTER);
} catch (KettleException ke) {
ke.printStackTrace();
}
return repositoryDirectory.getChildren();
}
use of org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method loadDirectoryTree.
public RepositoryTree loadDirectoryTree() {
if (getRepository() != null) {
try {
if (getRepository() instanceof RepositoryExtended) {
rootDirectory = ((RepositoryExtended) getRepository()).loadRepositoryDirectoryTree(false);
} else {
rootDirectory = getRepository().loadRepositoryDirectoryTree();
}
RepositoryTree repositoryTree = new RepositoryTree(null);
RepositoryDirectory repositoryDirectory = RepositoryDirectory.build(null, rootDirectory);
populateFolders(repositoryDirectory, rootDirectory);
boolean isPentahoRepository = getRepository().getRepositoryMeta().getId().equals(PENTAHO_ENTERPRISE_REPOSITORY);
if (!isPentahoRepository) {
populateFiles(repositoryDirectory, rootDirectory, FILTER);
}
for (RepositoryFile child : repositoryDirectory.getChildren()) {
repositoryTree.addChild(child);
}
return repositoryTree;
} catch (Exception e) {
return null;
}
}
return null;
}
use of org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method getParent.
@Override
public RepositoryFile getParent(RepositoryFile file) {
RepositoryDirectory repositoryDirectory = new RepositoryDirectory();
repositoryDirectory.setPath(file.getParent());
return repositoryDirectory;
}
use of org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method add.
@Override
public RepositoryFile add(RepositoryFile folder) throws FileException {
if (hasDupeFolder(folder.getParent(), folder.getName())) {
throw new FileExistsException();
}
try {
RepositoryDirectoryInterface repositoryDirectoryInterface = getRepository().createRepositoryDirectory(findDirectory(folder.getParent()), folder.getName());
RepositoryDirectory repositoryDirectory = new RepositoryDirectory();
repositoryDirectory.setName(repositoryDirectoryInterface.getName());
repositoryDirectory.setPath(repositoryDirectoryInterface.getPath());
repositoryDirectory.setObjectId(repositoryDirectoryInterface.getObjectId().getId());
repositoryDirectory.setParent(folder.getParent());
return RepositoryDirectory.build(folder.getPath(), repositoryDirectoryInterface);
} catch (Exception e) {
return null;
}
}
use of org.pentaho.di.plugins.fileopensave.providers.repository.model.RepositoryDirectory in project pentaho-kettle by pentaho.
the class RepositoryFileProvider method populateFoldersLazy.
public void populateFoldersLazy(RepositoryDirectory repositoryDirectory) {
RepositoryRequest repositoryRequest = new RepositoryRequest(repositoryDirectory.getPath(), true, 1, null);
repositoryRequest.setTypes(RepositoryRequest.FILES_TYPE_FILTER.FOLDERS);
repositoryRequest.setIncludeSystemFolders(false);
RepositoryFileTree tree = getRepository().getUnderlyingRepository().getTree(repositoryRequest);
for (RepositoryFileTree repositoryFileTree : tree.getChildren()) {
org.pentaho.platform.api.repository2.unified.RepositoryFile repositoryFile = repositoryFileTree.getFile();
RepositoryDirectory repositoryDirectory1 = RepositoryDirectory.build(repositoryDirectory.getPath(), repositoryFile, isAdmin());
repositoryDirectory.addChild(repositoryDirectory1);
}
}
Aggregations