Class TariffSubscriptionRepo

  • All Implemented Interfaces:
    DomainRepo

    @Service
    public class TariffSubscriptionRepo
    extends Object
    implements DomainRepo
    Repository for TariffSubscriptions. This cannot be in common, because TariffSubscription is not in common.
    Author:
    John Collins
    • Constructor Detail

      • TariffSubscriptionRepo

        public TariffSubscriptionRepo()
    • Method Detail

      • getSubscription

        public TariffSubscription getSubscription​(CustomerInfo customer,
                                                  Tariff tariff)
        Returns the TariffSubscription for the given Tariff/Customer pair, creating it if necessary. Note that as of issue #505, you can get null back if you try to get a subscription for a non-existent tariff, such as one that has been revoked.
      • findSubscriptionForTariffAndCustomer

        public TariffSubscription findSubscriptionForTariffAndCustomer​(Tariff tariff,
                                                                       CustomerInfo customer)
        Returns the subscription, if any, for the specified tariff and customer. Does not create a subscription in case it cannot be found in the repo.
      • findSubscriptionsForTariff

        public List<TariffSubscription> findSubscriptionsForTariff​(Tariff tariff)
        Returns the list of subscriptions for a given tariff. Return value does not share structure with the repo.
      • findSubscriptionsForCustomer

        public List<TariffSubscription> findSubscriptionsForCustomer​(CustomerInfo customer)
        Returns the list of subscriptions for a given customer. Return value does not share structure with the repo.
      • findActiveSubscriptionsForCustomer

        public List<TariffSubscription> findActiveSubscriptionsForCustomer​(CustomerInfo customer)
        Returns the list of active subscriptions for a given customer. These are subscriptions that have non-zero committed-customer counts.
      • findSubscriptionsForBroker

        public List<TariffSubscription> findSubscriptionsForBroker​(Broker b)
        Returns the list of subscriptions for the specified broker. Return value does not share structure with the repo.
      • findActiveSubscriptionsForBroker

        public List<TariffSubscription> findActiveSubscriptionsForBroker​(Broker broker)
        Returns the list of active subscriptions for a given broker. These are subscriptions that have non-zero committed-customer counts.
      • getRevokedSubscriptionList

        public List<TariffSubscription> getRevokedSubscriptionList​(CustomerInfo customer)
        Returns the list of subscriptions for this customer that have been revoked and have non-zero committed customer counts. Intended to be called in the context of tariff evaluation (typically by the TariffEvaluator).
      • removeSubscriptionsForTariff

        public void removeSubscriptionsForTariff​(Tariff tariff)
        Removes all subscriptions for the given tariff. Presumably this is done when the tariff has been revoked and all revocation processing is complete.
      • recycle

        public void recycle()
        Clears out the repo in preparation for another simulation.
        Specified by:
        recycle in interface DomainRepo