public SubscriptionMigrationData(SubscriptionData data, List<EntitlementEvent> initialEvents) { super(); // Set CTD to subscription object from MIGRATION_BILLING event SubscriptionBuilder builder = new SubscriptionBuilder(data); for (EntitlementEvent cur : initialEvents) { if (cur instanceof ApiEventMigrateBilling) { builder.setChargedThroughDate(cur.getEffectiveDate()); } } this.data = new SubscriptionData(builder); this.initialEvents = initialEvents; }
@Override public void bind( @SuppressWarnings("rawtypes") SQLStatement stmt, Bind bind, EntitlementEvent evt) { String planName = null; String phaseName = null; String priceListName = null; String userType = null; if (evt.getType() == EventType.API_USER) { ApiEvent userEvent = (ApiEvent) evt; planName = userEvent.getEventPlan(); phaseName = userEvent.getEventPlanPhase(); priceListName = userEvent.getPriceList(); userType = userEvent.getEventType().toString(); } else { phaseName = ((PhaseEvent) evt).getPhase(); } stmt.bind("id", evt.getId().toString()); stmt.bind("eventType", evt.getType().toString()); stmt.bind("userType", userType); stmt.bind("requestedDate", getDate(evt.getRequestedDate())); stmt.bind("effectiveDate", getDate(evt.getEffectiveDate())); stmt.bind("subscriptionId", evt.getSubscriptionId().toString()); stmt.bind("planName", planName); stmt.bind("phaseName", phaseName); stmt.bind("priceListName", priceListName); stmt.bind("currentVersion", evt.getActiveVersion()); stmt.bind("isActive", evt.isActive()); }