java.lang.Object
io.github.tonywasher.joceanus.metis.field.MetisFieldVersionedItem
io.github.tonywasher.joceanus.prometheus.data.PrometheusDataItem
All Implemented Interfaces:
MetisDataItem.MetisDataDeletableItem, MetisDataItem.MetisDataIndexedItem, MetisDataItem.MetisDataObjectFormat, MetisFieldItem, MetisFieldItem.MetisFieldTableItem, MetisFieldItem.MetisFieldUpdatableItem, PrometheusTableItem, Comparable<Object>
Direct Known Subclasses:
PrometheusControlData, PrometheusControlKey, PrometheusControlKeySet, PrometheusDataKeySet, PrometheusEncryptedDataItem

public abstract class PrometheusDataItem extends MetisFieldVersionedItem implements PrometheusTableItem, Comparable<Object>
Provides the abstract DataItem class as the basis for data items. The implementation of the interface means that this object can only be held in one list at a time and is unique within that list
See Also:
  • Field Details

    • ERROR_VALIDATION

      public static final String ERROR_VALIDATION
      Validation error.
    • ERROR_RESOLUTION

      public static final String ERROR_RESOLUTION
      Resolution error.
    • ERROR_DUPLICATE

      public static final String ERROR_DUPLICATE
      Duplicate Id error.
    • ERROR_UNKNOWN

      public static final String ERROR_UNKNOWN
      Unknown Id error.
    • ERROR_EXIST

      public static final String ERROR_EXIST
      Existing value error.
    • ERROR_MISSING

      public static final String ERROR_MISSING
      Missing value error.
    • ERROR_LENGTH

      public static final String ERROR_LENGTH
      Value too long error.
    • ERROR_NEGATIVE

      public static final String ERROR_NEGATIVE
      Value negative error.
    • ERROR_POSITIVE

      public static final String ERROR_POSITIVE
      Value positive error.
    • ERROR_ZERO

      public static final String ERROR_ZERO
      Value zero error.
    • ERROR_RANGE

      public static final String ERROR_RANGE
      Value outside valid range.
    • ERROR_DISABLED

      public static final String ERROR_DISABLED
      Value disabled error.
    • ERROR_CREATEITEM

      public static final String ERROR_CREATEITEM
      Creation failure.
    • ERROR_MULT

      public static final String ERROR_MULT
      Multiple instances Error.
    • ERROR_INVALIDCHAR

      public static final String ERROR_INVALIDCHAR
      Reserved name error.
    • NAMELEN

      public static final int NAMELEN
      Standard Name length.
      See Also:
    • DESCLEN

      public static final int DESCLEN
      Standard Description length.
      See Also:
  • Constructor Details

    • PrometheusDataItem

      protected PrometheusDataItem(PrometheusDataList<?> pList, Integer uId)
      Construct a new item.
      Parameters:
      pList - the list that this item is associated with
      uId - the Id of the new item (or 0 if not yet known)
    • PrometheusDataItem

      protected PrometheusDataItem(PrometheusDataList<?> pList, PrometheusDataValues pValues)
      Construct a new item.
      Parameters:
      pList - the list that this item is associated with
      pValues - the data values
    • PrometheusDataItem

      protected PrometheusDataItem(PrometheusDataList<?> pList, PrometheusDataItem pBase)
      Construct a new item based on an old item.
      Parameters:
      pList - the list that this item is associated with
      pBase - the old item
  • Method Details

    • getValueSetVersion

      public int getValueSetVersion()
      Obtain valueSet version.
      Returns:
      the valueSet version
    • formatObject

      public String formatObject(OceanusDataFormatter pFormatter)
      Description copied from interface: MetisDataItem.MetisDataObjectFormat
      Obtain Object summary.
      Specified by:
      formatObject in interface MetisDataItem.MetisDataObjectFormat
      Overrides:
      formatObject in class MetisFieldVersionedItem
      Parameters:
      pFormatter - the data formatter
      Returns:
      the display summary of the object
    • getList

      public PrometheusDataList<?> getList()
      Obtain the list.
      Returns:
      the list
    • getDataSet

      public PrometheusDataSet getDataSet()
      Obtain the dataSet.
      Returns:
      the dataSet
    • getStyle

      Get the list style for this item.
      Returns:
      the list style
    • getItemType

      public MetisListKey getItemType()
      Description copied from class: MetisFieldVersionedItem
      Obtain the itemType.
      Overrides:
      getItemType in class MetisFieldVersionedItem
      Returns:
      the item type
    • isActive

      public boolean isActive()
      Description copied from interface: MetisDataItem.MetisDataDeletableItem
      Is this active?
      Specified by:
      isActive in interface MetisDataItem.MetisDataDeletableItem
      Returns:
      true/false
    • isDisabled

      public boolean isDisabled()
      Is the item disabled?
      Returns:
      true/false
    • getTouchStatus

      public PrometheusDataTouch getTouchStatus()
      Obtain the touchStatus.
      Returns:
      the touch status
    • isEditable

      public boolean isEditable()
      Description copied from interface: MetisFieldItem.MetisFieldUpdatableItem
      Is the item editable?
      Specified by:
      isEditable in interface MetisFieldItem.MetisFieldUpdatableItem
      Returns:
      true/false
    • isHeader

      public boolean isHeader()
      Description copied from interface: PrometheusTableItem
      Is this a header?
      Specified by:
      isHeader in interface PrometheusTableItem
      Returns:
      true/false
    • setHeader

      protected void setHeader(boolean pHeader)
      Set the header indication.
      Parameters:
      pHeader - true/false
    • isLocked

      public boolean isLocked()
      Determine whether the item is locked (overridden if required).
      Returns:
      true/false
    • isListLocked

      public boolean isListLocked()
      Determine whether the list is locked (overridden if required).
      Returns:
      true/false
    • deRegister

      public void deRegister()
      DeRegister any infoSet links.
    • clearActive

      public void clearActive()
      Clear the touch status flag.
    • clearTouches

      public void clearTouches(MetisListKey pItemType)
      Clear the item touches.
      Parameters:
      pItemType - the item type
    • touchItem

      public void touchItem(PrometheusDataItem pObject)
      Touch the item.
      Parameters:
      pObject - object that references the item
    • touchUnderlyingItems

      public void touchUnderlyingItems()
      Touch underlying items that are referenced by this item.
    • touchOnUpdate

      public void touchOnUpdate()
      Adjust touches on update.
    • adjustMapForItem

      public void adjustMapForItem()
      Adjust map for this item.
    • updateMaps

      public void updateMaps()
      update Maps.
    • getBase

      public PrometheusDataItem getBase()
      Get the base item for this item.
      Returns:
      the Base item or null
    • setBase

      public void setBase(PrometheusDataItem pBase)
      Set the base item for this item.
      Parameters:
      pBase - the Base item
    • unLink

      public void unLink()
      Unlink the item from the list.
    • setNewVersion

      public void setNewVersion()
      Set new version.
    • getNextVersion

      public int getNextVersion()
      Description copied from interface: MetisFieldItem.MetisFieldUpdatableItem
      Obtain the next version for the history.
      Specified by:
      getNextVersion in interface MetisFieldItem.MetisFieldUpdatableItem
      Returns:
      the next version
    • popHistory

      public void popHistory()
      Description copied from interface: MetisFieldItem.MetisFieldUpdatableItem
      Remove the last changes for the history buffer and restore values from it.
      Specified by:
      popHistory in interface MetisFieldItem.MetisFieldUpdatableItem
      Overrides:
      popHistory in class MetisFieldVersionedItem
    • rewindToVersion

      public void rewindToVersion(int pVersion)
      Description copied from class: MetisFieldVersionedItem
      Rewind item to the required version.
      Overrides:
      rewindToVersion in class MetisFieldVersionedItem
      Parameters:
      pVersion - the version to rewind to
    • setHistory

      public final void setHistory(PrometheusDataItem pBase)
      Set Change history for an update list so that the first and only entry in the change list is the original values of the base.
      Parameters:
      pBase - the base item
    • fieldChanged

      public MetisDataDifference fieldChanged(MetisFieldItem.MetisFieldDef pField)
      Description copied from class: MetisFieldVersionedItem
      Determines whether a particular field has changed.
      Overrides:
      fieldChanged in class MetisFieldVersionedItem
      Parameters:
      pField - the field
      Returns:
      the difference
    • setValidEdit

      public void setValidEdit()
      Note that this item has been validated.
    • addError

      public void addError(String pError, MetisDataItem.MetisDataFieldId pField)
      Description copied from class: MetisFieldVersionedItem
      Add an error for this item.
      Overrides:
      addError in class MetisFieldVersionedItem
      Parameters:
      pError - the error text
      pField - the associated field
    • resolveDataSetLinks

      public void resolveDataSetLinks() throws OceanusException
      Resolve all references to current dataSet.
      Throws:
      OceanusException - on error
    • resolveDataLink

      protected void resolveDataLink(MetisDataItem.MetisDataFieldId pFieldId, PrometheusDataList<?> pList) throws OceanusException
      Resolve a data link into a list.
      Parameters:
      pFieldId - the fieldId to resolve
      pList - the list to resolve against
      Throws:
      OceanusException - on error
    • includeXmlField

      public boolean includeXmlField(MetisDataItem.MetisDataFieldId pField)
      Is the item to be included in output XML?
      Parameters:
      pField - the field to check
      Returns:
      true/false
    • equals

      public boolean equals(Object pThat)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Object pThat)
      Specified by:
      compareTo in interface Comparable<Object>
    • compareValues

      protected abstract int compareValues(PrometheusDataItem pThat)
      compareTo another dataItem.
      Parameters:
      pThat - the DataItem to compare
      Returns:
      the order
    • compareId

      protected int compareId(PrometheusDataItem pThat)
      compareTo another dataItem.
      Parameters:
      pThat - the DataItem to compare
      Returns:
      the order
    • getBaseState

      protected MetisDataState getBaseState()
      Get the state of the underlying record.
      Returns:
      the underlying state
    • indexOf

      public int indexOf()
      Determine index of element within the list.
      Returns:
      The index
    • applyChanges

      public boolean applyChanges(PrometheusDataItem pElement)
      Apply changes to the item from a changed version. Overwritten by objects that have changes
      Parameters:
      pElement - the changed element.
      Returns:
      were changes made?
    • validate

      public void validate()
      Validate the element

      Dirty items become valid.

    • validString

      public static boolean validString(String pString, String pDisallowed)
      Does the string contain only valid characters (no control chars)?
      Parameters:
      pString - the string
      pDisallowed - the set of additional disallowed characters
      Returns:
      true/false
    • byteLength

      public static int byteLength(String pString)
      Obtain the byte length of a string.
      Parameters:
      pString - the string
      Returns:
      the length
    • removeItem

      public void removeItem()
      Remove the item (and any subitems from the lists).
    • getFieldState

      public MetisFieldState getFieldState(MetisDataItem.MetisDataFieldId pField)
      Obtain the field state.
      Parameters:
      pField - the field
      Returns:
      the state
    • getItemState

      public MetisFieldState getItemState()
      Obtain the item State.
      Returns:
      the state