Package org.nuxeo.ecm.core.storage.sql
Class Row
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.RowId
-
- org.nuxeo.ecm.core.storage.sql.Row
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<RowId>
public final class Row extends RowId implements Serializable, Cloneable
The data of a single row in a table (keys/values form a map), or of multiple rows with the same id (values is an array of Serializable).The id of the row is distinguished internally from other columns. For fragments corresponding to created data, the initial id is a temporary one, and it will be changed after database insert.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]
keys
The row keys, for single row.static int
MAX_ARRAY
static int
MAX_STRING
static Serializable
OPAQUE
A database value we don't care about reading.protected int
size
The size of the allocated part ofvalues
, for single rows.Serializable[]
values
The row values.
-
Constructor Summary
Constructors Constructor Description Row(String tableName, Serializable id)
Constructs an emptyRow
for the given table with the given id (may benull
).Row(String tableName, Serializable id, Serializable[] array)
Constructs a newRow
from an array of values.Row(String tableName, Map<String,Serializable> map)
Constructs a newRow
from a map.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Row
clone()
Serializable
get(String key)
Gets a value from a key.List<String>
getKeys()
Gets the list of keys.List<Serializable>
getValues()
Gets the list of values.boolean
isCollection()
static void
printValue(Serializable value, StringBuilder sb)
void
put(String key, Serializable value)
Puts a key/value.void
put(String key, Serializable value, Serializable[] oldvalues)
Puts a key/value where the current or new value may be a delta.void
putNew(String key, Serializable value)
Puts a key/value, assuming the key is not already there.String
toString()
-
-
-
Field Detail
-
OPAQUE
public static final Serializable OPAQUE
A database value we don't care about reading. When present in a fragment, it won't be written, but any other value will be.
-
keys
protected String[] keys
The row keys, for single row.
-
values
public Serializable[] values
The row values.
-
size
protected int size
The size of the allocated part ofvalues
, for single rows.
-
MAX_STRING
public static final int MAX_STRING
- See Also:
- Constant Field Values
-
MAX_ARRAY
public static final int MAX_ARRAY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Row
public Row(String tableName, Serializable id)
Constructs an emptyRow
for the given table with the given id (may benull
).
-
Row
public Row(String tableName, Map<String,Serializable> map)
Constructs a newRow
from a map.- Parameters:
map
- the initial data to use
-
Row
public Row(String tableName, Serializable id, Serializable[] array)
Constructs a newRow
from an array of values.- Parameters:
array
- the initial data to use
-
-
Method Detail
-
isCollection
public boolean isCollection()
-
put
public void put(String key, Serializable value)
Puts a key/value. Does not deal with deltas.- Parameters:
key
- the keyvalue
- the value
-
put
public void put(String key, Serializable value, Serializable[] oldvalues)
Puts a key/value where the current or new value may be a delta. To resolve a delta, the oldvalues (in-database state) must be consulted.- Parameters:
key
- the keyvalue
- the valueoldvalues
- the old values
-
putNew
public void putNew(String key, Serializable value)
Puts a key/value, assuming the key is not already there.- Parameters:
key
- the keyvalue
- the value
-
get
public Serializable get(String key)
Gets a value from a key.- Parameters:
key
- the key- Returns:
- the value
-
getValues
public List<Serializable> getValues()
Gets the list of values. The id is not included.
-
printValue
public static void printValue(Serializable value, StringBuilder sb)
-
-