Class ReservedList

  • All Implemented Interfaces:
    Buildable, SqlEntity, SqlOnlyEntity, java.lang.Cloneable

    @Entity
    public final class ReservedList
    extends BaseDomainLabelList<ReservationType,​ReservedList.ReservedListEntry>
    implements SqlOnlyEntity
    A list of reserved domain labels that are blocked from being registered for various reasons.

    Note that the primary key of this entity is BaseDomainLabelList.revisionId, which is auto-generated by the database. So, if a retry of insertion happens after the previous attempt unexpectedly succeeds, we will end up with having two exact same reserved lists that differ only by revisionId. This is fine though, because we only use the list with the highest revisionId.

    • Constructor Detail

      • ReservedList

        public ReservedList()
    • Method Detail

      • isInUse

        public boolean isInUse()
        Determines whether the ReservedList is in use on any Registry
      • getShouldPublish

        public boolean getShouldPublish()
        Returns whether this reserved list is included in the concatenated list of reserved terms published to Google Drive for viewing by registrars.
      • getReservedListEntries

        public com.google.common.collect.ImmutableMap<java.lang.String,​ReservedList.ReservedListEntry> getReservedListEntries()
        Returns a Map of domain labels to ReservedList.ReservedListEntry.

        Note that this involves a database fetch of a potentially large number of elements and should be avoided unless necessary.

      • get

        public static java.util.Optional<ReservedList> get​(java.lang.String listName)
        Gets a ReservedList by name using the caching layer.
        Returns:
        An Optional<ReservedList> that has a value if a reserved list exists by the given name, or absent if not.
        Throws:
        com.google.common.util.concurrent.UncheckedExecutionException - if some other error occurs while trying to load the ReservedList from the cache or database.
      • getReservationTypes

        public static com.google.common.collect.ImmutableSet<ReservationType> getReservationTypes​(java.lang.String label,
                                                                                                  java.lang.String tld)
        Queries the set of all reserved lists associated with the specified TLD and returns the reservation types of the label.

        If the label is in none of the lists, it returns an empty set.

      • getReservationInList

        public java.util.Optional<ReservationType> getReservationInList​(java.lang.String label)
        Gets the ReservationType of a label in a single ReservedList, or returns an absent Optional if none exists in the list.

        Note that this logic is significantly less complicated than the getReservationTypes(java.lang.String, java.lang.String) methods, which are applicable to an entire Registry, and need to check across multiple reserved lists.