Package google.registry.model.common
Class Cursor
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.model.common.Cursor
-
- All Implemented Interfaces:
DatastoreAndSqlEntity
,DatastoreEntity
,SqlEntity
,UnsafeSerializable
,java.io.Serializable
,java.lang.Cloneable
@Entity public class Cursor extends ImmutableObject implements DatastoreAndSqlEntity, UnsafeSerializable
Shared entity for date cursors. This type supports both "scoped" cursors (i.e. per resource of a given type, such as a TLD) and global (i.e. one per environment) cursors, defined internally as scoped onEntityGroupRoot
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Cursor.CursorId
static class
Cursor.CursorType
The types of cursors, used as the string id field for each cursor in Datastore.-
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotCompare, ImmutableObject.DoNotHydrate, ImmutableObject.EmptySetToNull, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
GLOBAL
The scope of a global cursor.-
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
-
Constructor Summary
Constructors Constructor Description Cursor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Cursor
create(Cursor.CursorType cursorType, org.joda.time.DateTime cursorTime, ImmutableObject scope)
Creates a new cursor instance with a givenImmutableObject
scope.static Cursor
createGlobal(Cursor.CursorType cursorType, org.joda.time.DateTime cursorTime)
Creates a new global cursor instance.static com.googlecode.objectify.Key<Cursor>
createGlobalKey(Cursor.CursorType cursorType)
Creates a unique key for a given global cursor type.static VKey<Cursor>
createGlobalVKey(Cursor.CursorType type)
static com.googlecode.objectify.Key<Cursor>
createKey(Cursor.CursorType cursorType, ImmutableObject scope)
Creates a unique key for a given scope and cursor type.VKey<Cursor>
createVKey()
static VKey<Cursor>
createVKey(com.googlecode.objectify.Key<Cursor> key)
static VKey<Cursor>
createVKey(Cursor.CursorType type, java.lang.String scope)
org.joda.time.DateTime
getCursorTime()
static org.joda.time.DateTime
getCursorTimeOrStartOfTime(java.util.Optional<Cursor> cursor)
Returns the current time for a given cursor, orSTART_OF_TIME
if the cursor is null.org.joda.time.DateTime
getLastUpdateTime()
java.lang.String
getScope()
Cursor.CursorType
getType()
-
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.DatastoreAndSqlEntity
toDatastoreEntity, toSqlEntity
-
Methods inherited from interface google.registry.model.replay.DatastoreEntity
beforeDatastoreSaveOnReplay
-
Methods inherited from interface google.registry.model.replay.SqlEntity
beforeSqlSaveOnReplay, getPrimaryKeyString
-
-
-
-
Field Detail
-
GLOBAL
public static final java.lang.String GLOBAL
The scope of a global cursor. A global cursor is a cursor that is not specific to one tld.- See Also:
- Constant Field Values
-
-
Method Detail
-
createGlobalVKey
public static VKey<Cursor> createGlobalVKey(Cursor.CursorType type)
-
createVKey
public static VKey<Cursor> createVKey(Cursor.CursorType type, java.lang.String scope)
-
getLastUpdateTime
public org.joda.time.DateTime getLastUpdateTime()
-
getScope
public java.lang.String getScope()
-
getType
public Cursor.CursorType getType()
-
createKey
public static com.googlecode.objectify.Key<Cursor> createKey(Cursor.CursorType cursorType, ImmutableObject scope)
Creates a unique key for a given scope and cursor type.
-
createGlobalKey
public static com.googlecode.objectify.Key<Cursor> createGlobalKey(Cursor.CursorType cursorType)
Creates a unique key for a given global cursor type.
-
createGlobal
public static Cursor createGlobal(Cursor.CursorType cursorType, org.joda.time.DateTime cursorTime)
Creates a new global cursor instance.
-
create
public static Cursor create(Cursor.CursorType cursorType, org.joda.time.DateTime cursorTime, ImmutableObject scope)
Creates a new cursor instance with a givenImmutableObject
scope.
-
getCursorTimeOrStartOfTime
public static org.joda.time.DateTime getCursorTimeOrStartOfTime(java.util.Optional<Cursor> cursor)
Returns the current time for a given cursor, orSTART_OF_TIME
if the cursor is null.
-
getCursorTime
public org.joda.time.DateTime getCursorTime()
-
-