Package google.registry.model.tld.label
Class PremiumListDao
java.lang.Object
google.registry.model.tld.label.PremiumListDao
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 Summary
Modifier and TypeMethodDescriptionstatic com.github.benmanes.caffeine.cache.LoadingCache
<String, Optional<PremiumList>> createPremiumListCache
(Duration cachePersistDuration) static void
delete
(PremiumList premiumList) static Optional
<PremiumList> getLatestRevision
(String premiumListName) Returns the most recent revision of the PremiumList with the specified name, if it exists.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.static com.google.common.collect.ImmutableList
<PremiumList.PremiumEntry> loadAllPremiumEntries
(String premiumListName) Returns allPremiumEntries
in the list with the given name.static List
<PremiumList.PremiumEntry> loadPremiumEntries
(PremiumList premiumList) Returns allPremiumEntries
in the givenpremiumList
.static PremiumList
save
(PremiumList premiumList) Saves the given premium list (and its premium list entries) to Cloud SQL.static PremiumList
static void
setPremiumListCacheForTest
(Optional<Duration> expiry)
-
Method Details
-
setPremiumListCacheForTest
-
createPremiumListCache
public static com.github.benmanes.caffeine.cache.LoadingCache<String,Optional<PremiumList>> createPremiumListCache(Duration cachePersistDuration) -
getLatestRevision
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, usegetPremiumPrice(java.lang.String, java.lang.String)
. -
getPremiumPrice
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
Saves the given premium list (and its premium list entries) to Cloud SQL. -
delete
-
loadPremiumEntries
Returns allPremiumEntries
in the givenpremiumList
.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 allPremiumEntries
in the list with the given name.This is an expensive operation and should only be used when the entire list is required.
-