Package org.candlepin.controller

Examples of org.candlepin.controller.Refresher


            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;
    }
View Full Code Here

TOP

Related Classes of org.candlepin.controller.Refresher

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.