use of org.kie.workbench.common.services.datamodel.spi.DataModelExtension in project kie-wb-common by kiegroup.
the class LRUDataModelOracleCache method loadExtensionsForPackage.
private void loadExtensionsForPackage(final PackageDataModelOracleBuilder dmoBuilder, final Package pkg) {
final org.uberfire.java.nio.file.Path nioPackagePath = Paths.convert(pkg.getPackageMainResourcesPath());
List<DataModelExtension> extensions = stream(dataModelExtensionsProvider.spliterator(), false).collect(toList());
for (final DataModelExtension extension : extensions) {
Filter<org.uberfire.java.nio.file.Path> filter = extension.getFilter();
final Collection<org.uberfire.java.nio.file.Path> extensionFiles = fileDiscoveryService.discoverFiles(nioPackagePath, filter);
extensionFiles.stream().map(file -> extension.getExtensions(file, ioService.readAllString(file))).forEach(mappings -> mappings.forEach(mapping -> dmoBuilder.addExtension(mapping.getKind(), mapping.getValues())));
}
}
Aggregations