Class PremiumListDao

java.lang.Object
google.registry.model.tld.label.PremiumListDao

public final class PremiumListDao extends Object
Data access object class for accessing PremiumList objects from Cloud SQL.

This class handles both the mapping from string to SQL-level PremiumList objects as well as the mapping and retrieval of PremiumList.PremiumEntry objects that correspond to the particular PremiumList object in SQL, and caching these entries so that future lookups can be quicker.

  • Method Details

    • setPremiumListCacheForTest

      public static void setPremiumListCacheForTest(Optional<Duration> expiry)
    • createPremiumListCache

      public static com.github.benmanes.caffeine.cache.LoadingCache<String,Optional<PremiumList>> createPremiumListCache(Duration cachePersistDuration)
    • getLatestRevision

      public static Optional<PremiumList> getLatestRevision(String premiumListName)
      Returns the most recent revision of the PremiumList with the specified name, if it exists.

      Note that this does not load PremiumList.labelsToPrices! If you need to check prices, use getPremiumPrice(java.lang.String, java.lang.String).

    • getPremiumPrice

      public static Optional<org.joda.money.Money> getPremiumPrice(String premiumListName, String label)
      Returns the premium price for the specified label and registry, or absent if the label is not premium.
    • save

      public static PremiumList save(String name, org.joda.money.CurrencyUnit currencyUnit, List<String> inputData)
    • save

      public static PremiumList save(PremiumList premiumList)
      Saves the given premium list (and its premium list entries) to Cloud SQL.
    • delete

      public static void delete(PremiumList premiumList)
    • loadPremiumEntries

      public static List<PremiumList.PremiumEntry> loadPremiumEntries(PremiumList premiumList)
      Returns all PremiumEntries in the given premiumList.

      This is an expensive operation and should only be used when the entire list is required.

    • loadAllPremiumEntries

      public static com.google.common.collect.ImmutableList<PremiumList.PremiumEntry> loadAllPremiumEntries(String premiumListName)
      Returns all PremiumEntries in the list with the given name.

      This is an expensive operation and should only be used when the entire list is required.