use of org.pentaho.di.plugins.fileopensave.api.providers.Tree in project pentaho-kettle by pentaho.
the class RecentFileProvider method getTree.
@Override
public Tree getTree() {
RecentTree recentTree = new RecentTree(NAME);
PropsUI propsUI = getPropsUI();
Date dateThreshold = getDateThreshold();
List<LastUsedFile> lastUsedFiles = propsUI.getLastUsedFiles().stream().filter(lastUsedFile -> !lastUsedFile.getLastOpened().before(dateThreshold)).collect(Collectors.toList());
for (LastUsedFile lastUsedFile : lastUsedFiles) {
recentTree.addChild(RecentFile.create(lastUsedFile));
}
return recentTree;
}
use of org.pentaho.di.plugins.fileopensave.api.providers.Tree in project pentaho-kettle by pentaho.
the class FileController method load.
public List<Tree> load(String filter, List<String> connectionTypes) {
List<Tree> trees = new ArrayList<>();
List<String> filters = Utils.isEmpty(filter) || filter.equalsIgnoreCase(ProviderFilterType.DEFAULT.toString()) ? Arrays.asList(ProviderFilterType.getDefaults()) : Arrays.asList(filter.split("[,]"));
// filter
if (filters.contains(ProviderFilterType.ALL_PROVIDERS.toString())) {
for (FileProvider fileProvider : providerService.get()) {
if (fileProvider.isAvailable()) {
trees.add(fileProvider.getTree(connectionTypes));
}
}
} else {
for (FileProvider fileProvider : providerService.get()) {
if (fileProvider.isAvailable() && filters.contains(fileProvider.getType())) {
trees.add(fileProvider.getTree(connectionTypes));
}
}
}
return trees;
}
Aggregations