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 inBarbelHistoCoreand for the client. When clients work on instances ofDocumentJournalit is essential thatDocumentJournal.ProcessingStateis 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 classDocumentJournal.Inactivationstatic classDocumentJournal.JournalReaderstatic classDocumentJournal.ProcessingState
-
Field Summary
Fields Modifier and Type Field Description static DocumentJournalEMPTYSAMPLE
-
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 DocumentJournalcreate(DocumentJournal.ProcessingState processingState, BarbelHistoContext context, com.googlecode.cqengine.IndexedCollection backbone, Object id)Creates the journal using the backbone as pre-created collection.static DocumentJournalcreate(DocumentJournal.ProcessingState processingState, BarbelHistoContext context, Object id)CreateDocumentJournalfrom context.ObjectgetId()Set<DocumentJournal.Inactivation>getLastInactivations()List<Bitemporal>getLastInserts()EmbeddingJournalUpdateStrategy.JournalUpdateCasegetLastUpdateCase()DocumentJournal.ProcessingStategetProcessingState()voidinactivate(Bitemporal objectToInactivate, Bitemporal inactivatedCopy)voidinsert(List<Bitemporal> newVersions)<T> List<T>list()Get the complete archive for the current document id as list.protected booleanlockAcquired()Acquire a lock on this journal.DocumentJournal.JournalReaderread()Read from the journal.voidsetLastUpdateCase(EmbeddingJournalUpdateStrategy.JournalUpdateCase lastUpdateCase)longsize()StringtoString()protected booleanunlock()
-
-
-
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.ProcessingStatecontext- the current contextbackbone- the collection containing the journal objectsid- document id of the document under barbel control- Returns:
- the
DocumentJournalcreated
-
create
public static DocumentJournal create(DocumentJournal.ProcessingState processingState, BarbelHistoContext context, Object id)
CreateDocumentJournalfrom 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)
-
-