public boolean isAddonIncluded(final Product baseProduct, final Plan targetAddOnPlan) { final Product targetAddonProduct = targetAddOnPlan.getProduct(); final Collection<Product> includedAddOns = baseProduct.getIncluded(); for (final Product curAv : includedAddOns) { if (curAv.getName().equals(targetAddonProduct.getName())) { return true; } } return false; }
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 boolean isAddonIncluded(final Product baseProduct, final Plan targetAddOnPlan) { final Product targetAddonProduct = targetAddOnPlan.getProduct(); final Collection<Product> includedAddOns = baseProduct.getIncluded(); for (final Product curAv : includedAddOns) { if (curAv.getName().equals(targetAddonProduct.getName())) { return true; } } return false; }
public ProductJson(final Product product) { this.type = product.getCategory().toString(); this.name = product.getName(); this.prettyName = product.getPrettyName(); this.plans = new LinkedList<PlanJson>(); this.included = toProductNames(product.getIncluded()); this.available = toProductNames(product.getAvailable()); }
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; }