use of org.guvnor.common.services.backend.file.LinkedFilter in project drools-wb by kiegroup.
the class ScenarioLoader method loadScenarioPaths.
private List<Path> loadScenarioPaths(final Path path) {
// Check Path exists
final List<Path> items = new ArrayList<Path>();
if (!Files.exists(Paths.convert(path))) {
return items;
}
// Ensure Path represents a Folder
org.uberfire.java.nio.file.Path pPath = Paths.convert(path);
if (!Files.isDirectory(pPath)) {
pPath = pPath.getParent();
}
LinkedFilter filter = new LinkedDotFileFilter();
LinkedFilter metaInfFolderFilter = new LinkedMetaInfFolderFilter();
filter.setNextFilter(metaInfFolderFilter);
FileExtensionFilter fileExtensionFilter = new FileExtensionFilter(".scenario");
// Get list of immediate children
final DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream = ioService.newDirectoryStream(pPath);
for (final org.uberfire.java.nio.file.Path p : directoryStream) {
if (filter.accept(p) && fileExtensionFilter.accept(p)) {
if (Files.isRegularFile(p)) {
items.add(Paths.convert(p));
} else if (Files.isDirectory(p)) {
items.add(Paths.convert(p));
}
}
}
return items;
}
Aggregations