Class MetisListSetVersioned
java.lang.Object
io.github.tonywasher.joceanus.metis.list.MetisListSetVersioned
- All Implemented Interfaces:
MetisDataItem.MetisDataObjectFormat,MetisFieldItem,OceanusEventRegistrar.OceanusEventProvider<MetisListEvent>
public class MetisListSetVersioned
extends Object
implements MetisFieldItem, OceanusEventRegistrar.OceanusEventProvider<MetisListEvent>
Versioned ListSet.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.tonywasher.joceanus.metis.field.MetisFieldItem
MetisFieldItem.MetisFieldDef, MetisFieldItem.MetisFieldItemType, MetisFieldItem.MetisFieldSetDef, MetisFieldItem.MetisFieldTableItem, MetisFieldItem.MetisFieldUpdatableItem, MetisFieldItem.MetisFieldVersionedDef -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.MetisListSetVersioned(MetisListStyle pStyle) Constructor.MetisListSetVersioned(MetisListStyle pStyle, MetisListSetVersioned pBase) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcondenseHistory(int pNewVersion) Condense history.protected voiddeclareList(MetisListKey pItemType, MetisListVersioned<? extends MetisFieldVersionedItem> pList) Declare list.voidderiveChanges on version increment.deriveDifferences(MetisListSetVersioned pListSet) derive differences.derive updates.formatObject(OceanusDataFormatter pFormatter) Obtain Object summary.getBase()Obtain the base listSet.Obtain the fieldSet.Obtain registration object for listeners.<L extends MetisListVersioned<?>>
LgetList(MetisListKey pListKey, Class<L> pClazz) Obtain the relevant list.getStyle()Obtain the style.intObtain the version.booleanisEmpty()Is this an empty listSet?Obtain the key iterator.Iterator<MetisListVersioned<? extends MetisFieldVersionedItem>> Obtain the List iterator.voidreBase(MetisListSetVersioned pBase) Re-base the listSet against a database image.Obtain the reverse key iterator.voidrewindToVersion(int pVersion) Rewind items to the required version.protected voidsetVersion(int pVersion) Set version.toString()
-
Constructor Details
-
MetisListSetVersioned
public MetisListSetVersioned()Constructor. -
MetisListSetVersioned
Constructor.- Parameters:
pStyle- the listSet Style
-
MetisListSetVersioned
Constructor.- Parameters:
pStyle- the listSet stylepBase- the base listSet
-
-
Method Details
-
getDataFieldSet
Description copied from interface:MetisFieldItemObtain the fieldSet.- Specified by:
getDataFieldSetin interfaceMetisFieldItem- Returns:
- the fieldSet
-
getEventRegistrar
Description copied from interface:OceanusEventRegistrar.OceanusEventProviderObtain registration object for listeners.- Specified by:
getEventRegistrarin interfaceOceanusEventRegistrar.OceanusEventProvider<MetisListEvent>- Returns:
- the registrar
-
formatObject
Description copied from interface:MetisDataItem.MetisDataObjectFormatObtain Object summary.- Specified by:
formatObjectin interfaceMetisDataItem.MetisDataObjectFormat- Parameters:
pFormatter- the data formatter- Returns:
- the display summary of the object
-
toString
-
getStyle
Obtain the style.- Returns:
- the style
-
getBase
Obtain the base listSet.- Returns:
- the base listSet
-
getVersion
public int getVersion()Obtain the version.- Returns:
- the version
-
setVersion
protected void setVersion(int pVersion) Set version.- Parameters:
pVersion- the version
-
keyIterator
Obtain the key iterator.- Returns:
- the iterator
-
reverseKeyIterator
Obtain the reverse key iterator.- Returns:
- the iterator
-
listIterator
Obtain the List iterator.- Returns:
- the iterator
-
declareList
protected void declareList(MetisListKey pItemType, MetisListVersioned<? extends MetisFieldVersionedItem> pList) Declare list.- Parameters:
pItemType- the itemType for the listpList- the list
-
getList
Obtain the relevant list.- Type Parameters:
L- the list type- Parameters:
pListKey- the list keypClazz- the list class- Returns:
- the list (or null)
-
isEmpty
public boolean isEmpty()Is this an empty listSet?- Returns:
- true/false
-
deriveDifferences
derive differences.- Parameters:
pListSet- the listSet to compare against- Returns:
- the differences
-
deriveUpdates
derive updates.- Returns:
- the updates
-
condenseHistory
public void condenseHistory(int pNewVersion) Condense history.- Parameters:
pNewVersion- the new maximum version
-
reBase
Re-base the listSet against a database image. This method is used to re-synchronise between two sources. Items that are in this listSet, but not in the base listSet will be viewed as inserted. Items that are in the base listSet but not in this listSet will be viewed as deleted. Items that are in both listSets but differ will be viewed as changed.- Parameters:
pBase- the base listSet
-
deriveChangesOnIncrement
public void deriveChangesOnIncrement()deriveChanges on version increment. -
rewindToVersion
public void rewindToVersion(int pVersion) Rewind items to the required version.- Parameters:
pVersion- the version to rewind to
-