public class VirtualTable.VirtualTableRow extends Object implements Serializable
VirtualTable
.Modifier and Type | Method and Description |
---|---|
void |
delete(boolean synchronizeDB)
Deletes a
VirtualTable.VirtualTableRow from its VirtualTable . |
boolean |
equals(Object obj) |
boolean |
equalsValues(VirtualTable.VirtualTableRow other)
Checks if the values of this row are the same as the values of an
other row. |
String |
format(String str)
Returns a formatted string, with this row used as
StringUtils.ParameterProvider . |
Object |
get(int i)
Returns the value at the specified column index.
|
Object |
get(String name)
Returns the value at the specified column.
|
<T> T |
get(VirtualTableColumn<T> column)
Returns the value at the specified column.
|
String |
getFormattedValue(int col)
Returns a formatted representation for the value at
col . |
PessimisticLock |
getPessimisticLock()
Returns a
PessimisticLock related to this row. |
PessimisticLock |
getPessimisticLock(long lockTime)
Returns a
PessimisticLock related to this row, with the given
locktime as lock duration. |
VirtualTable.RowState |
getRowState()
Returns the state of this row
|
Object[] |
getValues()
Returns all values of this row as an array.
|
VirtualTable |
getVirtualTable()
Returns the surrounding
VirtualTable of this
VirtualTable.VirtualTableRow . |
void |
insert(Map<String,Object> data,
boolean synchronizeDB)
Inserts a
VirtualTable.VirtualTableRow into its VirtualTable . |
void |
insert(Map<String,Object> data,
boolean synchronizeDB,
DBConnection connection)
Inserts a
VirtualTable.VirtualTableRow into its VirtualTable . |
boolean |
isNew()
Checks if this
VirtualTable.VirtualTableRow exists in the
VirtualTable . |
void |
reload()
Reloads the contents of this
VirtualTable.VirtualTableRow from the
database. |
void |
reload(DBDataSource dataSource)
Reloads the contents of this
VirtualTable.VirtualTableRow from the
database. |
void |
reloadDefault()
Reloads the contents of this
VirtualTable.VirtualTableRow from the
database with the default query. |
void |
reloadDefault(DBDataSource dataSource)
Reloads the contents of this
VirtualTable.VirtualTableRow from the
database with the default query. |
void |
save(boolean synchronizeDB)
Saves a
VirtualTable.VirtualTableRow . |
void |
save(boolean synchronizeDB,
DBConnection connection)
Saves a
VirtualTable.VirtualTableRow . |
void |
save(Map<String,Object> data,
boolean synchronizeDB)
Saves a
VirtualTable.VirtualTableRow . |
void |
save(Map<String,Object> data,
boolean synchronizeDB,
DBConnection connection)
Saves a
VirtualTable.VirtualTableRow . |
Object |
set(int index,
Object value)
Sets a value for this
VirtualTable.VirtualTableRow at the specified column
index. |
Object |
set(String columnName,
Object value)
Sets a value for this
VirtualTable.VirtualTableRow at the specified column
index. |
void |
setRowState(VirtualTable.RowState rowState)
Updates the state of this row.
|
int |
size()
Returns the number of columns of this
VirtualTable.VirtualTableRow . |
String[] |
toFormattedStrings()
Returns an array of formatted
String representations for this
VirtualTable.VirtualTableRow . |
XdevList |
toList()
Returns all values of this row as a
XdevList . |
Map<String,Object> |
toMap()
Returns all values of this row as an
Map . |
String |
toString()
Custom toString Implementation for
VirtualTable.VirtualTableRow . |
void |
update(Map<String,Object> data,
boolean synchronizeDB)
Updates a
VirtualTable.VirtualTableRow . |
void |
update(Map<String,Object> data,
boolean synchronizeDB,
DBConnection connection)
Updates a
VirtualTable.VirtualTableRow . |
void |
updateKeys(Result generatedKeys)
Updates the auto value columns with values from
generatedKeys . |
public PessimisticLock getPessimisticLock(long lockTime) throws LockingException
PessimisticLock
related to this row, with the given
locktime as lock duration.
This should be used to create a PessimisticLock
instance with
the given lockTime.
To actually lock this VirtualTable.VirtualTableRow
invoke
PessimisticLock.getLock()
lockTime
- the locks duration.PessimisticLock
instance for this particular row.LockingException
public PessimisticLock getPessimisticLock() throws LockingException
PessimisticLock
related to this row. If the lock
does not already exist, a new PessimisticLock
instance with
its default timeout will be created in consequence.
To actually lock this VirtualTable.VirtualTableRow
invoke
PessimisticLock.getLock()
PessimisticLock
instance for this particular row.LockingException
public VirtualTable getVirtualTable()
VirtualTable
of this
VirtualTable.VirtualTableRow
.VirtualTable
public Object set(String columnName, Object value) throws VirtualTableException, IllegalArgumentException
VirtualTable.VirtualTableRow
at the specified column
index.columnName
- the name of the columnvalue
- the new value of the columnVirtualTableException
- if the value is not appropriate for the specified columnIllegalArgumentException
- if the column columnName
does not exist in
this VirtualTable
public Object set(int index, Object value) throws VirtualTableException
VirtualTable.VirtualTableRow
at the specified column
index.index
- the index of the column to setvalue
- the new value of the columnVirtualTableException
- if the value is not appropriate for the specified columnpublic Object get(int i)
i
- the index of the columnpublic Object get(String name)
name
- the name of the columnpublic <T> T get(VirtualTableColumn<T> column)
column
- VirtualTableColumn
public String getFormattedValue(int col)
col
.
The TextFormat of the VirtualTableColumn at index col
is
used to format the value.col
- the index of the column (0-based)String
representation of the specified
value.public String format(String str)
StringUtils.ParameterProvider
.str
- the String
to identify the value's in the
StringUtils.ParameterProvider
StringUtils.format(String, ParameterProvider)
,
VirtualTable.formatValue(Object, int)
public int size()
VirtualTable.VirtualTableRow
.public boolean isNew()
VirtualTable.VirtualTableRow
exists in the
VirtualTable
.false
if this VirtualTable.VirtualTableRow
exists in
the VirtualTable
, true
otherwisepublic void save(boolean synchronizeDB) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
.
If the VirtualTable.VirtualTableRow
is already part of a
VirtualTable
, an update is performed. Otherwise an insert
will be done.
synchronizeDB
- if set to true
, changes will be propagated to
the underlying data source.VirtualTableException
DBException
- thrown if database access failed.public void save(boolean synchronizeDB, DBConnection connection) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
.
If the VirtualTable.VirtualTableRow
is already part of a
VirtualTable
, an update is performed. Otherwise an insert
will be done.
synchronizeDB
- if set to true
, changes will be propagated to
the underlying data source.connection
- An already open connection, e.g. in a transaction, or
null
VirtualTableException
DBException
- thrown if database access failed.public void save(Map<String,Object> data, boolean synchronizeDB) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
.
If the VirtualTable.VirtualTableRow
is already part of a
VirtualTable
, an update is performed. Otherwise an insert
will be done.
data
- a Map
of String
keys and Object
as
values, containing the column names and values for the
row.synchronizeDB
- if set to true
, changes will be propagated to
the underlying data source.VirtualTableException
DBException
- thrown if database access failed.public void save(Map<String,Object> data, boolean synchronizeDB, DBConnection connection) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
.
If the VirtualTable.VirtualTableRow
is already part of a
VirtualTable
, an update is performed. Otherwise an insert
will be done.
data
- a Map
of String
keys and Object
as
values, containing the column names and values for the
row.synchronizeDB
- if set to true
, changes will be propagated to
the underlying data source.connection
- An already open connection, e.g. in a transaction, or
null
VirtualTableException
DBException
- thrown if database access failed.public void update(Map<String,Object> data, boolean synchronizeDB) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
.data
- a Map
of String
keys and Object
as
values, containing the column names and values for the
row.synchronizeDB
- if set to true
, changes will be propagated to
database.VirtualTableException
DBException
- thrown if database access failed.public void update(Map<String,Object> data, boolean synchronizeDB, DBConnection connection) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
.data
- a Map
of String
keys and Object
as
values, containing the column names and values for the
row.synchronizeDB
- if set to true
, changes will be propagated to
database.connection
- An already open connection, e.g. in a transaction, or
null
VirtualTableException
DBException
- thrown if database access failed.public void insert(Map<String,Object> data, boolean synchronizeDB) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
into its VirtualTable
.data
- a Map
of String
keys and Object
as
values, containing the column names and values for the
row.synchronizeDB
- if set to true
, changes will be propagated to
database.VirtualTableException
DBException
- thrown if database access failed.public void insert(Map<String,Object> data, boolean synchronizeDB, DBConnection connection) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
into its VirtualTable
.data
- a Map
of String
keys and Object
as
values, containing the column names and values for the
row.synchronizeDB
- if set to true
, changes will be propagated to
database.connection
- An already open connection, e.g. in a transaction, or
null
VirtualTableException
DBException
- thrown if database access failed.public void delete(boolean synchronizeDB) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
from its VirtualTable
.synchronizeDB
- if set to true
, changes will be propagated to
database.VirtualTableException
DBException
- thrown if database access failed.public void reload() throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
from the
database.
This is an alias for reload(DBDataSource)
.
VirtualTableException
DBException
- thrown if database access failed.public void reload(DBDataSource dataSource) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
from the
database.dataSource
- the DBDataSource
to be used to do the reloadsVirtualTableException
DBException
- thrown if database access failed.public void reloadDefault() throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
from the
database with the default query.
This is an alias for reloadDefault(DBDataSource)
.
dataSource
- the DBDataSource
to be used to do the reloadsVirtualTableException
DBException
- thrown if database access failed.public void reloadDefault(DBDataSource dataSource) throws VirtualTableException, DBException
VirtualTable.VirtualTableRow
from the
database with the default query.VirtualTableException
DBException
- thrown if database access failed.public String toString()
VirtualTable.VirtualTableRow
.
The String contains all elements of the VirtualTableRow in a comma separated list
toString
in class Object
String
representation of this
VirtualTable.VirtualTableRow
.public String[] toFormattedStrings()
String
representations for this
VirtualTable.VirtualTableRow
.public Map<String,Object> toMap()
Map
. The keys of the map
are the column names, the entries are the values.Map
.public XdevList toList()
XdevList
.XdevList
.public Object[] getValues()
public boolean equalsValues(VirtualTable.VirtualTableRow other)
other
row.other
- The row to comparetrue
if the values of both rows are equal,
false
otherwiseVirtualTable.equals(Object, Object)
public void updateKeys(Result generatedKeys) throws DBException
generatedKeys
.
This method gets called automatically after a row is inserted into the database.
generatedKeys
- the generated key valuesDBException
- if an database error occurspublic VirtualTable.RowState getRowState()
public void setRowState(VirtualTable.RowState rowState)
rowState
- the new stateCopyright © 2003–2021 XDEV Software. All rights reserved.