org.axonframework.eventstore.jpa
Interface EventEntryFactory<T>

Type Parameters:
T - The data type in which serialized data is stored. This must correspond
All Known Implementing Classes:
DefaultEventEntryFactory

public interface EventEntryFactory<T>

Interface describing a factory that creates Entities for the JpaEventStore to persist. The EventEntryFactory allows for customization of the exact column types in which the events are stored.

The entity must have the following properties:

The abstract entity (and @MappedSuperClass) provides all required fields, except for payload and metaData.

Since:
2.3
Author:
Allard Buijze
See Also:
DefaultEventEntryFactory, AbstractEventEntryData

Method Summary
 Object createDomainEventEntry(String aggregateType, DomainEventMessage event, SerializedObject<T> serializedPayload, SerializedObject<T> serializedMetaData)
          Creates an entity representing a Domain Event, which contains the data provided in the parameters, which can be stored using the JPA Entity Manager configured on the JpaEventStore using this factory.
 Object createSnapshotEventEntry(String aggregateType, DomainEventMessage snapshotEvent, SerializedObject<T> serializedPayload, SerializedObject<T> serializedMetaData)
          Creates an entity representing a Snapshot Event, which contains the data provided in the parameters, which can be stored using the JPA Entity Manager configured on the JpaEventStore using this factory.
 Class<T> getDataType()
          Returns the type used to store serialized payloads.
 String getDomainEventEntryEntityName()
          Returns the entity name of the Domain Event Entry provided by this factory.
 String getSnapshotEventEntryEntityName()
          Returns the entity name of the Snapshot Event Entry provided by this factory.
 Object resolveDateTimeValue(org.joda.time.DateTime dateTime)
          Returns the representation used for the given dateTime in the event entry.
 

Method Detail

getDataType

Class<T> getDataType()
Returns the type used to store serialized payloads. This must correspond to the declared type of the snapshot event entry and domain event entry returned by createSnapshotEventEntry(String, org.axonframework.domain.DomainEventMessage, org.axonframework.serializer.SerializedObject, org.axonframework.serializer.SerializedObject) and createDomainEventEntry(String, org.axonframework.domain.DomainEventMessage, org.axonframework.serializer.SerializedObject, org.axonframework.serializer.SerializedObject) respectively.

Returns:
the type used to store serialized payloads

createDomainEventEntry

Object createDomainEventEntry(String aggregateType,
                              DomainEventMessage event,
                              SerializedObject<T> serializedPayload,
                              SerializedObject<T> serializedMetaData)
Creates an entity representing a Domain Event, which contains the data provided in the parameters, which can be stored using the JPA Entity Manager configured on the JpaEventStore using this factory.

Parameters:
aggregateType - The type identifier of the aggregate that generated the domain event
event - The DomainEventMessage containing the data to store
serializedPayload - The serialized payload
serializedMetaData - The serialized meta data
Returns:
the instance to store using the EntityManager

createSnapshotEventEntry

Object createSnapshotEventEntry(String aggregateType,
                                DomainEventMessage snapshotEvent,
                                SerializedObject<T> serializedPayload,
                                SerializedObject<T> serializedMetaData)
Creates an entity representing a Snapshot Event, which contains the data provided in the parameters, which can be stored using the JPA Entity Manager configured on the JpaEventStore using this factory.

Parameters:
aggregateType - The type identifier of the aggregate that generated the domain event
snapshotEvent - The DomainEventMessage containing the data to store
serializedPayload - The serialized payload
serializedMetaData - The serialized meta data
Returns:
the instance to store using the EntityManager

getDomainEventEntryEntityName

String getDomainEventEntryEntityName()
Returns the entity name of the Domain Event Entry provided by this factory.

Returns:
the entity name of the Domain Event Entry provided by this factory

getSnapshotEventEntryEntityName

String getSnapshotEventEntryEntityName()
Returns the entity name of the Snapshot Event Entry provided by this factory.

Returns:
the entity name of the Snapshot Event Entry provided by this factory

resolveDateTimeValue

Object resolveDateTimeValue(org.joda.time.DateTime dateTime)
Returns the representation used for the given dateTime in the event entry.

For example, if the date is stored as an ISO-8601 String, this methods return the dateTime.toString().

Parameters:
dateTime - The date to return the representation for
Returns:
The value used to store the given date


Copyright © 2010-2016. All Rights Reserved.