Class MetisFieldVersionedItem
java.lang.Object
io.github.tonywasher.joceanus.metis.field.MetisFieldVersionedItem
- All Implemented Interfaces:
MetisDataItem.MetisDataDeletableItem,MetisDataItem.MetisDataIndexedItem,MetisDataItem.MetisDataObjectFormat,MetisFieldItem,MetisFieldItem.MetisFieldTableItem,MetisFieldItem.MetisFieldUpdatableItem
- Direct Known Subclasses:
PrometheusDataItem
public abstract class MetisFieldVersionedItem
extends Object
implements MetisFieldItem.MetisFieldTableItem, MetisDataItem.MetisDataDeletableItem, MetisFieldItem.MetisFieldUpdatableItem
Data Version Control.
-
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
ConstructorsModifierConstructorDescriptionprotectedConstructor.protectedConstructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddError(String pError, MetisDataItem.MetisDataFieldId pFieldId) Add an error for this item.voidAdjust State of item.booleanCheck to see whether any changes were made.voidClear all errors for this item.voidClear history.voidcondenseHistory(int pNewVersion) Condense history.Determines whether a particular field has changed.Determines whether a particular field has changed.formatObject(OceanusDataFormatter pFormatter) Obtain Object summary.Obtain the fieldSet.Obtain the editState of item.Obtain error details for a field.getFieldErrors(MetisDataItem.MetisDataFieldId[] pFields) Obtain error details for a set of fields.Get the first error element for an item.Get the Id to index the list.Obtain the itemType.Obtain original Object ValueSet.Obtain the original Version of item.getState()Obtain the State of item.Obtain the Validation.Obtain Object ValueSet.Obtain Object ValueSet History.Obtain the Version of item.Obtain a versioned field.booleanDetermine whether the item has Changes.booleanDetermine whether the item has Errors.booleanhasErrors(MetisDataItem.MetisDataFieldId pFieldId) Determine whether a particular field has Errors.booleanIs there any history.booleanIs this item deleted?booleanisValid()Determine whether the item is Valid.booleanpopItem from the history if equal to current.protected MetisFieldVersionValuesObtain new version values.voidRemove the last changes for the history buffer and restore values from it.voidPush current values into history buffer ready for changes to be made.voidpushHistory(int pVersion) Push history to a specific version.voidReset history.voidrewindToVersion(int pVersion) Rewind item to the required version.voidsetDeleted(boolean pFlag) Set the deleted flags for the item.protected voidsetEditState(MetisDataEditState pState) Set the Edit State.voidSet history explicitly.voidsetIndexedId(Integer pId) Set Id.voidsetItemType(MetisFieldItem.MetisFieldItemType pItemType) Set ItemType.voidsetValues(MetisFieldVersionValues pValues) Initialise the current values.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.tonywasher.joceanus.metis.data.MetisDataItem.MetisDataDeletableItem
isActiveMethods inherited from interface io.github.tonywasher.joceanus.metis.field.MetisFieldItem.MetisFieldUpdatableItem
getNextVersion, isEditable, skipField
-
Constructor Details
-
MetisFieldVersionedItem
protected MetisFieldVersionedItem()Constructor. -
MetisFieldVersionedItem
Constructor.- Parameters:
pValues- the initial values
-
-
Method Details
-
newVersionValues
Obtain new version values.- Returns:
- new values
-
getIndexedId
Description copied from interface:MetisDataItem.MetisDataIndexedItemGet the Id to index the list.- Specified by:
getIndexedIdin interfaceMetisDataItem.MetisDataIndexedItem- Returns:
- the Id
-
setIndexedId
Set Id.- Parameters:
pId- the Id
-
getItemType
Obtain the itemType.- Returns:
- the item type
-
setItemType
Set ItemType.- Parameters:
pItemType- the itemType
-
getState
Obtain the State of item.- Returns:
- the state
-
getEditState
Obtain the editState of item.- Returns:
- the editState
-
getValuesHistory
Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemObtain Object ValueSet History.- Specified by:
getValuesHistoryin interfaceMetisFieldItem.MetisFieldUpdatableItem- Returns:
- the ValueSet of the object
-
getValidation
Obtain the Validation.- Returns:
- the validation
-
getValues
Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemObtain Object ValueSet.- Specified by:
getValuesin interfaceMetisFieldItem.MetisFieldUpdatableItem- Returns:
- the ValueSet of the object
-
getOriginalValues
Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemObtain original Object ValueSet.- Specified by:
getOriginalValuesin interfaceMetisFieldItem.MetisFieldUpdatableItem- Returns:
- the ValueSet of the object
-
getVersion
Obtain the Version of item.- Returns:
- the version
-
getOriginalVersion
Obtain the original Version of item.- Returns:
- the version
-
isDeleted
public boolean isDeleted()Description copied from interface:MetisDataItem.MetisDataDeletableItemIs this item deleted?- Specified by:
isDeletedin interfaceMetisDataItem.MetisDataDeletableItem- Returns:
- true/false
-
setDeleted
public void setDeleted(boolean pFlag) Description copied from interface:MetisDataItem.MetisDataDeletableItemSet the deleted flags for the item.- Specified by:
setDeletedin interfaceMetisDataItem.MetisDataDeletableItem- Parameters:
pFlag- true/false
-
getDataFieldSet
Description copied from interface:MetisFieldItemObtain the fieldSet.- Specified by:
getDataFieldSetin interfaceMetisFieldItem- Returns:
- the fieldSet
-
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
-
setEditState
Set the Edit State.- Parameters:
pState- the Edit Status
-
hasErrors
public boolean hasErrors()Determine whether the item has Errors.- Returns:
true/false
-
hasChanges
public boolean hasChanges()Determine whether the item has Changes.- Returns:
true/false
-
isValid
public boolean isValid()Determine whether the item is Valid.- Returns:
true/false
-
hasErrors
Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemDetermine whether a particular field has Errors.- Specified by:
hasErrorsin interfaceMetisFieldItem.MetisFieldUpdatableItem- Parameters:
pFieldId- the particular field- Returns:
true/false
-
addError
Add an error for this item.- Parameters:
pError- the error textpFieldId- the associated field
-
clearErrors
public void clearErrors()Clear all errors for this item. -
getFirstError
Get the first error element for an item.- Returns:
- the first error (or
null)
-
getFieldErrors
Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemObtain error details for a field.- Specified by:
getFieldErrorsin interfaceMetisFieldItem.MetisFieldUpdatableItem- Parameters:
pField- the field- Returns:
- the error details
-
getFieldErrors
Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemObtain error details for a set of fields.- Specified by:
getFieldErrorsin interfaceMetisFieldItem.MetisFieldUpdatableItem- Parameters:
pFields- the fields- Returns:
- the error details
-
setValues
Initialise the current values.- Parameters:
pValues- the current values
-
pushHistory
public void pushHistory()Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemPush current values into history buffer ready for changes to be made.- Specified by:
pushHistoryin interfaceMetisFieldItem.MetisFieldUpdatableItem
-
pushHistory
public void pushHistory(int pVersion) Push history to a specific version.- Parameters:
pVersion- the 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
-
maybePopHistory
public boolean maybePopHistory()popItem from the history if equal to current.- Returns:
- was a change made
-
hasHistory
public boolean hasHistory()Is there any history.- Returns:
- whether there are entries in the history list
-
clearHistory
public void clearHistory()Clear history. -
resetHistory
public void resetHistory()Reset history. -
setHistory
Set history explicitly.- Parameters:
pBase- the base item
-
checkForHistory
public boolean checkForHistory()Description copied from interface:MetisFieldItem.MetisFieldUpdatableItemCheck to see whether any changes were made. If no changes were made remove last saved history since it is not needed.- Specified by:
checkForHistoryin interfaceMetisFieldItem.MetisFieldUpdatableItem- Returns:
trueif changes were made,falseotherwise
-
condenseHistory
public void condenseHistory(int pNewVersion) Condense history.- Parameters:
pNewVersion- the new maximum version
-
rewindToVersion
public void rewindToVersion(int pVersion) Rewind item to the required version.- Parameters:
pVersion- the version to rewind to
-
fieldChanged
Determines whether a particular field has changed.- Parameters:
pField- the field- Returns:
- the difference
-
fieldChanged
Determines whether a particular field has changed.- Parameters:
pField- the field- Returns:
- the difference
-
adjustState
public void adjustState()Adjust State of item. -
getVersionedField
Obtain a versioned field.- Parameters:
pId- the field id- Returns:
- the versioned field
-