@Override public boolean apply(final SubscriptionBase input) { return ProductCategory.BASE.equals(input.getCategory()); } });
@Override public int hashCode() { int result = name != null ? name.hashCode() : 0; result = 31 * result + (retired != null ? retired.hashCode() : 0); result = 31 * result + (category != null ? category.hashCode() : 0); result = 31 * result + (included != null ? Arrays.hashCode(included) : 0); result = 31 * result + (available != null ? Arrays.hashCode(available) : 0); result = 31 * result + (limits != null ? Arrays.hashCode(limits) : 0); result = 31 * result + (catalogName != null ? catalogName.hashCode() : 0); return result; } }
@Override public String toString() { return eventType.toString() + "_" + (category == null ? MISC : category.toString().toUpperCase()); }
@Override public Entitlement doOperation(final CallContext ctx) throws InterruptedException, TimeoutException, EntitlementApiException { final PlanPhaseSpecifier spec = new PlanPhaseSpecifier(entitlement.getProductName(), ProductCategory.valueOf(entitlement.getProductCategory()), BillingPeriod.valueOf(entitlement.getBillingPeriod()), entitlement.getPriceList(), null); final UUID accountId = entitlement.getAccountId() != null ? UUID.fromString(entitlement.getAccountId()) : null; final LocalDate inputLocalDate = toLocalDate(accountId, requestedDate, callContext); final UUID bundleId = entitlement.getBundleId() != null ? UUID.fromString(entitlement.getBundleId()) : null; return (entitlement.getProductCategory().equals(ProductCategory.ADD_ON.toString())) ? entitlementApi.addEntitlement(bundleId, spec, inputLocalDate, callContext) : entitlementApi.createBaseEntitlement(accountId, spec, entitlement.getExternalKey(), inputLocalDate, callContext); }
public static BusinessSubscriptionEvent valueOf(final String eventString) { for (final EventType possibleEventType : EventType.values()) { if (!eventString.startsWith(possibleEventType.toString().toUpperCase())) { continue; } final String categoryString = eventString.substring(possibleEventType.toString().length() + 1, eventString.length()); if (categoryString.equals(MISC)) { return new BusinessSubscriptionEvent(possibleEventType, null); } else { return new BusinessSubscriptionEvent(possibleEventType, ProductCategory.valueOf(categoryString)); } } throw new IllegalArgumentException("Unable to parse event string: " + eventString); }
this.startDate = subscription.getEffectiveStartDate(); this.productName = subscription.getLastActiveProduct().getName(); this.productCategory = subscription.getLastActiveProductCategory().name(); this.billingPeriod = subscription.getLastActivePlan().getBillingPeriod().toString(); this.priceList = subscription.getLastActivePriceList().getName();
r.getString(9), // productName r.getString(10), // productType r.getString(11) == null ? null : ProductCategory.valueOf(r.getString(11)), // productCategory r.getString(12), // slug r.getString(13), // phase r.getString(18), // currency r.getLong(19) == 0 ? null : new DateTime(r.getLong(19), DateTimeZone.UTC), // startDate r.getString(20) == null ? null : SubscriptionState.valueOf(r.getString(20)) // state );
@Override public boolean apply(final Entitlement entitlement) { return !ProductCategory.ADD_ON.equals(entitlement.getLastActiveProductCategory()); } });
ProductJson productJson = productMap.get(product.getName()); if (productJson == null) { productJson = new ProductJson(product.getCategory().toString(), product.getName(), toProductNames(product.getIncluded()),
@Override public int hashCode() { int result = eventType != null ? eventType.hashCode() : 0; result = 31 * result + (category != null ? category.hashCode() : 0); return result; } }
@Override public boolean apply(final SubscriptionBase input) { return ProductCategory.BASE.equals(input.getLastActiveProduct().getCategory()); } }).orNull();
public BusinessInvoiceItemModelDao(@Nullable final String externalKey, final InvoiceItem invoiceItem, @Nullable final Plan plan, @Nullable final PlanPhase planPhase) { this(invoiceItem.getAmount(), planPhase != null ? planPhase.getBillingPeriod().toString() : null, invoiceItem.getCreatedDate(), invoiceItem.getCurrency(), /* Populate end date for fixed items for convenience (null in invoice_items table) */ (invoiceItem.getEndDate() == null && planPhase != null) ? invoiceItem.getStartDate().plus(planPhase.getDuration().toJodaPeriod()) : invoiceItem.getEndDate(), externalKey, invoiceItem.getInvoiceId(), invoiceItem.getId(), invoiceItem.getLinkedItemId(), invoiceItem.getInvoiceItemType().toString(), planPhase != null ? planPhase.getPhaseType().toString() : null, plan != null ? plan.getProduct().getCategory().toString() : null, plan != null ? plan.getProduct().getName() : null, plan != null ? plan.getProduct().getCatalogName() : null, planPhase != null ? planPhase.getName() : null, invoiceItem.getStartDate(), invoiceItem.getUpdatedDate()); }
@Override public int hashCode() { int result = productName != null ? productName.hashCode() : 0; result = 31 * result + (productType != null ? productType.hashCode() : 0); result = 31 * result + (productCategory != null ? productCategory.hashCode() : 0); result = 31 * result + (slug != null ? slug.hashCode() : 0); result = 31 * result + (phase != null ? phase.hashCode() : 0); result = 31 * result + (price != null ? price.hashCode() : 0); result = 31 * result + (priceList != null ? priceList.hashCode() : 0); result = 31 * result + (mrr != null ? mrr.hashCode() : 0); result = 31 * result + (currency != null ? currency.hashCode() : 0); result = 31 * result + (startDate != null ? startDate.hashCode() : 0); result = 31 * result + (state != null ? state.hashCode() : 0); result = 31 * result + (billingPeriod != null ? billingPeriod.hashCode() : 0); return result; } }
@Override public boolean apply(final SubscriptionBase input) { return ProductCategory.BASE.equals(input.getLastActiveProduct().getCategory()); } }).orNull(); // null for standalone subscriptions
return false; if (productCategory != null ? !productCategory.equals(that.productCategory) : that.productCategory != null) { return false;
this.eventType = bstModelDao.getEvent().getEventType().toString(); if (bstModelDao.getEvent().getCategory() != null) { this.category = bstModelDao.getEvent().getCategory().toString(); } else { this.category = null; this.prevProductName = bstModelDao.getPreviousSubscription().getProductName(); this.prevProductType = bstModelDao.getPreviousSubscription().getProductType(); this.prevProductCategory = bstModelDao.getPreviousSubscription().getProductCategory().toString(); this.prevSlug = bstModelDao.getPreviousSubscription().getSlug(); this.prevPhase = bstModelDao.getPreviousSubscription().getPhase(); this.nextProductName = bstModelDao.getNextSubscription().getProductName(); this.nextProductType = bstModelDao.getNextSubscription().getProductType(); this.nextProductCategory = bstModelDao.getNextSubscription().getProductCategory().toString(); this.nextSlug = bstModelDao.getNextSubscription().getSlug(); this.nextPhase = bstModelDao.getNextSubscription().getPhase();
final InternalTenantContext context) throws EntitlementApiException { if (!ProductCategory.ADD_ON.equals(subscription.getCategory())) {
private Collection<BlockingState> computeAddonsBlockingStatesForSubscriptionBaseEvent(@Nullable final Product baseTransitionTriggerNextProduct, final DateTime blockingStateEffectiveDate) { if (baseSubscription == null || baseSubscription.getLastActivePlan() == null || !ProductCategory.BASE.equals(baseSubscription.getLastActivePlan().getProduct().getCategory())) { return ImmutableList.<BlockingState>of();
@Override public boolean apply(final SubscriptionBase subscription) { return ProductCategory.ADD_ON.equals(subscription.getCategory()) && // Check the entitlement for that add-on hasn't been cancelled yet getEntitlementCancellationEvent(subscription.getId()) == null && ( // Base subscription cancelled baseTransitionTriggerNextProduct == null || ( // Change plan - check which add-ons to cancel includedAddonsForProduct.contains(subscription.getLastActivePlan().getProduct().getName()) || !availableAddonsForProduct.contains(subscription.getLastActivePlan().getProduct().getName()) ) ); } });