public 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.
Request
Modifier and Type | Method and Description |
---|---|
PrimaryKey |
computePrimaryKey(Adaptation anOccurrence)
Returns the same result as
Adaptation.getOccurrencePrimaryKey() . |
PrimaryKey |
computePrimaryKey(Object[] primaryKeyValues)
Returns the
PrimaryKey object that corresponds to
the specified raw values. |
PrimaryKey |
computePrimaryKey(ValueContext aContext) |
Request |
createRequest()
Creates a new request for this table.
|
RequestResult |
createRequestResult(String aPredicate)
Returns the
RequestResult for the specified predicate. |
RequestResult |
createRequestResult(String aPredicate,
RequestSortCriteria sortCriteria)
Returns the
RequestResult for the specified predicate and sort criteria. |
Adaptation |
getContainerAdaptation()
Returns the dataset that contains this table.
|
AdaptationTable |
getHistory()
Returns the corresponding history table; returns
null if history is not activated. |
Date |
getLastModificationDate()
Returns the last modification date of a table; that is, the date when any record creation,
modification and deletion last happened for this table.
|
Path[] |
getPrimaryKeySpec()
Returns the paths of the data model nodes that compose the primary key of this
table.
|
AdaptationName |
getRootKey()
Deprecated.
Does not work for mapped tables.
|
SchemaNode |
getTableNode()
Returns the node of the table, which is a terminal node, in the dataset.
|
SchemaNode |
getTableOccurrenceRootNode()
Returns the root node that defines the record structure.
|
Path |
getTablePath()
Returns the path of the container node.
|
ValidationReport |
getValidationReport()
Returns an up-to-date validation report associated with this table.
|
ValidationReport |
getValidationReport(boolean ensureActivation)
Returns an up-to-date validation report associated with this table.
|
ValidationReport |
getValidationReport(boolean ensureActivation,
boolean updateValidationReport)
Returns the validation report associated with this table.
|
ValidationReport |
getValidationReport(ValidationSpec aSpec)
Returns the validation report associated with this table
according to the specified properties.
|
boolean |
isPrimaryKeyComplete(ValueContext aContext)
Returns
false if at least one field in the primary key in the specified context is not set. |
Adaptation |
lookupAdaptationByName(AdaptationName aName)
Returns the record based on the name specified; returns
null if no
record by that name exists. |
Adaptation |
lookupAdaptationByPrimaryKey(PrimaryKey aKey)
Returns the record specified by its primary key.
|
Adaptation |
lookupAdaptationByPrimaryKey(PrimaryKey aKey,
boolean includeOcculting)
Returns the record specified by its primary key.
|
Adaptation |
lookupAdaptationByPrimaryKey(ValueContext aContext)
Returns the record that has its primary key specified by the specified context.
|
Adaptation |
lookupAdaptationByPrimaryKey(ValueContext aContext,
boolean includeOcculting)
Returns the record specified by its primary key.
|
Adaptation |
lookupFirstRecordMatchingPredicate(boolean checkActualPrimaryKey,
String aPredicateExpression)
Returns the first record that matches the specified XPath predicate,
null if no such record exists. |
Adaptation |
lookupFirstRecordMatchingPredicate(boolean checkActualPrimaryKey,
String aPredicateExpression,
boolean includeOcculting)
Returns the first record that matches the specified XPath predicate,
null if no such record exists. |
Adaptation |
lookupFirstRecordMatchingPredicate(String aPredicateExpression)
Returns the first record that matches the specified XPath predicate,
null if no such record exists. |
void |
resetValidationReport()
Resets the validation report of this table.
|
List<Adaptation> |
selectOccurrences(String aPredicateExpression)
Returns a list of records for the specified predicate.
|
List<Adaptation> |
selectOccurrences(String aPredicate,
RequestSortCriteria sortCriteria)
Returns a list of records for the specified predicate and sort criteria.
|
String |
toPublicReference()
Returns a
String that identifies the table (composed of
the dataset reference and table path). |
String toPublicReference()
String
that identifies the table (composed of
the dataset reference and table path).Adaptation lookupAdaptationByPrimaryKey(ValueContext aContext)
null
if it does not exist or is in occulting mode.Adaptation lookupAdaptationByPrimaryKey(ValueContext aContext, boolean includeOcculting)
null
if:
includeOcculting
is false
.
Note: The record that is returned may have been inherited from an ancestor table.
aContext
- Context that specifies the primary key of the record to look up.includeOcculting
- If true
, a record in occulting mode can be returned. If false
,
null
will be returned if the record with the specified primary key is in
occulting mode.Adaptation.isOccurrenceOcculting()
Adaptation lookupAdaptationByPrimaryKey(PrimaryKey aKey)
null
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.
Adaptation lookupAdaptationByPrimaryKey(PrimaryKey aKey, boolean includeOcculting)
null
if:
includeOcculting
is false
.
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.
aKey
- Identity of the record to look up.includeOcculting
- If true
, a record in occulting mode can be returned. If false
,
null
will be returned if the record with the specified primary key is in
occulting mode.Adaptation.isOccurrenceOcculting()
,
SchemaFacetTableRef.getLinkedRecord(ValueContext)
Adaptation lookupFirstRecordMatchingPredicate(String aPredicateExpression)
null
if no such record exists.
This method is equivalent to:
AdaptationTable.lookupFirstRecordMatchingPredicate( false, aPredicateExpression, false);
lookupFirstRecordMatchingPredicate(boolean, String, boolean)
Adaptation lookupFirstRecordMatchingPredicate(boolean checkActualPrimaryKey, String aPredicateExpression)
null
if no such record exists.
This method is equivalent to:
AdaptationTable.lookupFirstRecordMatchingPredicate( checkActualPrimaryKey, aPredicateExpression, false);
lookupFirstRecordMatchingPredicate(boolean, String, boolean)
Adaptation lookupFirstRecordMatchingPredicate(boolean checkActualPrimaryKey, String aPredicateExpression, boolean includeOcculting)
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", or null
if none exists.
If the argument checkActualPrimaryKey
is true
,
the predicate must specify the value of each primary key field.
Using this type of predicate allows for a much faster resolution.
IllegalArgumentException
- if one of the specified arguments is not defined.IllegalArgumentException
- if the specified Adaptation
is not a dataset.IllegalArgumentException
- if checkActualPrimaryKey
is true
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.XPathExpressionHelper.lookupFirstRecordMatchingXPath(boolean, Adaptation, String, boolean)
PrimaryKey computePrimaryKey(Adaptation anOccurrence)
Adaptation.getOccurrencePrimaryKey()
.PrimaryKey computePrimaryKey(ValueContext aContext)
PrimaryKey computePrimaryKey(Object[] primaryKeyValues)
PrimaryKey
object that corresponds to
the specified raw values.primaryKeyValues
- values of the primary key fields. They must be in the
same order as the fields declared in
in the osd:table/primaryKeys
element.IllegalArgumentException
- if either the argument or the osd:table/primaryKeys
element is
null
,
if the specified array does not have the same length as the
osd: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.SchemaNode.getTablePrimaryKeyNodes()
,
SchemaNode.getTablePrimaryKeyValues(String)
,
SchemaFacetTableRef.getLinkedRecord(ValueContext)
boolean isPrimaryKeyComplete(ValueContext aContext)
false
if at least one field in the primary key in the specified context is not set.Path[] getPrimaryKeySpec()
SchemaNode getTableOccurrenceRootNode()
getTableNode()
SchemaNode getTableNode()
Adaptation getContainerAdaptation()
Date getLastModificationDate()
AdaptationTable getHistory()
null
if history is not activated.
The returned table has the same structure as this table, except:
ebx-technical/tx_id
,
then has the functional primary key fields;ebx-technical/tx_id
,
ebx-technical/dataspace
,
ebx-technical/timestamp
,
ebx-technical/op
, and
ebx-technical/user
. The paths of these fields
are also available in the user interface;
ebx-operationCode
.
For example, a historized functional field name
will be associated with an operation field
ebx-operationCode/name
. For more information regarding the values of these fields,
see Operation field values.
Adaptation.isHistory()
,
SchemaNode.isHistoryDisabled()
Path getTablePath()
AdaptationName getRootKey()
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.
AdaptationHome.findAllDescendants(Adaptation)
,
ProcedureContext.doDelete(AdaptationName, boolean)
Adaptation lookupAdaptationByName(AdaptationName aName)
null
if no
record by that name exists.Request createRequest()
RequestResult createRequestResult(String aPredicate, RequestSortCriteria sortCriteria)
RequestResult
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.
aPredicate
- Simplified XPath expression of a filter to be applied to the table records. If
null
, no filter is applied.sortCriteria
- Criteria for sorting the result. If null
, no sort order is applied.Request.setXPathFilter(XPathFilter)
,
Request.setSortCriteria(RequestSortCriteria)
RequestResult createRequestResult(String aPredicate)
RequestResult
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.
aPredicate
- Simplified XPath expression of a filter to apply to the table records. If
null
, no filter is applied.Request.setXPathFilter(XPathFilter)
List<Adaptation> selectOccurrences(String aPredicate, RequestSortCriteria sortCriteria)
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.
aPredicate
- Simplified XPath expression of a filter to apply on the table records. If
null
, no filter is applied.sortCriteria
- Criteria for sorting the result. If null
, no sort order is applied.List
of records, where each element is an Adaptation
.Request.setXPathFilter(XPathFilter)
List<Adaptation> selectOccurrences(String aPredicateExpression)
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.
aPredicateExpression
- Simplified XPath expression of a filter to apply on table records. If
null
, no filter is applied.List
of records, where each element is an Adaptation
.Request.setXPathFilter(XPathFilter)
ValidationReport getValidationReport()
This method is equivalent to:
AdaptationTable.getValidationReport(true);
ValidationReport getValidationReport(ValidationSpec aSpec)
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 to true
,
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 method AdaptationTable.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.
IllegalStateException
- if the current table holds data that is not subject to validation.
This is the case, for instance, for the history.ValidationSpec
ValidationReport getValidationReport(boolean ensureActivation)
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);
ensureActivation
- if true
, the validation also checks that the dataset is
activated
(it adds an error if this is not the case).Adaptation.getValidationReport(boolean)
,
getValidationReport()
,
getValidationReport(boolean, boolean)
,
ValidationSpec
ValidationReport getValidationReport(boolean ensureActivation, boolean updateValidationReport)
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);
void resetValidationReport()
Adaptation.resetValidationReport(boolean)