org.axonframework.eventstore.jpa
Class DomainEventEntry

java.lang.Object
  extended by org.axonframework.eventstore.jpa.DomainEventEntry

public class DomainEventEntry
extends Object

JPA compliant wrapper around a DomainEvent. It wraps a DomainEvent by extracting some of the information needed to base searched on, and stores the DomainEvent itself as a serialized object using am EventSerializer

Since:
0.5
Author:
Allard Buijze

Constructor Summary
protected DomainEventEntry()
          Default constructor, as required by JPA specification.
  DomainEventEntry(String type, DomainEvent event, EventSerializer eventSerializer)
          Initialize a DomainEventEntry for the given event, to be serialized using the given serializer.
 
Method Summary
 AggregateIdentifier getAggregateIdentifier()
          Returns the Aggregate Identifier of the associated event.
 DomainEvent getDomainEvent(EventSerializer eventSerializer)
          Reconstructs the DomainEvent using the given eventSerializer.
 Long getId()
          Returns the unique identifier of this entry.
 long getSequenceNumber()
          Returns the sequence number of the associated event.
 org.joda.time.LocalDateTime getTimeStamp()
          Returns the time stamp of the associated event.
 String getType()
          Returns the type identifier of the aggregate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomainEventEntry

protected DomainEventEntry()
Default constructor, as required by JPA specification. Do not use directly!


DomainEventEntry

public DomainEventEntry(String type,
                        DomainEvent event,
                        EventSerializer eventSerializer)
Initialize a DomainEventEntry for the given event, to be serialized using the given serializer.

Parameters:
type - The type identifier of the aggregate root the event belongs to
event - The event to store in the eventstore
eventSerializer - The serialize to serialize the event with
Method Detail

getDomainEvent

public DomainEvent getDomainEvent(EventSerializer eventSerializer)
Reconstructs the DomainEvent using the given eventSerializer.

Parameters:
eventSerializer - The EventSerializer to deserialize the DomainEvent with.
Returns:
The deserialized domain event

getId

public Long getId()
Returns the unique identifier of this entry. Returns null if the entry has not been persisted.

Returns:
the unique identifier of this entry

getAggregateIdentifier

public AggregateIdentifier getAggregateIdentifier()
Returns the Aggregate Identifier of the associated event.

Returns:
the Aggregate Identifier of the associated event.

getType

public String getType()
Returns the type identifier of the aggregate.

Returns:
the type identifier of the aggregate.

getSequenceNumber

public long getSequenceNumber()
Returns the sequence number of the associated event.

Returns:
the sequence number of the associated event.

getTimeStamp

public org.joda.time.LocalDateTime getTimeStamp()
Returns the time stamp of the associated event.

Returns:
the time stamp of the associated event.


Copyright © 2011. All Rights Reserved.