Package org.nuxeo.ecm.core.storage.sql
Class SimpleFragment
java.lang.Object
org.nuxeo.ecm.core.storage.sql.Fragment
org.nuxeo.ecm.core.storage.sql.SimpleFragment
- All Implemented Interfaces:
Serializable
A type of fragment corresponding to a single row in a table and its associated in-memory information (state, dirty
fields, attached context).
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Comparator ofSimpleFragment
s according to a field.Nested classes/interfaces inherited from class org.nuxeo.ecm.core.storage.sql.Fragment
Fragment.State
-
Field Summary
-
Constructor Summary
ConstructorDescriptionSimpleFragment
(Row row, Fragment.State state, PersistenceContext context) Constructs aSimpleFragment
from aRow
. -
Method Summary
Modifier and TypeMethodDescriptionGets a value by key.Gets the dirty keys (keys of values changed since last clear).Returns the row update to do in the database to write this value.Returns aString
value.void
put
(String key, Serializable value) Puts a value by key.protected Fragment.State
refetch()
Refetches this fragment from the database.protected Fragment.State
Resets the data for a fragment that was invalidated by deletion.Methods inherited from class org.nuxeo.ecm.core.storage.sql.Fragment
accessed, clearDirty, getId, getState, markModified, setDeleted, setDetached, setId, setInvalidatedDeleted, setInvalidatedModified, setPristine, toString
-
Field Details
-
UNKNOWN
-
-
Constructor Details
-
SimpleFragment
Constructs aSimpleFragment
from aRow
.- Parameters:
row
- the row, ornull
state
- the initial state for the fragmentcontext
- the persistence context to which the fragment is tied, ornull
-
-
Method Details
-
refetch
Description copied from class:Fragment
Refetches this fragment from the database. Needed when an invalidation has been received and the fragment is accessed again.- Specified by:
refetch
in classFragment
- Returns:
- the new state,
Fragment.State.PRISTINE
orFragment.State.ABSENT
-
refetchDeleted
Description copied from class:Fragment
Resets the data for a fragment that was invalidated by deletion.- Specified by:
refetchDeleted
in classFragment
- Returns:
- the new state,
Fragment.State.PRISTINE
orFragment.State.ABSENT
-
get
Gets a value by key.- Parameters:
key
- the key- Returns:
- the value
-
put
Puts a value by key.- Parameters:
key
- the keyvalue
- the value
-
getString
Returns aString
value.- Parameters:
key
- the key- Returns:
- the value as a
String
- Throws:
ClassCastException
- if the value is not aString
-
getRowUpdate
Description copied from class:Fragment
Returns the row update to do in the database to write this value.- Specified by:
getRowUpdate
in classFragment
- Returns:
- a row update, or
null
if the value is unchanged since last clear
-
getDirtyKeys
Gets the dirty keys (keys of values changed since last clear).- Returns:
- the dirty keys
-