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
public final class SimpleFragment extends Fragment
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimpleFragment.FieldComparatorComparator ofSimpleFragments according to a field.-
Nested classes/interfaces inherited from class org.nuxeo.ecm.core.storage.sql.Fragment
Fragment.State
-
-
Constructor Summary
Constructors Constructor Description SimpleFragment(Row row, Fragment.State state, PersistenceContext context)Constructs aSimpleFragmentfrom aRow.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Serializableget(String key)Gets a value by key.List<String>getDirtyKeys()Gets the dirty keys (keys of values changed since last clear).RowMapper.RowUpdategetRowUpdate()Returns the row update to do in the database to write this value.StringgetString(String key)Returns aStringvalue.voidput(String key, Serializable value)Puts a value by key.protected Fragment.Staterefetch()Refetches this fragment from the database.protected Fragment.StaterefetchDeleted()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 Detail
-
UNKNOWN
public static final SimpleFragment UNKNOWN
-
-
Constructor Detail
-
SimpleFragment
public SimpleFragment(Row row, Fragment.State state, PersistenceContext context)
Constructs aSimpleFragmentfrom aRow.- Parameters:
row- the row, ornullstate- the initial state for the fragmentcontext- the persistence context to which the fragment is tied, ornull
-
-
Method Detail
-
refetch
protected Fragment.State refetch()
Description copied from class:FragmentRefetches this fragment from the database. Needed when an invalidation has been received and the fragment is accessed again.- Specified by:
refetchin classFragment- Returns:
- the new state,
Fragment.State.PRISTINEorFragment.State.ABSENT
-
refetchDeleted
protected Fragment.State refetchDeleted()
Description copied from class:FragmentResets the data for a fragment that was invalidated by deletion.- Specified by:
refetchDeletedin classFragment- Returns:
- the new state,
Fragment.State.PRISTINEorFragment.State.ABSENT
-
get
public Serializable get(String key)
Gets a value by key.- Parameters:
key- the key- Returns:
- the value
-
put
public void put(String key, Serializable value)
Puts a value by key.- Parameters:
key- the keyvalue- the value
-
getString
public String getString(String key)
Returns aStringvalue.- Parameters:
key- the key- Returns:
- the value as a
String - Throws:
ClassCastException- if the value is not aString
-
getRowUpdate
public RowMapper.RowUpdate getRowUpdate()
Description copied from class:FragmentReturns the row update to do in the database to write this value.- Specified by:
getRowUpdatein classFragment- Returns:
- a row update, or
nullif the value is unchanged since last clear
-
-