Class ClaimsList
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.model.tmch.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 differentrevisionId
. However, this is not an actual problem because we only use the claims list with highestrevisionId
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotCompare, ImmutableObject.DoNotHydrate, ImmutableObject.EmptySetToNull, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
-
Field Summary
-
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
-
Constructor Summary
Constructors Constructor Description ClaimsList()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClaimsList
create(org.joda.time.DateTime tmdbGenerationTime, com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> labelsToKeys)
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.org.joda.time.DateTime
getCreationTimestamp()
Returns the creation time of this claims list.com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>
getLabelsToKeys()
Returns anMap
mapping domain label to its lookup key.java.lang.Long
getRevisionId()
Returns the revision id of this claims list, or throws exception if it is null.org.joda.time.DateTime
getTmdbGenerationTime()
Returns the time when the external TMDB service generated this revision of the claims list.long
size()
Returns the number of claims.-
Methods inherited from class google.registry.model.ImmutableObject
clone, cloneEmptyToNull, equals, getSignificantFields, hashCode, toDiffableFieldMap, toHydratedString, toString, toStringHelper
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface google.registry.model.replay.SqlEntity
beforeSqlSaveOnReplay, getPrimaryKeyString
-
Methods inherited from interface google.registry.model.replay.SqlOnlyEntity
toDatastoreEntity
-
-
-
-
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 anMap
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)
-
-