public StandaloneCatalog toStandaloneCatalog(final StandalonePluginCatalog pluginCatalog) { final StandaloneCatalog result = new StandaloneCatalog(); result.setCatalogName(catalogName); result.setEffectiveDate(pluginCatalog.getEffectiveDate().toDate()); result.setProducts(toDefaultProducts(pluginCatalog.getProducts())); result.setPlans(toDefaultPlans(result, pluginCatalog.getPlans())); result.setPriceLists(toDefaultPriceListSet(pluginCatalog.getDefaultPriceList(), pluginCatalog.getChildrenPriceList())); result.setSupportedCurrencies(toArray(pluginCatalog.getCurrencies())); result.setUnits(toDefaultUnits(pluginCatalog.getUnits())); result.setPlanRules(toDefaultPlanRules(pluginCatalog.getPlanRules())); for (final Product cur : pluginCatalog.getProducts()) { final Product target = result.getCatalogEntityCollectionProduct().findByName(cur.getName()); if (target != null) { ((DefaultProduct) target).setAvailable(toFilteredDefaultProduct(cur.getAvailable())); ((DefaultProduct) target).setIncluded(toFilteredDefaultProduct(cur.getIncluded())); } } result.initialize(result); return result; }
public StandaloneCatalog toStandaloneCatalog(final StandalonePluginCatalog pluginCatalog) { final StandaloneCatalog result = new StandaloneCatalog(); result.setCatalogName(catalogName); result.setEffectiveDate(pluginCatalog.getEffectiveDate().toDate()); result.setProducts(toDefaultProducts(pluginCatalog.getProducts())); result.setPlans(toDefaultPlans(result, pluginCatalog.getPlans())); result.setPriceLists(toDefaultPriceListSet(pluginCatalog.getDefaultPriceList(), pluginCatalog.getChildrenPriceList())); result.setSupportedCurrencies(toArray(pluginCatalog.getCurrencies())); result.setUnits(toDefaultUnits(pluginCatalog.getUnits())); result.setPlanRules(toDefaultPlanRules(pluginCatalog.getPlanRules())); for (final Product cur : pluginCatalog.getProducts()) { final Product target = result.getCatalogEntityCollectionProduct().findByName(cur.getName()); if (target != null) { ((DefaultProduct) target).setAvailable(toFilteredDefaultProduct(cur.getAvailable())); ((DefaultProduct) target).setIncluded(toFilteredDefaultProduct(cur.getIncluded())); } } result.initialize(result); return result; }