Class HistoryEntry
- java.lang.Object
-
- google.registry.model.ImmutableObject
-
- google.registry.model.reporting.HistoryEntry
-
- All Implemented Interfaces:
Buildable
,DatastoreEntity
,UnsafeSerializable
,java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ContactHistory
,DomainHistory
,DomainHistoryLite
,HostHistory
@MappedSuperclass public class HistoryEntry extends ImmutableObject implements Buildable, DatastoreEntity, UnsafeSerializable
A record of an EPP command that mutated a resource.Due to historical reasons this class is persisted only to Datastore. It has three subclasses that include the parent resource itself which are persisted to Cloud SQL. During migration this class cannot be made abstract in order for the class to be persisted and loaded to and from Datastore. However it should never be used directly in the Java code itself. When it is loaded from Datastore it should be converted to a subclass for handling and when a new history entry is built it should always be a subclass, which is automatically converted to HistoryEntry when persisting to Datastore.
Some care has been taken to make it close to impossible to use this class directly, but the user should still exercise caution. After the migration is complete this class will be made abstract.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HistoryEntry.Builder<T extends HistoryEntry,B extends HistoryEntry.Builder<?,?>>
A builder forHistoryEntry
since it is immutablestatic class
HistoryEntry.Type
Represents the type of history entry.-
Nested classes/interfaces inherited from class google.registry.model.ImmutableObject
ImmutableObject.DoNotCompare, ImmutableObject.DoNotHydrate, ImmutableObject.EmptySetToNull, ImmutableObject.IgnoredInDiffableMap, ImmutableObject.Insignificant
-
Nested classes/interfaces inherited from interface google.registry.model.Buildable
Buildable.GenericBuilder<S,B extends Buildable.GenericBuilder<?,?>>, Buildable.Overlayable<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<DomainTransactionRecord>
domainTransactionRecords
Logging field for transaction reporting.java.lang.Long
id
The autogenerated id of this event.protected com.googlecode.objectify.Key<? extends EppResource>
parent
The resource this event mutated.-
Fields inherited from class google.registry.model.ImmutableObject
hashCode
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
HistoryEntry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HistoryEntry.Builder<? extends HistoryEntry,?>
asBuilder()
Throws an error when trying to get a builder from a bareHistoryEntry
.HistoryEntry
asHistoryEntry()
Clones and returns aHistoryEntry
objecprotected static void
copy(HistoryEntry src, HistoryEntry dst)
static <E extends EppResource>
HistoryEntry.Builder<? extends HistoryEntry,?>createBuilderForResource(E parent)
static VKey<? extends HistoryEntry>
createVKey(com.googlecode.objectify.Key<HistoryEntry> key)
Creates aVKey
instance from aKey
instance.boolean
getBySuperuser()
java.util.Set<DomainTransactionRecord>
getDomainTransactionRecords()
long
getId()
org.joda.time.DateTime
getModificationTime()
java.lang.String
getOtherRegistrarId()
com.googlecode.objectify.Key<? extends EppResource>
getParent()
Period
getPeriod()
java.lang.String
getReason()
java.lang.String
getRegistrarId()
java.lang.Boolean
getRequestedByRegistrar()
java.util.Optional<? extends EppResource>
getResourceAtPointInTime()
Throws an error when attempting to retrieve the EppResource at this point in time.Trid
getTrid()
Returns the TRID, which may be null if the entry was not created by a normal flow.HistoryEntry.Type
getType()
byte[]
getXmlBytes()
protected void
setDomainTransactionRecords(java.util.Set<DomainTransactionRecord> domainTransactionRecords)
This method exists solely to satisfy Hibernate.HistoryEntry
toChildHistoryEntity()
java.util.Optional<SqlEntity>
toSqlEntity()
-
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.DatastoreEntity
beforeDatastoreSaveOnReplay
-
-
-
-
Field Detail
-
id
public java.lang.Long id
The autogenerated id of this event. Note that, this field is marked asTransient
in the SQL schema, this is because the child class ofHistoryEntry
, e.g.DomainHistory
, uses a composite primary key which the id is part of, and Hibernate requires that all theId
fields must be put in the exact same class.
-
parent
protected com.googlecode.objectify.Key<? extends EppResource> parent
The resource this event mutated.
-
domainTransactionRecords
@EmptySetToNull protected java.util.Set<DomainTransactionRecord> domainTransactionRecords
Logging field for transaction reporting.This will be empty for any HistoryEntry generated before this field was added. This will also be empty if the HistoryEntry refers to an EPP mutation that does not affect domain transaction counts (such as contact or host mutations).
-
-
Method Detail
-
getId
public long getId()
-
getParent
public com.googlecode.objectify.Key<? extends EppResource> getParent()
-
getType
public HistoryEntry.Type getType()
-
getPeriod
public Period getPeriod()
-
getXmlBytes
public byte[] getXmlBytes()
-
getModificationTime
public org.joda.time.DateTime getModificationTime()
-
getRegistrarId
public java.lang.String getRegistrarId()
-
getOtherRegistrarId
public java.lang.String getOtherRegistrarId()
-
getTrid
@Nullable public Trid getTrid()
Returns the TRID, which may be null if the entry was not created by a normal flow.
-
getBySuperuser
public boolean getBySuperuser()
-
getReason
public java.lang.String getReason()
-
getRequestedByRegistrar
public java.lang.Boolean getRequestedByRegistrar()
-
getDomainTransactionRecords
public java.util.Set<DomainTransactionRecord> getDomainTransactionRecords()
-
getResourceAtPointInTime
public java.util.Optional<? extends EppResource> getResourceAtPointInTime()
Throws an error when attempting to retrieve the EppResource at this point in time.Subclasses must override this to return the resource; it is non-abstract for legacy reasons and objects created prior to the Registry 3.0 migration.
-
setDomainTransactionRecords
protected void setDomainTransactionRecords(java.util.Set<DomainTransactionRecord> domainTransactionRecords)
This method exists solely to satisfy Hibernate. Use theHistoryEntry.Builder
instead.
-
asBuilder
public HistoryEntry.Builder<? extends HistoryEntry,?> asBuilder()
Throws an error when trying to get a builder from a bareHistoryEntry
.This method only exists to satisfy the requirement that the
HistoryEntry
is NOT abstract, it should never be called directly and all three of the subclass ofHistoryEntry
implements it.
-
asHistoryEntry
public HistoryEntry asHistoryEntry()
Clones and returns aHistoryEntry
objecThis is useful when converting a subclass to the base class to persist to Datastore.
-
copy
protected static void copy(HistoryEntry src, HistoryEntry dst)
-
toChildHistoryEntity
public HistoryEntry toChildHistoryEntity()
-
toSqlEntity
public java.util.Optional<SqlEntity> toSqlEntity()
- Specified by:
toSqlEntity
in interfaceDatastoreEntity
-
createVKey
public static VKey<? extends HistoryEntry> createVKey(com.googlecode.objectify.Key<HistoryEntry> key)
Creates aVKey
instance from aKey
instance.
-
createBuilderForResource
public static <E extends EppResource> HistoryEntry.Builder<? extends HistoryEntry,?> createBuilderForResource(E parent)
-
-