/** * Removes customerCount customers (at most) from this subscription, * posts early-withdrawal fees if appropriate. */ public void unsubscribe (int customerCount) { getTariffMarket().subscribeToTariff(getTariff(), getCustomer(), -customerCount); pendingUnsubscribeCount += customerCount; }
private void subscribe (Tariff tariff, CapacityBundle bundle, int customerCount, boolean verbose) { getTariffMarket().subscribeToTariff(tariff, bundle.getCustomerInfo(), customerCount); if (verbose) { log.info(bundle.getName() + ": Subscribed " + customerCount + " customers to tariff " + tariff.getId() + " successfully"); } }
/** Subscribing a certain population amount to a certain subscription */ void subscribe (Tariff tariff, int customerCount, CustomerInfo customer) { tariffMarketService.subscribeToTariff(tariff, customer, customerCount); log.info(this.toString() + " " + tariff.getPowerType().toString() + ": " + customerCount + " were subscribed to tariff " + tariff.getId()); }
public void subscribeDefault (TariffMarket tariffMarketService) { for (CustomerInfo customer: getCustomerInfos()) { Tariff candidate = tariffMarketService.getDefaultTariff(customer.getPowerType()); if (null == candidate) { log.error("No default tariff for " + customer.getPowerType().toString()); } tariffMarketService.subscribeToTariff(candidate, customer, customer.getPopulation()); } }
tariffMarketService.subscribeToTariff(tariffMarketService .getDefaultTariff(cust.getPowerType()), cust, cust.getPopulation()); customerRepo.add(cust);
private void updateSubscriptions () { int check = 0; for (Tariff tariff : allocations.keySet()) { int count = allocations.get(tariff); check += count; if (count < 0) { //unsubscribe TariffSubscription sub = getTariffSubscriptionRepo().findSubscriptionForTariffAndCustomer (tariff, customerInfo); sub.unsubscribe(-count); log.info("customer " + customerInfo.getName() + " unsubscribes " + -count + " from tariff " + tariff.getId()); } else if (count > 0) { // subscribe getTariffMarket().subscribeToTariff(tariff, customerInfo, count); log.info("customer " + customerInfo.getName() + " subscribes " + count + " to tariff " + tariff.getId()); } } // sanity check if (check != 0) { log.error("Subscription updates do not add up for " + customerInfo.getName() + ": " + check); } }
public void subscribeDefault (TariffMarket tariffMarketService) { for (CustomerInfo customer: getCustomerInfos()) { Tariff candidate = tariffMarketService.getDefaultTariff(customer.getPowerType()); if (null == candidate) { log.error("No default tariff for " + customer.getPowerType().toString()); } else { log.info("Subscribe " + customer.getName() + " to " + candidate.getPowerType().toString()); } tariffMarketService.subscribeToTariff(candidate, customer, customer.getPopulation()); } }
getTariffMarket().subscribeToTariff(tariff, customer, -customersCommitted); getTariffMarket().subscribeToTariff(newTariff, customer, customersCommitted); log.info("Tariff " + tariff.getId() + " superseded by " + newTariff.getId()