public abstract class Fragment extends Object implements Serializable
In addition to the basic Row
, this holds the old values (to check dirty state), the state and a reference to
the session.
This class has two kinds of state-changing methods:
Modifier and Type | Class and Description |
---|---|
static class |
Fragment.State
The possible states of a fragment.
|
Modifier and Type | Field and Description |
---|---|
protected PersistenceContext |
context |
protected Serializable[] |
oldvalues
The row old values, from the time of construction / refetch.
|
protected Row |
row
The row holding the data.
|
Modifier | Constructor and Description |
---|---|
protected |
Fragment(Row row,
Fragment.State state,
PersistenceContext context)
|
Modifier and Type | Method and Description |
---|---|
protected void |
accessed()
Checks that access to the fragment is possible.
|
void |
clearDirty()
Clears the dirty state.
|
Serializable |
getId()
Gets the id.
|
abstract RowMapper.RowUpdate |
getRowUpdate()
Returns the row update to do in the database to write this value.
|
Fragment.State |
getState()
Gets the state.
|
protected void |
markModified()
Marks the fragment modified.
|
protected abstract Fragment.State |
refetch()
Refetches this fragment from the database.
|
protected abstract Fragment.State |
refetchDeleted()
Resets the data for a fragment that was invalidated by deletion.
|
protected void |
setDeleted(boolean primary)
Marks the fragment deleted.
|
protected void |
setDetached()
Detaches the fragment from its persistence context.
|
void |
setId(Serializable id)
Sets the id.
|
protected void |
setInvalidatedDeleted()
Sets the fragment in the "invalidated from a deletion" state.
|
protected void |
setInvalidatedModified()
Sets the fragment in the "invalidated from a modification" state.
|
protected void |
setPristine()
Sets the (created/modified) fragment in the pristine state.
|
String |
toString() |
protected Serializable[] oldvalues
#row.values.length
.protected PersistenceContext context
protected Fragment(Row row, Fragment.State state, PersistenceContext context)
row
- the rowstate
- the initial state for the fragmentcontext
- the persistence context to which the fragment is tied, or null
public Fragment.State getState()
public void setId(Serializable id)
id
- the new persistent idpublic Serializable getId()
public void clearDirty()
public abstract RowMapper.RowUpdate getRowUpdate()
null
if the value is unchanged since last clearprotected abstract Fragment.State refetch()
Fragment.State.PRISTINE
or Fragment.State.ABSENT
protected abstract Fragment.State refetchDeleted()
Fragment.State.PRISTINE
or Fragment.State.ABSENT
protected void accessed()
protected void markModified()
protected void setDeleted(boolean primary)
protected void setDetached()
protected void setPristine()
protected void setInvalidatedModified()
protected void setInvalidatedDeleted()
Copyright © 2016 Nuxeo SA. All rights reserved.