public static <K> K getResult(final DefaultCase<K>[] cases, final PlanSpecifier planSpec, final StaticCatalog catalog) throws CatalogApiException { if (cases != null) { for (final DefaultCase<K> c : cases) { final K result = c.getResult(planSpec, catalog); if (result != null) { return result; } } } return null; }
public T getResult(final PlanSpecifier planPhase, final StaticCatalog c) throws CatalogApiException { if (satisfiesCase(planPhase, c)) { return getResult(); } return null; }
protected boolean satisfiesCase(final PlanSpecifier planPhase, final StaticCatalog c) throws CatalogApiException { final Product product; final BillingPeriod billingPeriod; final ProductCategory productCategory; final PriceList priceList; if (planPhase.getPlanName() != null) { final Plan plan = c.findCurrentPlan(planPhase.getPlanName()); product = plan.getProduct(); billingPeriod = plan.getRecurringBillingPeriod(); productCategory = plan.getProduct().getCategory(); priceList = c.findCurrentPricelist(plan.getPriceListName()); } else { product = c.findCurrentProduct(planPhase.getProductName()); billingPeriod = planPhase.getBillingPeriod(); productCategory = product.getCategory(); priceList = getPriceList() != null ? c.findCurrentPricelist(planPhase.getPriceListName()) : null; } return (getProduct() == null || getProduct().equals(product)) && (getProductCategory() == null || getProductCategory().equals(productCategory)) && (getBillingPeriod() == null || getBillingPeriod().equals(billingPeriod)) && (getPriceList() == null || getPriceList().equals(priceList)); }
protected boolean satisfiesCase(final PlanSpecifier planPhase, final StaticCatalog c) throws CatalogApiException { final Product product; final BillingPeriod billingPeriod; final ProductCategory productCategory; final PriceList priceList; if (planPhase.getPlanName() != null) { final Plan plan = c.findCurrentPlan(planPhase.getPlanName()); product = plan.getProduct(); billingPeriod = plan.getRecurringBillingPeriod(); productCategory = plan.getProduct().getCategory(); priceList = c.findCurrentPricelist(plan.getPriceListName()); } else { product = c.findCurrentProduct(planPhase.getProductName()); billingPeriod = planPhase.getBillingPeriod(); productCategory = product.getCategory(); priceList = getPriceList() != null ? c.findCurrentPricelist(planPhase.getPriceListName()) : null; } return (getProduct() == null || getProduct().equals(product)) && (getProductCategory() == null || getProductCategory().equals(productCategory)) && (getBillingPeriod() == null || getBillingPeriod().equals(billingPeriod)) && (getPriceList() == null || getPriceList().equals(priceList)); }
public PlanAlignmentCreate getPlanCreateAlignment(final PlanSpecifier specifier, final StaticCatalog catalog) throws CatalogApiException { final PlanAlignmentCreate result = DefaultCase.getResult(createAlignmentCase, specifier, catalog); return (result != null) ? result : PlanAlignmentCreate.START_OF_BUNDLE; }
public T getResult(final PlanSpecifier planPhase, final StaticCatalog c) throws CatalogApiException { if (satisfiesCase(planPhase, c)) { return getResult(); } return null; }
Result.LALA); final Result r1 = DefaultCase.getResult(new DefaultCaseResult[]{cr0, cr1, cr2, cr3}, new PlanSpecifier(product.getName(), BillingPeriod.MONTHLY, priceList.getName()), cat); Assert.assertEquals(r1, Result.FOO); final Result r2 = DefaultCase.getResult(new DefaultCaseResult[]{cr0, cr1, cr2}, new PlanSpecifier(product.getName(), BillingPeriod.ANNUAL, priceList.getName()), cat); Assert.assertEquals(r2, Result.DIPSY);
public static <K> K getResult(final DefaultCase<K>[] cases, final PlanSpecifier planSpec, final StaticCatalog catalog) throws CatalogApiException { if (cases != null) { for (final DefaultCase<K> c : cases) { final K result = c.getResult(planSpec, catalog); if (result != null) { return result; } } } return null; }
public PlanAlignmentCreate getPlanCreateAlignment(final PlanSpecifier specifier, final StaticCatalog catalog) throws CatalogApiException { final PlanAlignmentCreate result = DefaultCase.getResult(createAlignmentCase, specifier, catalog); return (result != null) ? result : PlanAlignmentCreate.START_OF_BUNDLE; }
Result.LALA); final Result r1 = DefaultCase.getResult(new DefaultCaseResult[]{cr0, cr1, cr2, cr3}, new PlanSpecifier(product.getName(), BillingPeriod.MONTHLY, priceList.getName()), cat); Assert.assertEquals(r1, Result.FOO); final Result r2 = DefaultCase.getResult(new DefaultCaseResult[]{cr0, cr1, cr2}, new PlanSpecifier(product.getName(), BillingPeriod.ANNUAL, priceList.getName()), cat); Assert.assertEquals(r2, Result.DIPSY);