public T getResult(final PlanSpecifier planPhase, final StandaloneCatalog c) throws CatalogApiException { if (satisfiesCase(planPhase, c)) { return getResult(); } return null; }
protected boolean satisfiesCase(final PlanSpecifier planPhase, final StandaloneCatalog c) throws CatalogApiException { return (getProduct() == null || getProduct().equals(c.findCurrentProduct(planPhase.getProductName()))) && (getProductCategory() == null || getProductCategory().equals(planPhase.getProductCategory())) && (getBillingPeriod() == null || getBillingPeriod().equals(planPhase.getBillingPeriod())) && (getPriceList() == null || getPriceList().equals(c.findCurrentPriceList(planPhase.getPriceListName()))); }
public static <K> K getResult(final Case<K>[] cases, final PlanSpecifier planSpec, final StandaloneCatalog catalog) throws CatalogApiException { if (cases != null) { for (final Case<K> c : cases) { final K result = c.getResult(planSpec, catalog); if (result != null) { return result; } } } return null; }
public PlanAlignmentCreate getPlanCreateAlignment(final PlanSpecifier specifier, final StandaloneCatalog catalog) throws CatalogApiException { return Case.getResult(createAlignmentCase, specifier, catalog); }
private DefaultPriceList findPriceList(final PlanSpecifier specifier, final StandaloneCatalog catalog) throws CatalogApiException { DefaultPriceList result = Case.getResult(priceListCase, specifier, catalog); if (result == null) { result = catalog.findCurrentPriceList(specifier.getPriceListName()); } return result; }
Result.LALA); final Result r1 = Case.getResult(new CaseResult[]{cr0, cr1, cr2, cr3}, new PlanSpecifier(product.getName(), product.getCategory(), BillingPeriod.MONTHLY, priceList.getName()), cat); Assert.assertEquals(r1, Result.FOO); final Result r2 = Case.getResult(new CaseResult[]{cr0, cr1, cr2}, new PlanSpecifier(product.getName(), product.getCategory(), BillingPeriod.ANNUAL, priceList.getName()), cat); Assert.assertEquals(r2, Result.DIPSY);