Class ClaimsList

All Implemented Interfaces:

@Entity(name="ClaimsList") public class ClaimsList extends ImmutableObject
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 Details

    • ClaimsList

      public ClaimsList()
  • Method Details

    • getRevisionId

      public 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:
    • getCreationTimestamp

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

      public Optional<String> getClaimKey(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<String,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,<String,String> labelsToKeys)