Interface AdaptationTable
osd:table
in the data model.
See
Tables, filters and
selection nodes for more information on declaring tables.
The dataset that contains the table is called
the container dataset. A table is accessed from its container dataset
by calling method ReadContext.getTable(Path)
.
All the records of a table are represented by the class Adaptation
.
As such, they benefit from inheritance features, if
dataset inheritance is enabled.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncomputePrimaryKey
(Adaptation anOccurrence) Returns the same result asAdaptation.getOccurrencePrimaryKey()
.computePrimaryKey
(ValueContext aContext) computePrimaryKey
(Object[] primaryKeyValues) Returns thePrimaryKey
object that corresponds to the specified raw values.Creates a new request for this table.createRequestResult
(String aPredicate) Returns theRequestResult
for the specified predicate.createRequestResult
(String aPredicate, RequestSortCriteria sortCriteria) Returns theRequestResult
for the specified predicate and sort criteria.Returns the dataset that contains this table.Returns the corresponding history table; returnsnull
if history is not activated.Retrieves the date of the most recent modification operation performed on the table.Path[]
Returns the paths of the data model nodes that compose the primary key of this table.Deprecated.Does not work for mapped tables.Returns the node of the table, which is a terminal node, in the dataset.Returns the root node that defines the record structure.Returns the path of the container node.Returns an up-to-date validation report associated with this table.getValidationReport
(boolean ensureActivation) Returns an up-to-date validation report associated with this table.getValidationReport
(boolean ensureActivation, boolean updateValidationReport) Returns the validation report associated with this table.Returns the validation report associated with this table according to the specified properties.boolean
isPrimaryKeyComplete
(ValueContext aContext) Returnsfalse
if at least one field in the primary key in the specified context is not set.Returns the record based on the name specified; returnsnull
if no record by that name exists.Returns the record specified by its primary key.lookupAdaptationByPrimaryKey
(PrimaryKey aKey, boolean includeOcculting) Returns the record specified by its primary key.lookupAdaptationByPrimaryKey
(ValueContext aContext) Returns the record that has its primary key specified by the specified context.lookupAdaptationByPrimaryKey
(ValueContext aContext, boolean includeOcculting) Returns the record specified by its primary key.lookupFirstRecordMatchingPredicate
(boolean checkActualPrimaryKey, String aPredicateExpression) Returns the first record that matches the specified XPath predicate,null
if no such record exists.lookupFirstRecordMatchingPredicate
(boolean checkActualPrimaryKey, String aPredicateExpression, boolean includeOcculting) Returns the first record that matches the specified XPath predicate,null
if no such record exists.lookupFirstRecordMatchingPredicate
(String aPredicateExpression) Returns the first record that matches the specified XPath predicate,null
if no such record exists.void
Resets the validation report of this table.selectOccurrences
(String aPredicateExpression) Returns a list of records for the specified predicate.selectOccurrences
(String aPredicate, RequestSortCriteria sortCriteria) Returns a list of records for the specified predicate and sort criteria.Returns aString
that identifies the table (composed of the dataset reference and table path).
-
Method Details
-
toPublicReference
String toPublicReference()Returns aString
that identifies the table (composed of the dataset reference and table path). -
lookupAdaptationByPrimaryKey
Returns the record that has its primary key specified by the specified context. Returnsnull
if it does not exist or is in occulting mode. -
lookupAdaptationByPrimaryKey
Returns the record specified by its primary key. Returnsnull
if:- the record does not exist in this table or in any ancestor tables, or
- the record with the key specified is in occulting mode and
includeOcculting
isfalse
.
Note: The record that is returned may have been inherited from an ancestor table.
- Parameters:
aContext
- Context that specifies the primary key of the record to look up.includeOcculting
- Iftrue
, a record in occulting mode can be returned. Iffalse
,null
will be returned if the record with the specified primary key is in occulting mode.- See Also:
-
lookupAdaptationByPrimaryKey
Returns the record specified by its primary key. Returnsnull
if it the record does not exist or if it is in occulting mode.To directly retrieve the record from a foreign key value in a given context, it is recommended to invoke the method
SchemaFacetTableRef.getLinkedRecord(ValueContext)
instead. -
lookupAdaptationByPrimaryKey
Returns the record specified by its primary key. Returnsnull
if:- the record does not exist in this table or any ancestor tables, or
- the record with the key specified is in occulting mode and
includeOcculting
isfalse
.
To directly retrieve the record from a foreign key value in a given context, it is recommended to invoke the method
SchemaFacetTableRef.getLinkedRecord(ValueContext)
instead.- Parameters:
aKey
- Identity of the record to look up.includeOcculting
- Iftrue
, a record in occulting mode can be returned. Iffalse
,null
will be returned if the record with the specified primary key is in occulting mode.- See Also:
-
lookupFirstRecordMatchingPredicate
Returns the first record that matches the specified XPath predicate,null
if no such record exists.This method is equivalent to:
AdaptationTable.lookupFirstRecordMatchingPredicate( false, aPredicateExpression, false);
- Since:
- 5.4.3
- See Also:
-
lookupFirstRecordMatchingPredicate
Adaptation lookupFirstRecordMatchingPredicate(boolean checkActualPrimaryKey, String aPredicateExpression) Returns the first record that matches the specified XPath predicate,null
if no such record exists.This method is equivalent to:
AdaptationTable.lookupFirstRecordMatchingPredicate( checkActualPrimaryKey, aPredicateExpression, false);
- Since:
- 5.4.3
- See Also:
-
lookupFirstRecordMatchingPredicate
Adaptation lookupFirstRecordMatchingPredicate(boolean checkActualPrimaryKey, String aPredicateExpression, boolean includeOcculting) Returns the first record that matches the specified XPath predicate,null
if no such record exists.For example, for the predicate
./name='Smith'
, this method would return the first record (in primary key order) with its field 'name' equal to "Smith", ornull
if none exists.If the argument
checkActualPrimaryKey
istrue
, the predicate must specify the value of each primary key field. Using this type of predicate allows for a much faster resolution.- Throws:
IllegalArgumentException
- if one of the specified arguments is not defined.IllegalArgumentException
- if the specifiedAdaptation
is not a dataset.IllegalArgumentException
- ifcheckActualPrimaryKey
istrue
and the specified XPath expression argument is not a primary key expression.MalformedXPathExpressionException
- if the specified XPath expression is not syntactically correct.PathAccessException
- if the extracted table path expression does not reference an existing table node in the underlying structure.- Since:
- 5.4.3
- See Also:
-
computePrimaryKey
Returns the same result asAdaptation.getOccurrencePrimaryKey()
. -
computePrimaryKey
-
computePrimaryKey
Returns thePrimaryKey
object that corresponds to the specified raw values.- Parameters:
primaryKeyValues
- values of the primary key fields. They must be in the same order as the fields declared in in theosd:table/primaryKeys
element.- Throws:
IllegalArgumentException
- if either the argument or theosd:table/primaryKeys
element isnull
, if the specified array does not have the same length as theosd:table/primaryKeys
element, or if a value in the argument is not of the expected type.ClassCastException
- if a value in the specified array is not of the expected Java type.- See Also:
-
isPrimaryKeyComplete
Returnsfalse
if at least one field in the primary key in the specified context is not set. -
getPrimaryKeySpec
Path[] getPrimaryKeySpec()Returns the paths of the data model nodes that compose the primary key of this table. -
getTableOccurrenceRootNode
SchemaNode getTableOccurrenceRootNode()Returns the root node that defines the record structure.- See Also:
-
getTableNode
SchemaNode getTableNode()Returns the node of the table, which is a terminal node, in the dataset. -
getContainerAdaptation
Adaptation getContainerAdaptation()Returns the dataset that contains this table. -
getLastModificationDate
Date getLastModificationDate()Retrieves the date of the most recent modification operation performed on the table. A modification operation is any record creation, update, or deletion within the table. If the table is empty, and never contained any records, the method instead returns the creation date of the container dataspace.- Since:
- 6.0.6
-
getHistory
AdaptationTable getHistory()Returns the corresponding history table; returnsnull
if history is not activated.The returned table has the same structure as this table, except:
- the primary key has a first field specifying the transaction,
ebx-technical/tx_id
, then has the functional primary key fields; - the nodes ignored by the history are not present (for instance, computed values and fields explicitly disabling history);
- some transaction-related fields are added, such as
ebx-technical/tx_id
,ebx-technical/dataspace
,ebx-technical/timestamp
,ebx-technical/op
, andebx-technical/user
. The paths of these fields are also available in the user interface; - an additional operation fields is added for each historized functional field.
Operation fields are defined under the group
ebx-operationCode
. For example, a historized functional fieldname
will be associated with an operation fieldebx-operationCode/name
. For more information regarding the values of these fields, see Operation field values.
- Since:
- 5.2.0
- See Also:
- the primary key has a first field specifying the transaction,
-
getTablePath
Path getTablePath()Returns the path of the container node. -
getRootKey
Deprecated.Does not work for mapped tables.Returns the key to the virtual root record of this table. This technical record is not seen by the end user, but is useful for managing a hierarchical set of all records in this table and its descendants, for example for performing a deletion.Each table has a unique virtual root record that exists even if the table is empty. The virtual root record itself is not persisted, and does not support modifications.
- Returns:
- the key of the virtual root record of this table.
- See Also:
-
lookupAdaptationByName
Returns the record based on the name specified; returnsnull
if no record by that name exists. -
createRequest
Request createRequest()Creates a new request for this table. -
createRequestResult
Returns theRequestResult
for the specified predicate and sort criteria.This method is equivalent to the method
selectOccurrences(String)
.Performance considerations: If the specified predicate must be often reused by multiple
Request
objects, it is recommended to use a cached filter. Parameterized expressions also help reuse.- Parameters:
aPredicate
- Simplified XPath expression of a filter to be applied to the table records. Ifnull
, no filter is applied.sortCriteria
- Criteria for sorting the result. Ifnull
, no sort order is applied.- See Also:
-
createRequestResult
Returns theRequestResult
for the specified predicate.This method is equivalent to the method
selectOccurrences(String)
.Performance considerations: If the specified predicate must be often reused by multiple
Request
objects, it is recommended to use a cached filter. Parameterized expressions also help reuse.- Parameters:
aPredicate
- Simplified XPath expression of a filter to apply to the table records. Ifnull
, no filter is applied.- See Also:
-
selectOccurrences
Returns a list of records for the specified predicate and sort criteria.This method is equivalent to the method
createRequestResult(String)
, but is not recommended for a large number of results.Performance considerations: If the specified predicate must be often reused by multiple
Request
objects, it is recommended to use a cached filter. Parameterized expressions also help reuse.- Parameters:
aPredicate
- Simplified XPath expression of a filter to apply on the table records. Ifnull
, no filter is applied.sortCriteria
- Criteria for sorting the result. Ifnull
, no sort order is applied.- Returns:
- a
List
of records, where each element is anAdaptation
. - See Also:
-
selectOccurrences
Returns a list of records for the specified predicate.This method is equivalent to the method
createRequestResult(String)
, but is not recommended for a large number of results.Performance considerations: If the specified predicate will often be reused by multiple
Request
objects, it is recommended to use a cached filter. Parameterized expressions also help reuse.- Parameters:
aPredicateExpression
- Simplified XPath expression of a filter to apply on table records. Ifnull
, no filter is applied.- Returns:
- a
List
of records, where each element is anAdaptation
. - See Also:
-
getValidationReport
ValidationReport getValidationReport()Returns an up-to-date validation report associated with this table.This method is equivalent to:
AdaptationTable.getValidationReport(true);
-
getValidationReport
Returns the validation report associated with this table according to the specified properties. The validation takes into account all the various constraints defined by the underlying data model.The report returned by this method is not affected by updates performed after this method is called. The rules for ensuring that data in EBX® remains valid (regarding possible concurrent updates) are explained in the section Consistency and validation.
Limitation: this method should not be called inside a programmatic constraint or a value function with the argument
updateValidationReport
set totrue
, since the computation of an up-to-date validation report is not supported during a validation process and may cause inconsistent results. In this case, the methodAdaptationTable.getValidationReport(..., false)
should be used instead inside a programmatic constraint or a value function.Limitation: a validation report is only valid as long as the dataspace remains open. If the report is accessed in any way after the dataspace has been closed or deleted, a runtime exception may be thrown.
- Throws:
IllegalStateException
- if the current table holds data that is not subject to validation. This is the case, for instance, for the history.- Since:
- 5.9.0
- See Also:
-
getValidationReport
Returns an up-to-date validation report associated with this table. The validation takes into account all the various constraints defined by the underlying data model.The report returned by this method is not affected by updates performed after this method is called. The rules for ensuring that data in EBX® remains valid (regarding possible concurrent updates) are explained in section Consistency and validation.
This method is equivalent to:
AdaptationTable.getValidationReport(ensureActivation, true);
- Parameters:
ensureActivation
- iftrue
, the validation also checks that the dataset isactivated
(it adds an error if this is not the case).- See Also:
-
getValidationReport
Returns the validation report associated with this table.This method is equivalent to:
ValidationSpec spec = new ValidationSpec(); spec.setEnsureActivation(ensureActivation); spec.setRefreshPolicy(updateValidationReport ? RefreshPolicy.UP_TO_DATE : RefreshPolicy.AS_IS); AdaptationTable.getValidationReport(spec);
-
resetValidationReport
void resetValidationReport()Resets the validation report of this table.- Since:
- 5.9.0
- See Also:
-