org.axonframework.mongo3.saga.repository
Class SagaEntry

java.lang.Object
  extended by org.axonframework.mongo3.saga.repository.SagaEntry

public class SagaEntry
extends Object

Java representation of sagas stored in a mongo instance

Since:
2.0
Author:
Jettro Coenradie

Constructor Summary
SagaEntry(org.bson.Document dbSaga)
          Initializes a Saga entry using a DBObject containing the Mongo Document
SagaEntry(Saga saga, Serializer serializer)
          Constructs a new SagaEntry for the given saga.
 
Method Summary
 org.bson.Document asDocument()
          Returns the Mongo Document representing the Saga provided in this entry.
 Saga getSaga(Serializer serializer)
          Returns the Saga instance stored in this entry.
static org.bson.conversions.Bson queryByIdentifier(String identifier)
          Returns the Mongo Query to find a Saga based on its identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SagaEntry

public SagaEntry(Saga saga,
                 Serializer serializer)
Constructs a new SagaEntry for the given saga. The given saga must be serializable. The provided saga is not modified by this operation.

Parameters:
saga - The saga to store
serializer - The serialization mechanism to convert the Saga to a byte stream

SagaEntry

public SagaEntry(org.bson.Document dbSaga)
Initializes a Saga entry using a DBObject containing the Mongo Document

Parameters:
dbSaga - The mongo Document containing the serialized saga
Method Detail

getSaga

public Saga getSaga(Serializer serializer)
Returns the Saga instance stored in this entry.

Parameters:
serializer - The serializer to decode the Saga
Returns:
the Saga instance stored in this entry

asDocument

public org.bson.Document asDocument()
Returns the Mongo Document representing the Saga provided in this entry.

Returns:
the Mongo Document representing the Saga provided in this entry

queryByIdentifier

public static org.bson.conversions.Bson queryByIdentifier(String identifier)
Returns the Mongo Query to find a Saga based on its identifier.

Parameters:
identifier - The identifier of the saga to find
Returns:
the Query (as DBObject) to find a Saga in a Mongo Database


Copyright © 2010-2016. All Rights Reserved.