throw new ImportConflictException(conflictExceptions);
}
// If the consumer has no entitlements, this products directory will end up empty.
// This also implies there will be no entitlements to import.
Refresher refresher = poolManager.getRefresher();
Meta meta = mapper.readValue(metadata, Meta.class);
if (importFiles.get(ImportFile.PRODUCTS.fileName()) != null) {
ProductImporter importer = new ProductImporter(productCurator, contentCurator);
Set<Product> productsToImport = importProducts(
importFiles.get(ImportFile.PRODUCTS.fileName()).listFiles(),
importer);
Set<Product> modifiedProducts = importer.getChangedProducts(productsToImport);
for (Product product : modifiedProducts) {
refresher.add(product);
}
importer.store(productsToImport);
meta = mapper.readValue(metadata, Meta.class);
importEntitlements(owner, productsToImport, entitlements.listFiles(),
consumer, meta);
refresher.add(owner);
refresher.run();
}
else {
log.warn("No products found to import, skipping product import.");
log.warn("No entitlements in manifest, removing all subscriptions for owner.");
importEntitlements(owner, new HashSet<Product>(), new File[]{}, consumer, meta);
refresher.add(owner);
refresher.run();
}
return consumer;
}