if (c.getEffectiveDate().compareTo(newCatalogVersion.getEffectiveDate()) == 0) { final ValidationErrors errors = new ValidationErrors(); errors.add(String.format("Catalog version for effectiveDate '%s' already exists", newCatalogVersion.getEffectiveDate()), StandaloneCatalog.class, "");
@TimedResource @GET @Path("/versions") @Produces(APPLICATION_JSON) @ApiOperation(value = "Retrieve a list of catalog versions", response = DateTime.class, responseContainer = "List") @ApiResponses(value = {}) public Response getCatalogVersions(@QueryParam(QUERY_ACCOUNT_ID) final UUID accountId, @javax.ws.rs.core.Context final HttpServletRequest request) throws Exception { final TenantContext tenantContext = accountId != null ? context.createTenantContextWithAccountId(accountId, request) : context.createTenantContextNoAccountId(request); final VersionedCatalog<? extends StaticCatalog> catalog = catalogUserApi.getCatalog(catalogName, null, tenantContext); final List<DateTime> result = new ArrayList<DateTime>(); for (final StaticCatalog v : catalog.getVersions()) { result.add(new DateTime(v.getEffectiveDate())); } return Response.status(Status.OK).entity(result).build(); }
@TimedResource @GET @Produces(APPLICATION_JSON) @ApiOperation(value = "Retrieve the catalog as JSON", responseContainer = "List", response = CatalogJson.class) @ApiResponses(value = {}) public Response getCatalogJson(@QueryParam(QUERY_REQUESTED_DT) final String requestedDate, @QueryParam(QUERY_ACCOUNT_ID) final UUID accountId, @javax.ws.rs.core.Context final HttpServletRequest request) throws Exception { final TenantContext tenantContext = accountId != null ? context.createTenantContextWithAccountId(accountId, request) : context.createTenantContextNoAccountId(request); final DateTime catalogDateVersion = requestedDate != null ? DATE_TIME_FORMATTER.parseDateTime(requestedDate).toDateTime(DateTimeZone.UTC) : null; final VersionedCatalog<? extends StaticCatalog> catalog = catalogUserApi.getCatalog(catalogName, null, tenantContext); final List<CatalogJson> result = new ArrayList<CatalogJson>(); if (catalogDateVersion != null) { result.add(new CatalogJson(catalog, catalogDateVersion)); } else { for (final StaticCatalog v : catalog.getVersions()) { result.add(new CatalogJson(catalog, new DateTime(v.getEffectiveDate()))); } } return Response.status(Status.OK).entity(result).build(); }
public DefaultBillingEvent(final SubscriptionBase subscription, final DateTime effectiveDate, final boolean isActive, final Plan plan, final PlanPhase planPhase, final BigDecimal fixedPrice, final Currency currency, final BillingPeriod billingPeriod, final int billCycleDayLocal, final String description, final long totalOrdering, final SubscriptionBaseTransitionType type, final Catalog catalog, final boolean isDisableEvent) throws CatalogApiException { this.catalog = catalog; this.subscription = subscription; this.effectiveDate = effectiveDate; this.plan = plan; this.planPhase = planPhase; this.fixedPrice = fixedPrice; this.currency = currency; this.billingPeriod = billingPeriod; this.billCycleDayLocal = billCycleDayLocal; this.description = description; this.type = type; this.totalOrdering = totalOrdering; this.usages = initializeUsage(isActive); this.isDisableEvent = isDisableEvent; this.nextPlanPhase = isDisableEvent ? null : planPhase; this.catalogEffectiveDate = plan != null ? new DateTime(plan.getCatalog().getEffectiveDate()) : null; this.billingAlignment = null; }
if (c.getEffectiveDate().compareTo(newCatalogVersion.getEffectiveDate()) == 0) { final ValidationErrors errors = new ValidationErrors(); errors.add(String.format("Catalog version for effectiveDate '%s' already exists", newCatalogVersion.getEffectiveDate()), StandaloneCatalog.class, "");
this.billingPeriod = getRecurringBillingPeriod(prevPlanPhase); this.catalogEffectiveDate = plan == null ? null : new DateTime(plan.getCatalog().getEffectiveDate());