public Plan findPlan(final StandaloneCatalog catalog) throws CatalogApiException { if (name != null) { return catalog.findCurrentPlan(name); } else { return catalog.findCurrentPlan(productName, bp, priceListName); } } }
@Override public Plan findPlan(final String productName, final BillingPeriod term, final String priceListName, final DateTime requestedDate) throws CatalogApiException { return versionForDate(requestedDate).findCurrentPlan(productName, term, priceListName); }
@Override public Plan findCurrentPlan(final String productName, final BillingPeriod term, final String priceList) throws CatalogApiException { return versionForDate(clock.getUTCNow()).findCurrentPlan(productName, term, priceList); }
@Override public Plan findCurrentPlan(final String name) throws CatalogApiException { return versionForDate(clock.getUTCNow()).findCurrentPlan(name); }
@Override public PlanPhase findCurrentPhase(final String name) throws CatalogApiException { if (name == null || plans == null) { throw new CatalogApiException(ErrorCode.CAT_NO_SUCH_PHASE, name); } final String planName = DefaultPlanPhase.planName(name); final Plan plan = findCurrentPlan(planName); return plan.findPhase(name); }
@Override public boolean canCreatePlan(final PlanSpecifier specifier) throws CatalogApiException { final Product product = findCurrentProduct(specifier.getProductName()); final Plan plan = findCurrentPlan(specifier.getProductName(), specifier.getBillingPeriod(), specifier.getPriceListName()); final DefaultPriceList priceList = findCurrentPriceList(specifier.getPriceListName()); return (!product.isRetired()) && (!plan.isRetired()) && (!priceList.isRetired()); }