Class ClaimsList

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

    @Entity(name="ClaimsList")
    public class ClaimsList
    extends ImmutableObject
    implements SqlOnlyEntity
    A list of TMCH claims labels and their associated claims keys.

    Note that the primary key of this entity is 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 claims list with only different revisionId. However, this is not an actual problem because we only use the claims list with highest revisionId.

    • Constructor Detail

      • ClaimsList

        public ClaimsList()
    • Method Detail

      • getRevisionId

        public java.lang.Long getRevisionId()
        Returns the revision id of this claims list, or throws exception if it is null.
      • getTmdbGenerationTime

        public org.joda.time.DateTime getTmdbGenerationTime()
        Returns the time when the external TMDB service generated this revision of the claims list.
        See Also:
        DNL List creation datetime
      • getCreationTimestamp

        public org.joda.time.DateTime getCreationTimestamp()
        Returns the creation time of this claims list.
      • getClaimKey

        public java.util.Optional<java.lang.String> getClaimKey​(java.lang.String label)
        Returns the claim key for a given domain if there is one, empty otherwise.

        Note that this may do a database query. For checking multiple keys against the claims list it may be more efficient to use getLabelsToKeys() first, as this will prefetch all entries and cache them locally.

      • getLabelsToKeys

        public com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> getLabelsToKeys()
        Returns an Map mapping domain label to its lookup key.

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

      • size

        public long size()
        Returns the number of claims.

        Note that this will perform a database "count" query if the label to key map has not been previously cached by calling getLabelsToKeys().

      • create

        public static ClaimsList create​(org.joda.time.DateTime tmdbGenerationTime,
                                        com.google.common.collect.ImmutableMap<java.lang.String,​java.lang.String> labelsToKeys)