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.
  • Constructor Details

    • MetisListVersioned

      protected MetisListVersioned(MetisListSetVersioned pListSet, MetisListKey pItemType)
      Constructor.
      Parameters:
      pListSet - the listSet
      pItemType - the itemType
  • Method Details

    • getEventRegistrar

      public OceanusEventRegistrar<MetisListEvent> getEventRegistrar()
      Description copied from interface: OceanusEventRegistrar.OceanusEventProvider
      Obtain registration object for listeners.
      Specified by:
      getEventRegistrar in interface OceanusEventRegistrar.OceanusEventProvider<T extends MetisFieldVersionedItem>
      Returns:
      the registrar
    • getDataFieldSet

      public MetisFieldItem.MetisFieldSetDef getDataFieldSet()
      Description copied from interface: MetisFieldItem
      Obtain the fieldSet.
      Specified by:
      getDataFieldSet in interface MetisFieldItem
      Overrides:
      getDataFieldSet in class MetisListIndexed<T extends MetisFieldVersionedItem>
      Returns:
      the fieldSet
    • getItemType

      public MetisListKey getItemType()
      Obtain the itemType.
      Returns:
      the itemType
    • getListSet

      public MetisListSetVersioned getListSet()
      Obtain the listSet.
      Returns:
      the listSet
    • getStyle

      public MetisListStyle 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

      boolean reBase(MetisListVersioned<? extends MetisFieldVersionedItem> pBase)
      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

      protected void deriveUpdates(MetisListSetVersioned pListSet)
      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 listSet
      pOld - The old list to compare to
    • newItem

      public abstract T newItem(MetisFieldVersionedItem pItem)
      NewItem creator.
      Parameters:
      pItem - the item to base new item on
      Returns:
      the new item
    • newList

      public abstract MetisListVersioned<T> newList(MetisListSetVersioned pListSet)
      NewList creator.
      Parameters:
      pListSet - the list set
      Returns:
      the new list
    • fireEvent

      public void fireEvent(MetisListChange<T> pEvent)
      Fire event.
      Parameters:
      pEvent - the event