Class PrometheusDataItem
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:
-
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.MetisFieldVersionedDefNested classes/interfaces inherited from interface io.github.tonywasher.joceanus.prometheus.data.PrometheusTableItem
PrometheusTableItem.PrometheusTableList<T extends PrometheusTableItem> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intStandard Description length.static final StringCreation failure.static final StringValue disabled error.static final StringDuplicate Id error.static final StringExisting value error.static final StringReserved name error.static final StringValue too long error.static final StringMissing value error.static final StringMultiple instances Error.static final StringValue negative error.static final StringValue positive error.static final StringValue outside valid range.static final StringResolution error.static final StringUnknown Id error.static final StringValidation error.static final StringValue zero error.static final intStandard Name length. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPrometheusDataItem(PrometheusDataList<?> pList, PrometheusDataItem pBase) Construct a new item based on an old item.protectedPrometheusDataItem(PrometheusDataList<?> pList, PrometheusDataValues pValues) Construct a new item.protectedPrometheusDataItem(PrometheusDataList<?> pList, Integer uId) Construct a new item. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddError(String pError, MetisDataItem.MetisDataFieldId pField) Add an error for this item.voidAdjust map for this item.booleanapplyChanges(PrometheusDataItem pElement) Apply changes to the item from a changed version.static intbyteLength(String pString) Obtain the byte length of a string.voidClear the touch status flag.voidclearTouches(MetisListKey pItemType) Clear the item touches.protected intcompareId(PrometheusDataItem pThat) compareTo another dataItem.intprotected abstract intcompareValues(PrometheusDataItem pThat) compareTo another dataItem.voidDeRegister any infoSet links.booleanDetermines whether a particular field has changed.formatObject(OceanusDataFormatter pFormatter) Obtain Object summary.getBase()Get the base item for this item.protected MetisDataStateGet the state of the underlying record.Obtain the dataSet.Obtain the field state.Obtain the item State.Obtain the itemType.getList()Obtain the list.intObtain the next version for the history.getStyle()Get the list style for this item.Obtain the touchStatus.intObtain valueSet version.inthashCode()booleanIs the item to be included in output XML?intindexOf()Determine index of element within the list.booleanisActive()Is this active?booleanIs the item disabled?booleanIs the item editable?booleanisHeader()Is this a header?booleanDetermine whether the list is locked (overridden if required).booleanisLocked()Determine whether the item is locked (overridden if required).voidRemove the last changes for the history buffer and restore values from it.voidRemove the item (and any subitems from the lists).protected voidresolveDataLink(MetisDataItem.MetisDataFieldId pFieldId, PrometheusDataList<?> pList) Resolve a data link into a list.voidResolve all references to current dataSet.voidrewindToVersion(int pVersion) Rewind item to the required version.voidsetBase(PrometheusDataItem pBase) Set the base item for this item.protected voidsetHeader(boolean pHeader) Set the header indication.final voidsetHistory(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.voidSet new version.voidNote that this item has been validated.voidtouchItem(PrometheusDataItem pObject) Touch the item.voidAdjust touches on update.voidTouch underlying items that are referenced by this item.voidunLink()Unlink the item from the list.voidupdate Maps.voidvalidate()Validate the elementstatic booleanvalidString(String pString, String pDisallowed) Does the string contain only valid characters (no control chars)?Methods inherited from class io.github.tonywasher.joceanus.metis.field.MetisFieldVersionedItem
adjustState, checkForHistory, clearErrors, clearHistory, condenseHistory, fieldChanged, getDataFieldSet, getEditState, getFieldErrors, getFieldErrors, getFirstError, getIndexedId, getOriginalValues, getOriginalVersion, getState, getValidation, getValues, getValuesHistory, getVersion, getVersionedField, hasChanges, hasErrors, hasErrors, hasHistory, isDeleted, isValid, maybePopHistory, newVersionValues, pushHistory, pushHistory, resetHistory, setDeleted, setEditState, setHistory, setIndexedId, setItemType, setValuesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.tonywasher.joceanus.metis.data.MetisDataItem.MetisDataDeletableItem
isDeleted, setDeletedMethods inherited from interface io.github.tonywasher.joceanus.metis.data.MetisDataItem.MetisDataIndexedItem
getIndexedIdMethods inherited from interface io.github.tonywasher.joceanus.metis.field.MetisFieldItem
getDataFieldSetMethods inherited from interface io.github.tonywasher.joceanus.metis.field.MetisFieldItem.MetisFieldUpdatableItem
checkForHistory, getFieldErrors, getFieldErrors, getOriginalValues, getValues, getValuesHistory, hasErrors, pushHistory, skipField
-
Field Details
-
ERROR_VALIDATION
Validation error. -
ERROR_RESOLUTION
Resolution error. -
ERROR_DUPLICATE
Duplicate Id error. -
ERROR_UNKNOWN
Unknown Id error. -
ERROR_EXIST
Existing value error. -
ERROR_MISSING
Missing value error. -
ERROR_LENGTH
Value too long error. -
ERROR_NEGATIVE
Value negative error. -
ERROR_POSITIVE
Value positive error. -
ERROR_ZERO
Value zero error. -
ERROR_RANGE
Value outside valid range. -
ERROR_DISABLED
Value disabled error. -
ERROR_CREATEITEM
Creation failure. -
ERROR_MULT
Multiple instances Error. -
ERROR_INVALIDCHAR
Reserved name error. -
NAMELEN
public static final int NAMELENStandard Name length.- See Also:
-
DESCLEN
public static final int DESCLENStandard Description length.- See Also:
-
-
Constructor Details
-
PrometheusDataItem
Construct a new item.- Parameters:
pList- the list that this item is associated withuId- the Id of the new item (or 0 if not yet known)
-
PrometheusDataItem
Construct a new item.- Parameters:
pList- the list that this item is associated withpValues- the data values
-
PrometheusDataItem
Construct a new item based on an old item.- Parameters:
pList- the list that this item is associated withpBase- the old item
-
-
Method Details
-
getValueSetVersion
public int getValueSetVersion()Obtain valueSet version.- Returns:
- the valueSet version
-
formatObject
Description copied from interface:MetisDataItem.MetisDataObjectFormatObtain Object summary.- Specified by:
formatObjectin interfaceMetisDataItem.MetisDataObjectFormat- Overrides:
formatObjectin classMetisFieldVersionedItem- Parameters:
pFormatter- the data formatter- Returns:
- the display summary of the object
-
getList
Obtain the list.- Returns:
- the list
-
getDataSet
Obtain the dataSet.- Returns:
- the dataSet
-
getStyle
Get the list style for this item.- Returns:
- the list style
-
getItemType
Description copied from class:MetisFieldVersionedItemObtain the itemType.- Overrides:
getItemTypein classMetisFieldVersionedItem- Returns:
- the item type
-
isActive
public boolean isActive()Description copied from interface:MetisDataItem.MetisDataDeletableItemIs this active?- Specified by:
isActivein interfaceMetisDataItem.MetisDataDeletableItem- Returns:
- true/false
-
isDisabled
public boolean isDisabled()Is the item disabled?- Returns:
- true/false
-
getTouchStatus
Obtain the touchStatus.- Returns:
- the touch status
-
isEditable
public boolean isEditable()Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemIs the item editable?- Specified by:
isEditablein interfaceMetisFieldItem.MetisFieldUpdatableItem- Returns:
- true/false
-
isHeader
public boolean isHeader()Description copied from interface:PrometheusTableItemIs this a header?- Specified by:
isHeaderin interfacePrometheusTableItem- 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
Clear the item touches.- Parameters:
pItemType- the item type
-
touchItem
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
Get the base item for this item.- Returns:
- the Base item or
null
-
setBase
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.MetisFieldUpdatableItemObtain the next version for the history.- Specified by:
getNextVersionin interfaceMetisFieldItem.MetisFieldUpdatableItem- Returns:
- the next version
-
popHistory
public void popHistory()Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemRemove the last changes for the history buffer and restore values from it.- Specified by:
popHistoryin interfaceMetisFieldItem.MetisFieldUpdatableItem- Overrides:
popHistoryin classMetisFieldVersionedItem
-
rewindToVersion
public void rewindToVersion(int pVersion) Description copied from class:MetisFieldVersionedItemRewind item to the required version.- Overrides:
rewindToVersionin classMetisFieldVersionedItem- Parameters:
pVersion- the version to rewind to
-
setHistory
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
Description copied from class:MetisFieldVersionedItemDetermines whether a particular field has changed.- Overrides:
fieldChangedin classMetisFieldVersionedItem- Parameters:
pField- the field- Returns:
- the difference
-
setValidEdit
public void setValidEdit()Note that this item has been validated. -
addError
Description copied from class:MetisFieldVersionedItemAdd an error for this item.- Overrides:
addErrorin classMetisFieldVersionedItem- Parameters:
pError- the error textpField- the associated field
-
resolveDataSetLinks
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 resolvepList- the list to resolve against- Throws:
OceanusException- on error
-
includeXmlField
Is the item to be included in output XML?- Parameters:
pField- the field to check- Returns:
- true/false
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<Object>
-
compareValues
compareTo another dataItem.- Parameters:
pThat- the DataItem to compare- Returns:
- the order
-
compareId
compareTo another dataItem.- Parameters:
pThat- the DataItem to compare- Returns:
- the order
-
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
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 elementDirty items become valid.
-
validString
Does the string contain only valid characters (no control chars)?- Parameters:
pString- the stringpDisallowed- the set of additional disallowed characters- Returns:
- true/false
-
byteLength
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
Obtain the field state.- Parameters:
pField- the field- Returns:
- the state
-
getItemState
Obtain the item State.- Returns:
- the state
-