Package org.projectbarbel.histo
Class DocumentJournal
- java.lang.Object
-
- org.projectbarbel.histo.DocumentJournal
-
public final class DocumentJournal extends Object
Document Journal abstraction to work on for internal processing inBarbelHistoCore
and for the client. When clients work on instances ofDocumentJournal
it is essential thatDocumentJournal.ProcessingState
is set toDocumentJournal.ProcessingState.EXTERNAL
. This ensures that clients only get copies of journal objects.- Author:
- Niklas Schlimm
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DocumentJournal.Inactivation
static class
DocumentJournal.JournalReader
static class
DocumentJournal.ProcessingState
-
Field Summary
Fields Modifier and Type Field Description static DocumentJournal
EMPTYSAMPLE
-
Method Summary
Modifier and Type Method Description <T> com.googlecode.cqengine.IndexedCollection<T>
collection()
Get the complete archive for the current document id as collection.static DocumentJournal
create(DocumentJournal.ProcessingState processingState, BarbelHistoContext context, com.googlecode.cqengine.IndexedCollection backbone, Object id)
Creates the journal using the backbone as pre-created collection.static DocumentJournal
create(DocumentJournal.ProcessingState processingState, BarbelHistoContext context, Object id)
CreateDocumentJournal
from context.Object
getId()
Set<DocumentJournal.Inactivation>
getLastInactivations()
List<Bitemporal>
getLastInserts()
EmbeddingJournalUpdateStrategy.JournalUpdateCase
getLastUpdateCase()
DocumentJournal.ProcessingState
getProcessingState()
void
inactivate(Bitemporal objectToInactivate, Bitemporal inactivatedCopy)
void
insert(List<Bitemporal> newVersions)
<T> List<T>
list()
Get the complete archive for the current document id as list.protected boolean
lockAcquired()
Acquire a lock on this journal.DocumentJournal.JournalReader
read()
Read from the journal.void
setLastUpdateCase(EmbeddingJournalUpdateStrategy.JournalUpdateCase lastUpdateCase)
long
size()
String
toString()
protected boolean
unlock()
-
-
-
Field Detail
-
EMPTYSAMPLE
public static final DocumentJournal EMPTYSAMPLE
-
-
Method Detail
-
create
public static DocumentJournal create(DocumentJournal.ProcessingState processingState, BarbelHistoContext context, com.googlecode.cqengine.IndexedCollection backbone, Object id)
Creates the journal using the backbone as pre-created collection. This collection may contain objects with other Ids.- Parameters:
processingState
- theDocumentJournal.ProcessingState
context
- the current contextbackbone
- the collection containing the journal objectsid
- document id of the document under barbel control- Returns:
- the
DocumentJournal
created
-
create
public static DocumentJournal create(DocumentJournal.ProcessingState processingState, BarbelHistoContext context, Object id)
CreateDocumentJournal
from context.- Parameters:
processingState
- the processing statecontext
- the contextid
- the document journal id- Returns:
- new
DocumentJournal
-
insert
public void insert(List<Bitemporal> newVersions)
-
inactivate
public void inactivate(Bitemporal objectToInactivate, Bitemporal inactivatedCopy)
-
size
public long size()
-
list
public <T> List<T> list()
Get the complete archive for the current document id as list.- Type Parameters:
T
- the type to manage- Returns:
- the archive
-
collection
public <T> com.googlecode.cqengine.IndexedCollection<T> collection()
Get the complete archive for the current document id as collection.- Type Parameters:
T
- the type to manage- Returns:
- the archive
-
getLastInserts
public List<Bitemporal> getLastInserts()
-
getLastInactivations
public Set<DocumentJournal.Inactivation> getLastInactivations()
-
getId
public Object getId()
-
getProcessingState
public DocumentJournal.ProcessingState getProcessingState()
-
read
public DocumentJournal.JournalReader read()
Read from the journal.- Returns:
- the reader
-
lockAcquired
protected boolean lockAcquired()
Acquire a lock on this journal.- Returns:
- true if lock acquired
-
unlock
protected boolean unlock()
-
getLastUpdateCase
public EmbeddingJournalUpdateStrategy.JournalUpdateCase getLastUpdateCase()
-
setLastUpdateCase
public void setLastUpdateCase(EmbeddingJournalUpdateStrategy.JournalUpdateCase lastUpdateCase)
-
-