Class MetisListVersioned<T extends MetisFieldVersionedItem>
java.lang.Object
io.github.tonywasher.joceanus.metis.list.MetisListIndexed<T>
io.github.tonywasher.joceanus.metis.list.MetisListVersioned<T>
- Type Parameters:
T- the item type
- All Implemented Interfaces:
MetisDataItem.MetisDataList<T>,MetisDataItem.MetisDataObjectFormat,MetisFieldItem,OceanusEventRegistrar.OceanusEventProvider<MetisListEvent>
public abstract class MetisListVersioned<T extends MetisFieldVersionedItem>
extends MetisListIndexed<T>
implements OceanusEventRegistrar.OceanusEventProvider<MetisListEvent>
Versioned List.
-
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
ConstructorsModifierConstructorDescriptionprotectedMetisListVersioned(MetisListSetVersioned pListSet, MetisListKey pItemType) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcondenseHistory(int pNewVersion) Condense history.(package private) MetisListChange<T> deriveChanges on version increment.voidderiveDifferences(MetisListSetVersioned pListSet, MetisListVersioned<? extends MetisFieldVersionedItem> pOld) Construct a difference extract between two Lists.protected voidderiveUpdates(MetisListSetVersioned pListSet) Derive updates.voidfireEvent(MetisListChange<T> pEvent) Fire event.Obtain the fieldSet.Obtain registration object for listeners.Obtain the itemType.Obtain the listSet.getStyle()Obtain the listStyle.intObtain the version.abstract TnewItem(MetisFieldVersionedItem pItem) NewItem creator.abstract MetisListVersioned<T> newList(MetisListSetVersioned pListSet) NewList creator.(package private) booleanreBase(MetisListVersioned<? extends MetisFieldVersionedItem> pBase) Re-base the list against a database image.(package private) voidrewindToVersion(int pVersion) Rewind items to the required version.voidsetVersion(int pVersion) Set version.Methods inherited from class io.github.tonywasher.joceanus.metis.list.MetisListIndexed
add, add, allocateNextId, checkId, clear, containsId, containsItem, copyIdMap, equals, formatObject, getAtIndex, getComparator, getIdMap, getItemById, getNextId, getUnderlyingList, hashCode, indexOfItem, insertAtIndex, iterator, listIterator, listIterator, remove, removeAtIndex, removeById, removeFromList, reverseIterator, setComparator, sortList, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.github.tonywasher.joceanus.metis.data.MetisDataItem.MetisDataList
isEmpty, size
-
Constructor Details
-
MetisListVersioned
Constructor.- Parameters:
pListSet- the listSetpItemType- the itemType
-
-
Method Details
-
getEventRegistrar
Description copied from interface:OceanusEventRegistrar.OceanusEventProviderObtain registration object for listeners.- Specified by:
getEventRegistrarin interfaceOceanusEventRegistrar.OceanusEventProvider<T extends MetisFieldVersionedItem>- Returns:
- the registrar
-
getDataFieldSet
Description copied from interface:MetisFieldItemObtain the fieldSet.- Specified by:
getDataFieldSetin interfaceMetisFieldItem- Overrides:
getDataFieldSetin classMetisListIndexed<T extends MetisFieldVersionedItem>- Returns:
- the fieldSet
-
getItemType
Obtain the itemType.- Returns:
- the itemType
-
getListSet
Obtain the listSet.- Returns:
- the listSet
-
getStyle
Obtain the listStyle.- Returns:
- the listStyle
-
setVersion
public void setVersion(int pVersion) Set version.- Parameters:
pVersion- the version
-
getVersion
public int getVersion()Obtain the version.- Returns:
- the version
-
condenseHistory
public void condenseHistory(int pNewVersion) Condense history.- Parameters:
pNewVersion- the new maximum version
-
deriveChangesOnIncrement
MetisListChange<T> deriveChangesOnIncrement()deriveChanges on version increment.- Returns:
- the changes
-
rewindToVersion
void rewindToVersion(int pVersion) Rewind items to the required version.- Parameters:
pVersion- the version to rewind to
-
reBase
Re-base the list against a database image. This method is used to re-synchronise between two sources. Items that are in this list, but not in the base list will be viewed as inserted. Items that are in the base list but not in this list will be viewed as deleted. Items that are in both lists but differ will be viewed as changed.- Parameters:
pBase- The base list to re-base on- Returns:
- are there any changes
-
deriveUpdates
Derive updates.- Parameters:
pListSet- the update listSet
-
deriveDifferences
public void deriveDifferences(MetisListSetVersioned pListSet, MetisListVersioned<? extends MetisFieldVersionedItem> pOld) Construct a difference extract between two Lists. The difference extract will only have items that differ between the two lists. Items that are in the new list, but not in the old list will be viewed as inserted. Items that are in the old list but not in the new list will be viewed as deleted. Items that are in both lists but differ will be viewed as changed- Parameters:
pListSet- the difference listSetpOld- The old list to compare to
-
newItem
NewItem creator.- Parameters:
pItem- the item to base new item on- Returns:
- the new item
-
newList
NewList creator.- Parameters:
pListSet- the list set- Returns:
- the new list
-
fireEvent
Fire event.- Parameters:
pEvent- the event
-