Class BaseDataDescriptor<D extends DataDescriptor,T extends Transaction>
- All Implemented Interfaces:
DataDescriptor
- Direct Known Subclasses:
InMemoryDataDescriptor,JPADataDescriptor,SQLDataDescriptor
The DataDescriptor class
In the DataDescriptor class, the data structure and related display and editing interfaces, filters, and data accesses can be specified. With these parameters an editing or display interfaces can be created easily, since the JBStrap data handling components can all be built from DataDescriptors. Furthermore, the DataDescriptor supports both synchronous and asynchronous data handling operations.
A DataDescriptor in the JBStrap framework can be created through code, instantiating this class and specifying the parameters, or based on an XML file.
The XML files are read automatically by the framework on the system startup, and creates the classes, and adds the DataDescriptors to the framework,
so these DataDescriptors can be accessed at any point in the application. The XML files must be located in the directory specified in the
DATADESCRIPTOR_DIR JBStrap parameter.
If a DataDescriptor is created through code, (eg. based on data from a database), then the created DataDescriptor objects have to be added to the framework, by using the
addDescriptor() method.
A previously added DataDescriptor can be queried from the framework, by using the getDataDescriptor() method.
If the DataDescriptor is parameterized in the XML file, then the file extension must be .ds.xml. The DataDescriptor parameters must be in the
datadescriptor tags.
The possible DataDescriptor tag attributes:
| Attribute name | Description | Default |
|---|---|---|
| name | The unique DataDescriptor name. This parameter must be specified. The name specified here is used to get the DataDescriptor from the framework. | null |
| dataClass | The POJO class/entity containing the DataDescriptor data. If using a JPA DataDescriptor, the type of the created JPA entity (through which the data will flow from the DataDescriptor to the component) can be specified here. | null |
| connectorType | The data connector type. | JPA |
| defaultFilterType | The default filter type used to filter the DataDescriptor. The parameter's values can be found in the FilterType enum.
If the filter type is not specified in a component, then this filter will be used. | null |
The DataDescriptor tag's possible elements, that have to be specified in the tags within the tags:
- Tag name
| Description | Default | |
|---|---|---|
| type | The access type. The parameter's values can be found in the AccessType enum | PRIVATE |
| read | The roles that grant read access to the DataDescriptor. The "*" character can be used as a wildcard. The roles must be separated by a comma (","). | * |
| write | The roles that grant write access to the DataDescriptor. The "*" character can be used as a wildcard. The roles must be separated by a comma (","). | * |
A DataDescriptor, that every user can read and write, regardless if they are signed in or not:
<access>
<type>Public</type>
</access>
A DataDescriptor that every logged in user can read, but only certain users (users with the "ADMIN" role, or a role that contains the "POWER" prefix) can write.
<access>
<type>Private</type>
<read>*</read>
<write>ADMIN,POWER*</write>
</access>
This parameter is used to specify the default filter criteria used with the DataDescriptor. The user cannot turn this off, or modify it. If the DataDescriptor is displayed on a list interface and the user can filter the data, the filter set by the user will be applied to the data that was already filtered by the default filter.
For example, if we only want the data displayed that are stored in the field called "column1", and start with "A", it looks like this:
<defaultFilterCriteria>Criteria("column1",LIKE,"A")</defaultFilterCriteria>
This tag can be used multiple times within the DataDescriptor. The individual columns of the DataDescriptor can be defined and set with the help of this tag. For more information about the DataDescriptor column parameters, see the
DataDescriptorColumn class.
- Since:
- 4.0
- Author:
- JBStrap
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AccessTypeprotected Map<String,DataDescriptorColumn> protected Stringprotected String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseDataDescriptor(String name) Creates a DataDescriptorprotectedBaseDataDescriptor(String name, String domainClass) Creates a DataDescriptor -
Method Summary
Modifier and TypeMethodDescriptionaddColumn(DataDescriptorColumn column) Adds column data to the DataDescriptoraddColumns(DataDescriptorColumn... columns) Adds multiple columns to the DataDescriptorAdds a parameter to the DataDescriptor.copy()Creates a copy of the DataDescriptorlongCounts data in the DataDescriptor, following the specified criterialongCounts data in the DataDescriptorabstract longGets the number of records in the database.voidfetchData(int startRow, int endRow, Criteria criteria, Order order, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, between the specified rows, with the specified order and criteriavoidfetchData(int startRow, int endRow, Criteria criteria, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, between the specified rows, asynchronously.voidfetchData(int startRow, int endRow, Criteria criteria, List<Order> orders, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, between the specified rows, with the specified orders and criteriavoidfetchData(Criteria criteria, Order order, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, with the specified order and criteriavoidfetchData(Criteria criteria, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor asynchronously.voidFetches data from the DataDescriptor, with the specified orders and criteriafind()Queries the DataDescriptor data synchronously.Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rowsQueries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, ordered.Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.Queries the DataDescriptor data synchronously, that meet the specified criteriaQueries the DataDescriptor data synchronously.Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rowsQueries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, ordered.Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.Queries the DataDescriptor data synchronously, that meet the specified criteriaInitiates a query by using the DataDescriptor.Gets a DataDescriptor record, using the specified ID.Gets a DataDescriptor record, using the specified ID.abstract RecordFetches a record from the database using the record’s unique ID.Gets the DataDescriptor access typeGets the specified column from the DataDescriptorGets the data of the DataDescriptor columnsGets the default filter criteria assigned to the DataDescriptorgetName()Gets the name of the DataDescriptor<C> CGets the DataDescriptor parameter vale, specified by the parameter name.Gets the name of the column, which contains the primary keys.Gets a list, containing the names of the columns, which contain the primary keys.getRead()Gets a list of roles that have read access to the DataDescriptor.getWrite()Gets a list of roles that have write access to the DataDescriptor.booleanDetermines if the user can filter the DataDescriptorabstract TInitiates a transaction with the DataDescriptor type.Removes a record from the DataDescriptorRemoves a record from the DataDescriptorremove(Record record, Client client, Transaction transaction) Removes a record from the DataDescriptor, within the specified transaction.voidremove(Record record, Client client, DataDescriptorCallback callback) Removes a record asynchronously from the DataDescriptorvoidremove(Record record, Client client, DataDescriptorCallback callback, Transaction transaction) Removes a record asynchronously from the DataDescriptor, within the specified transactionRemoves multiple records from the DataDescriptorremove(List<Record> records, Client client, Transaction transaction) Removes multiple records from the DataDescriptor within the specified transactionvoidremove(List<Record> records, Client client, DataDescriptorCallback callback) Removes multiple records asynchronously from the DataDescriptorvoidremove(List<Record> records, Client client, DataDescriptorCallback callback, Transaction transaction) Removes multiple records asynchronously from the DataDescriptor, within the specified transactionInitiates a delete operation by using a DataDescriptor.
Use the method to delete one or more records from the database using a DataDescriptor.Saves a record to the DataDescriptor.Saves a record to the DataDescriptor.save(Record record, Client client, Transaction transaction) Saves a record to the DataDescriptor, within the specified database transaction.voidsave(Record record, Client client, DataDescriptorCallback callback) Saves a record asynchronously to the database.voidsave(Record record, Client client, DataDescriptorCallback callback, Transaction transaction) Saves a record asynchronously to the database, within the specified database transaction.Saves multiple records to the DataDescriptor.save(List<Record> records, Client client, Transaction transaction) Saves multiple records to the DataDescriptor.voidsave(List<Record> records, Client client, DataDescriptorCallback callback) Saves a record asynchronously to the database, within the specified database transaction.voidsave(List<Record> records, Client client, DataDescriptorCallback callback, Transaction transaction) Saves multiple records asynchronously to the DataDescriptor, within the specified database transaction.Initiates a save operation using a DataDescriptor.
Use the method to save one or more records to the database using the DataDescriptor.setAccess(AccessType access) Sets the DataDescriptor access typesetDefaultFilterCriteria(Criteria criteria) Sets the default filter criteria, that will be used by the DataDescriptorsetParam(Parameters params) Sets the DataDescriptor parameters.Sets the specified roles to have read access to the DataDescriptor.Sets the specified roles to have write access to the DataDescriptor.protected D
-
Field Details
-
name
-
domainClass
-
columns
-
access
-
-
Constructor Details
-
BaseDataDescriptor
Creates a DataDescriptor- Parameters:
name- The DataDescriptor namedomainClass- The name of the domain class (POJO class or entity that provides the data)- Throws:
NullPointerException- If the specified name isnull
-
BaseDataDescriptor
Creates a DataDescriptor- Parameters:
name- The DataDescriptor name- Throws:
NullPointerException- If the specified name isnull
-
-
Method Details
-
getName
Gets the name of the DataDescriptor- Specified by:
getNamein interfaceDataDescriptor- Returns:
- The name of the DataDescriptor
-
addColumn
Adds column data to the DataDescriptor- Specified by:
addColumnin interfaceDataDescriptor- Parameters:
column- The DataDescriptor column object, that contains the data of the column- Returns:
- The DataDescriptor
- Throws:
NullPointerException- If the column was specified asnull
-
addColumns
Adds multiple columns to the DataDescriptor- Specified by:
addColumnsin interfaceDataDescriptor- Parameters:
columns- The columns to be added to the DataDescriptor- Returns:
- The DataDescriptor
- Throws:
NullPointerException- If the columns were specified asnull
-
getColumns
Gets the data of the DataDescriptor columns- Specified by:
getColumnsin interfaceDataDescriptor- Returns:
- A collecton containing the data of the DataDescriptor columns. It will return
null, if the DataDescriptor has no columns.
-
getColumn
Gets the specified column from the DataDescriptor- Specified by:
getColumnin interfaceDataDescriptor- Parameters:
name- The name of the column- Returns:
- The DataDescriptor column with the specified name, or
nullif not found
-
getRead
Gets a list of roles that have read access to the DataDescriptor. If a "*" character is used when specifying roles, it will also appear on the list.- Specified by:
getReadin interfaceDataDescriptor- Returns:
- A list of role names that have read access to the DataDescriptor
-
setRead
Sets the specified roles to have read access to the DataDescriptor.- Specified by:
setReadin interfaceDataDescriptor- Parameters:
read- A list of role names, that will have read access. The "*" character can be used as a wildcard.- Returns:
- The DataDescriptor
-
getWrite
Gets a list of roles that have write access to the DataDescriptor. If a "*" character is used when specifying roles, it will also appear on the list.- Specified by:
getWritein interfaceDataDescriptor- Returns:
- A list of role names that have write access to the DataDescriptor
-
setWrite
Sets the specified roles to have write access to the DataDescriptor.- Specified by:
setWritein interfaceDataDescriptor- Parameters:
write- A list of role names, that will have write access. The "*" character can be used as a wildcard.- Returns:
- The DataDescriptor
-
getAccess
Gets the DataDescriptor access type- Specified by:
getAccessin interfaceDataDescriptor- Returns:
- The DataDescriptor access type
-
setAccess
Sets the DataDescriptor access type- Specified by:
setAccessin interfaceDataDescriptor- Parameters:
access- The DataDescriptor access type. The parameter values can be found in theAccessTypeenum.- Returns:
- The DataDescriptor
-
getPrimaryKeyNames
Gets a list, containing the names of the columns, which contain the primary keys.- Specified by:
getPrimaryKeyNamesin interfaceDataDescriptor- Returns:
- A list of column names, that contain the DataDescriptor primary keys. If the DataDescriptor contains no primary key, it will return with
null
-
getPrimaryKeyName
Gets the name of the column, which contains the primary keys. (Only usable if the DataDescriptor only has one primary key column.)- Specified by:
getPrimaryKeyNamein interfaceDataDescriptor- Returns:
- The name of the column, which contains the primary keys. If the DataDescriptor has no primary key, it will return with
nullIf the DataDescriptor contains multiple primary key columns, it will return with the name of the first column.
-
copy
Creates a copy of the DataDescriptor- Specified by:
copyin interfaceDataDescriptor- Returns:
- A new DataDescriptor, that is a perfect copy of the DataDescriptor
-
getDefaultFilterCriteria
Gets the default filter criteria assigned to the DataDescriptor- Specified by:
getDefaultFilterCriteriain interfaceDataDescriptor- Returns:
- The default filter criteria assigned to the DataDescriptor or
null, if none was assigned
-
setDefaultFilterCriteria
Sets the default filter criteria, that will be used by the DataDescriptor- Specified by:
setDefaultFilterCriteriain interfaceDataDescriptor- Parameters:
criteria- The default filter criteria. Ifnull, no filter criteria will be set to the DataDescriptor- Returns:
- The DataDescriptor
-
isFilterable
public boolean isFilterable()Determines if the user can filter the DataDescriptor- Specified by:
isFilterablein interfaceDataDescriptor- Returns:
- If
true, the user can filter the DataDescriptor, otherwisefalse
-
sortColumn
- Returns:
- The DataDescriptor
-
addParam
Adds a parameter to the DataDescriptor.- Specified by:
addParamin interfaceDataDescriptor- Parameters:
name- The name of the parameter to be added to the DataDescriptor. If the parameter name is already used on the DataDescriptor, it will be overwritten.value- The parameter value- Returns:
- The DataDescriptor
-
setParam
Sets the DataDescriptor parameters. If this method is used, the previous parameter settings will be lost.- Specified by:
setParamin interfaceDataDescriptor- Parameters:
params- The DataDescriptor parameters.- Returns:
- The DataDescriptor
-
getParam
Gets the DataDescriptor parameter vale, specified by the parameter name.- Specified by:
getParamin interfaceDataDescriptor- Parameters:
name- The name of the parameter.- Returns:
- The value of the specified parameter, or
nullif not found.
-
find
Queries the DataDescriptor data synchronously.- Specified by:
findin interfaceDataDescriptor- Returns:
- A list containing every record in the DataDescriptor
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the access rights are not correctly set for the query
-
find
Queries the DataDescriptor data synchronously.- Specified by:
findin interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the query will happen without checking for access rights.- Returns:
- A list containing every record in the DataDescriptor
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
Queries the DataDescriptor data synchronously, that meet the specified criteria- Specified by:
findin interfaceDataDescriptor- Parameters:
criteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(Client client, Criteria criteria) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria- Specified by:
findin interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the query will happen without checking for access rights.criteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(int startRow, int endRow, Criteria criteria) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows- Specified by:
findin interfaceDataDescriptor- Parameters:
startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(Client client, int startRow, int endRow, Criteria criteria) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows- Specified by:
findin interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the query will happen without checking for access rights.startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(int startRow, int endRow, Criteria criteria, Order order) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, ordered.- Specified by:
findin interfaceDataDescriptor- Parameters:
startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.order- The ordering that will be applied to the query results. Ifnull, the data will not be ordered.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(Client client, int startRow, int endRow, Criteria criteria, Order order) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, ordered.- Specified by:
findin interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the query will happen without checking for access rights.startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.order- The ordering that will be applied to the query results. Ifnull, the data will not be ordered.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(int startRow, int endRow, Criteria criteria, Order... orders) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.- Specified by:
findin interfaceDataDescriptor- Parameters:
startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.orders- The orderings that will be applied to the query results. Ifnull, the data will not be ordered.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(Client client, int startRow, int endRow, Criteria criteria, Order... orders) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.- Specified by:
findin interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the query will happen without checking for access rights.startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.orders- The orderings that will be applied to the query results. Ifnull, the data will not be ordered.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(int startRow, int endRow, Criteria criteria, List<Order> orders) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.- Specified by:
findin interfaceDataDescriptor- Parameters:
startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.orders- The list orders that will be applied to the query results. Ifnull, the data will not be ordered.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public List<Record> find(Client client, int startRow, int endRow, Criteria criteria, List<Order> orders) throws FindException, DataAccessException Queries the DataDescriptor data synchronously, that meet the specified criteria, between the specified rows, following the specified orders.- Specified by:
findin interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the query will happen without checking for access rights.startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used during the query. Ifnull, no criteria will be used, every record will be queried.orders- The list orders that will be applied to the query results. Ifnull, the data will not be ordered.- Returns:
- The list of records that meet the specified filter criteria.
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data.
-
find
public abstract List<Record> find(T transaction, Client client, Criteria criteria, List<Order> orders, int startRow, int endRow) throws FindException, DataAccessException Initiates a query by using the DataDescriptor.- Parameters:
transaction- Transaction object used to initiated the query Ifnullis specified, does not use a transaction (it takes place outside of a transaction).client- Client instance initiating the query Ifnullis specified, user access to the data is not checked.startRow- The index of the first rowendRow- The index of the last rowcriteria-Criteriainstance used as a filter criterion Ifnullis specified, the query fetches all records from the database without filtering.orders- A list containingOrderobjects used to the order the query results Ifnullor an empty list is passed, the query results are not ordered.- Returns:
- A list of
Recordinstances returned by the query - Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to read the data
-
fetchData
Fetches data from the DataDescriptor asynchronously.- Specified by:
fetchDatain interfaceDataDescriptor- Parameters:
criteria- The criteria used for the query. If specified asnull, every data will be queried.client- The Client instance, on which the query was started. Ifnull, the data will be queried without checking for access rightscallback- The callback implementation- Throws:
IllegalArgumentException- If the specified callback isnull
-
fetchData
public void fetchData(int startRow, int endRow, Criteria criteria, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, between the specified rows, asynchronously.- Specified by:
fetchDatain interfaceDataDescriptor- Parameters:
startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used for the query. If specified asnull, every data will be queried.client- The Client instance, on which the query was started. Ifnull, the data will be queried without checking for access rightscallback- The callback implementation- Throws:
IllegalArgumentException- If the specified callback isnull
-
fetchData
public void fetchData(Criteria criteria, Order order, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, with the specified order and criteria- Specified by:
fetchDatain interfaceDataDescriptor- Parameters:
criteria- The criteria used for the query. If specified asnull, every data will be queried.order- The ordering instruction used for the query. If specified asnull, no ordering will be applied.client- The Client instance, on which the query was started. Ifnull, the data will be queried without checking for access rightscallback- The callback implementation- Throws:
IllegalArgumentException- If the specified callback isnull
-
fetchData
public void fetchData(Criteria criteria, List<Order> orders, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, with the specified orders and criteria- Specified by:
fetchDatain interfaceDataDescriptor- Parameters:
criteria- The criteria used for the query. If specified asnull, every data will be queried.orders- The ordering instructions used for the query. If specified asnull, no ordering will be applied.client- The Client instance, on which the query was started. Ifnull, the data will be queried without checking for access rightscallback- The callback implementation- Throws:
IllegalArgumentException- If the specified callback isnull
-
fetchData
public void fetchData(int startRow, int endRow, Criteria criteria, Order order, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, between the specified rows, with the specified order and criteria- Specified by:
fetchDatain interfaceDataDescriptor- Parameters:
startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used for the query. If specified asnull, every data will be queried.order- The ordering instruction used for the query. If specified asnull, no ordering will be applied.client- The Client instance, on which the query was started. Ifnull, the data will be queried without checking for access rightscallback- The callback implementation- Throws:
IllegalArgumentException- If the specified callback isnull
-
fetchData
public void fetchData(int startRow, int endRow, Criteria criteria, List<Order> orders, Client client, DataDescriptorCallback callback) Fetches data from the DataDescriptor, between the specified rows, with the specified orders and criteria- Specified by:
fetchDatain interfaceDataDescriptor- Parameters:
startRow- The first row of the query, which will appear in the returned listendRow- The last row of the query, which will appear in the returned listcriteria- The criteria used for the query. If specified asnull, every data will be queried.orders- The ordering instructions used for the query. If specified asnull, no ordering will be applied.client- The Client instance, on which the query was started. Ifnull, the data will be queried without checking for access rightscallback- The callback implementation- Throws:
IllegalArgumentException- If the specified callback isnull
-
countData
Counts data in the DataDescriptor- Specified by:
countDatain interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the access rights won't be checked when counting.- Returns:
- The counted data of the DataDescriptor
- Throws:
RowCountException- Occurs if an error was encountered during the execution of the SQL instruction that does the counting.DataAccessException- Occurs if the logged in user has no read access to the DataDescriptor
-
countData
public long countData(Criteria criteria, Client client) throws RowCountException, DataAccessException Counts data in the DataDescriptor, following the specified criteria- Specified by:
countDatain interfaceDataDescriptor- Parameters:
criteria- The criteria used for the query. If specified asnull, every data will be queried.client- The Client instance, on which the query was started. Ifnull, the data will be queried without checking for access rights- Returns:
- The counted data of the DataDescriptor
- Throws:
RowCountException- Occurs if an error was encountered during the execution of the SQL instruction that does the counting.DataAccessException- Occurs if the logged in user has no read access to the DataDescriptor
-
countData
public abstract long countData(T transaction, Client client, Criteria criteria) throws RowCountException, DataAccessException Gets the number of records in the database.- Parameters:
transaction- Transaction object used to initiated the query Ifnullis specified, does not use a transaction (it takes place outside of a transaction).client- Client instance initiating the query Ifnullis specified, user access to the data is not checked.criteria-Criteriainstance used as a filter criterion Ifnullis specified, the query fetches all records from the database without filtering.- Returns:
- The number of records corresponding to the specified criteria If no records correspond to the specified criteria, the method returns 0.
- Throws:
RowCountException- Occurs if an error was encountered during the execution of the SQL instruction that does the counting.DataAccessException- Occurs if the logged in user has no read access to the DataDescriptor
-
save
Saves a record to the DataDescriptor. If the specified record has a unique ID, and record with that ID already exists, it will be overwritten (update), otherwise it will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
record- The record that will be saved to the DataDescriptor- Returns:
- The saved record
- Throws:
SaveException- Occurs if an error was encountered during the saveDataAccessException- Occurs if the user on the specified client has no permission to save the record to the DataDescriptor.
-
save
Saves a record to the DataDescriptor. If the specified record has a unique ID, and record with that ID already exists, it will be overwritten (update), otherwise it will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
record- The record that will be saved to the DataDescriptorclient- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.- Returns:
- The saved record
- Throws:
SaveException- Occurs if an error was encountered during the saveDataAccessException- Occurs if the user on the specified client has no permission to save the record to the DataDescriptor.
-
save
public List<Record> save(Record record, Client client, Transaction transaction) throws SaveException, DataAccessException Saves a record to the DataDescriptor, within the specified database transaction. If the specified record has a unique ID, and record with that ID already exists, it will be overwritten (update), otherwise it will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
record- The record that will be saved to the DataDescriptorclient- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.transaction- The object representing the database transaction, on which the save is to be executed. If specified asnull, the save will happen outside the transaction.- Returns:
- The saved record
- Throws:
SaveException- Occurs if an error was encountered during the save.DataAccessException- Occurs if the user on the specified client has no permission to save the record to the DataDescriptor.
-
save
public List<Record> save(List<Record> records, Client client) throws SaveException, DataAccessException Saves multiple records to the DataDescriptor. If the specified records have a unique ID, and a record with that ID already exists, they will be overwritten (update), otherwise they will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
records- A list containing the records to be saved.client- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.- Returns:
- The saved record
- Throws:
SaveException- Occurs if an error was encountered during the save.DataAccessException- Occurs if the user on the specified client has no permission to save the record to the DataDescriptor.
-
save
public List<Record> save(List<Record> records, Client client, Transaction transaction) throws SaveException, DataAccessException Saves multiple records to the DataDescriptor. If the specified records have a unique ID, and a record with that ID already exists, they will be overwritten (update), otherwise they will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
records- A list containing the records to be saved.client- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.transaction- The object representing the database transaction, on which the save is to be executed. If specified asnull, the save will happen outside the transaction.- Returns:
- The saved record
- Throws:
SaveException- Occurs if an error was encountered during the save.DataAccessException- Occurs if the user on the specified client has no permission to save the record to the DataDescriptor.
-
save
Saves a record asynchronously to the database. If the specified record has a unique ID, and record with that ID already exists, it will be overwritten (update), otherwise it will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
record- The record that will be saved to the DataDescriptorclient- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.callback- The callback implementation
-
save
public void save(Record record, Client client, DataDescriptorCallback callback, Transaction transaction) Saves a record asynchronously to the database, within the specified database transaction. If the specified record has a unique ID, and record with that ID already exists, it will be overwritten (update), otherwise it will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
record- The record that will be saved to the DataDescriptorclient- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.callback- The callback implementationtransaction- The object representing the database transaction, on which the save is to be executed. If specified asnull, the save will happen outside the transaction.
-
save
Saves a record asynchronously to the database, within the specified database transaction. If the specified record has a unique ID, and record with that ID already exists, it will be overwritten (update), otherwise it will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
records- A list containing the records to be saved.client- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.callback- The callback implementation
-
save
public void save(List<Record> records, Client client, DataDescriptorCallback callback, Transaction transaction) Saves multiple records asynchronously to the DataDescriptor, within the specified database transaction. If the specified records have a unique ID, and a record with that ID already exists, they will be overwritten (update), otherwise they will be inserted to the database.- Specified by:
savein interfaceDataDescriptor- Parameters:
records- A list containing the records to be saved.client- The client, that started the Save. If not specified, the save operation will be executed without checking for access rights.callback- The callback implementationtransaction- The object representing the database transaction, on which the save is to be executed. If specified asnull, the save will happen outside the transaction.
-
save
public abstract List<Record> save(T transaction, Client client, List<Record> records) throws SaveException, DataAccessException Initiates a save operation using a DataDescriptor.
Use the method to save one or more records to the database using the DataDescriptor.- Parameters:
transaction- Transaction object used to initiated the query Ifnullis specified, does not use a transaction (it takes place outside of a transaction).client- Client instance initiating the query Ifnullis specified, user access (and whether the user has rights to update the data) to the data is not checked.records- A list of records to be saved- Returns:
- The saved record
- Throws:
SaveException- Occurs if an error was encountered during the save.DataAccessException- Occurs if the user on the specified client has no permission to save the record to the Datadescriptor.
-
remove
Removes a record from the DataDescriptor- Specified by:
removein interfaceDataDescriptor- Parameters:
record- The record to be removed. The record must contain the primary ID. If the record doesn't contain a primary key, no removal will be executed. During the execution, the other data of the record will not be processed.- Returns:
- The removed record
- Throws:
RemoveException- Occurs if an error was encountered during the removal processDataAccessException- Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
-
remove
public List<Record> remove(Record record, Client client) throws RemoveException, DataAccessException Removes a record from the DataDescriptor- Specified by:
removein interfaceDataDescriptor- Parameters:
record- The record to be removed. The record must contain the primary ID. If the record doesn't contain a primary key, no removal will be executed. During the execution, the other data of the record will not be processed.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.- Returns:
- The removed record
- Throws:
RemoveException- Occurs if an error was encountered during the removal processDataAccessException- Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
-
remove
public List<Record> remove(Record record, Client client, Transaction transaction) throws RemoveException, DataAccessException Removes a record from the DataDescriptor, within the specified transaction.- Specified by:
removein interfaceDataDescriptor- Parameters:
record- The record to be removed. The record must contain the primary ID. If the record doesn't contain a primary key, no removal will be executed. During the execution, the other data of the record will not be processed.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.transaction- The object representing the database transaction, on which the removal is to be executed. If specified asnull, the removal will happen outside the transaction.- Returns:
- The removed record
- Throws:
RemoveException- Occurs if an error was encountered during the removal processDataAccessException- Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
-
remove
public List<Record> remove(List<Record> records, Client client) throws RemoveException, DataAccessException Removes multiple records from the DataDescriptor- Specified by:
removein interfaceDataDescriptor- Parameters:
records- A list containing the records to be removed. The records must contain a unique ID. If a record has no unique ID, the record will not be removed. The other attributes of the records will not be processed during the removal.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.- Returns:
- The removed record
- Throws:
RemoveException- Occurs if an error was encountered during the removal processDataAccessException- Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
-
remove
public List<Record> remove(List<Record> records, Client client, Transaction transaction) throws RemoveException, DataAccessException Removes multiple records from the DataDescriptor within the specified transaction- Specified by:
removein interfaceDataDescriptor- Parameters:
records- A list containing the records to be removed. The records must contain a unique ID. If a record has no unique ID, the record will not be removed. The other attributes of the records will not be processed during the removal.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.transaction- The object representing the database transaction, in which the record removal will be executed. If specified asnull, the removal will happen outside of a transaction- Returns:
- The removed record
- Throws:
RemoveException- Occurs if an error was encountered during the removal processDataAccessException- Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
-
remove
Removes a record asynchronously from the DataDescriptor- Specified by:
removein interfaceDataDescriptor- Parameters:
record- The record to be removed. The record must contain the primary ID. If the record doesn't contain a primary key, no removal will be executed. During the execution, the other data of the record will not be processed.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.callback- The callback implementation
-
remove
public void remove(Record record, Client client, DataDescriptorCallback callback, Transaction transaction) Removes a record asynchronously from the DataDescriptor, within the specified transaction- Specified by:
removein interfaceDataDescriptor- Parameters:
record- The record to be removed. The record must contain the primary ID. If the record doesn't contain a primary key, no removal will be executed. During the execution, the other data of the record will not be processed.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.callback- The callback implementationtransaction- The object representing the database transaction, in which the record removal will be executed. If specified asnull, the removal will happen outside of a transaction
-
remove
Removes multiple records asynchronously from the DataDescriptor- Specified by:
removein interfaceDataDescriptor- Parameters:
records- The record to be removed. The record must contain the primary ID. If the record doesn't contain a primary key, no removal will be executed. During the execution, the other data of the record will not be processed.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.callback- The callback implementation
-
remove
public void remove(List<Record> records, Client client, DataDescriptorCallback callback, Transaction transaction) Removes multiple records asynchronously from the DataDescriptor, within the specified transaction- Specified by:
removein interfaceDataDescriptor- Parameters:
records- The record to be removed. The record must contain the primary ID. If the record doesn't contain a primary key, no removal will be executed. During the execution, the other data of the record will not be processed.client- The client that started the removal. If specified asnull, the removal will be executed without checking for access.callback- The callback implementationtransaction- The object representing the database transaction, in which the record removal will be executed. If specified asnull, the removal will happen outside of a transaction
-
remove
public abstract List<Record> remove(T transaction, Client client, List<Record> records) throws RemoveException, DataAccessException Initiates a delete operation by using a DataDescriptor.
Use the method to delete one or more records from the database using a DataDescriptor.- Parameters:
transaction- Transaction object used to initiated the query Ifnullis specified, does not use a transaction (it takes place outside of a transaction).client- Client instance initiating the query Ifnullis specified, user access (and whether the user has rights to update the data) to the data is not checked.records- A list of records to be deleted- Throws:
RemoveException- Occurs if an error was encountered during the removal processDataAccessException- Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
-
findById
Gets a DataDescriptor record, using the specified ID.- Specified by:
findByIdin interfaceDataDescriptor- Parameters:
id- The unique record ID- Returns:
- The record with the specified ID
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to query the data.
-
findById
Gets a DataDescriptor record, using the specified ID.- Specified by:
findByIdin interfaceDataDescriptor- Parameters:
client- The client that started the query. Ifnull, the query will happen without checking for access rights.id- The unique record ID- Returns:
- The record with the specified ID
- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to query the data.
-
findById
public abstract Record findById(T transaction, Client client, Object... id) throws FindException, DataAccessException Fetches a record from the database using the record’s unique ID.- Parameters:
transaction- Transaction object used to initiated the query Ifnullis specified, does not use a transaction (it takes place outside of a transaction).client- Client instance initiating the query Ifnullis specified, user access to the data is not checked.id- Record ID- Throws:
FindException- Occurs if an error was encountered during the queryDataAccessException- Occurs if the user in the specified client has no access to query the data.
-
openTransaction
Initiates a transaction with the DataDescriptor type.- Specified by:
openTransactionin interfaceDataDescriptor- Returns:
- Transaction object
-