Class BaseDataDescriptor<D extends DataDescriptor,T extends Transaction>

java.lang.Object
com.jbstrap.core.meta.BaseDataDescriptor<D,T>
All Implemented Interfaces:
DataDescriptor
Direct Known Subclasses:
InMemoryDataDescriptor, JPADataDescriptor, SQLDataDescriptor

public abstract class BaseDataDescriptor<D extends DataDescriptor,T extends Transaction> extends Object implements DataDescriptor

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 nameDescriptionDefault
nameThe unique DataDescriptor name. This parameter must be specified. The name specified here is used to get the DataDescriptor from the framework. null
dataClassThe 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
connectorTypeThe data connector type.JPA
defaultFilterTypeThe 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
  • DescriptionDefault
    typeThe access type. The parameter's values can be found in the AccessType enumPRIVATE
    readThe roles that grant read access to the DataDescriptor. The "*" character can be used as a wildcard. The roles must be separated by a comma (","). *
    writeThe 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>
  • defaultFilterCriteria
    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>
     
  • column
    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 Details

  • Constructor Details

    • BaseDataDescriptor

      protected BaseDataDescriptor(String name, String domainClass)
      Creates a DataDescriptor
      Parameters:
      name - The DataDescriptor name
      domainClass - The name of the domain class (POJO class or entity that provides the data)
      Throws:
      NullPointerException - If the specified name is null
    • BaseDataDescriptor

      protected BaseDataDescriptor(String name)
      Creates a DataDescriptor
      Parameters:
      name - The DataDescriptor name
      Throws:
      NullPointerException - If the specified name is null
  • Method Details

    • getName

      public String getName()
      Gets the name of the DataDescriptor
      Specified by:
      getName in interface DataDescriptor
      Returns:
      The name of the DataDescriptor
    • addColumn

      public D addColumn(DataDescriptorColumn column)
      Adds column data to the DataDescriptor
      Specified by:
      addColumn in interface DataDescriptor
      Parameters:
      column - The DataDescriptor column object, that contains the data of the column
      Returns:
      The DataDescriptor
      Throws:
      NullPointerException - If the column was specified as null
    • addColumns

      public D addColumns(DataDescriptorColumn... columns)
      Adds multiple columns to the DataDescriptor
      Specified by:
      addColumns in interface DataDescriptor
      Parameters:
      columns - The columns to be added to the DataDescriptor
      Returns:
      The DataDescriptor
      Throws:
      NullPointerException - If the columns were specified as null
    • getColumns

      public Collection<DataDescriptorColumn> getColumns()
      Gets the data of the DataDescriptor columns
      Specified by:
      getColumns in interface DataDescriptor
      Returns:
      A collecton containing the data of the DataDescriptor columns. It will return null, if the DataDescriptor has no columns.
    • getColumn

      public DataDescriptorColumn getColumn(String name)
      Gets the specified column from the DataDescriptor
      Specified by:
      getColumn in interface DataDescriptor
      Parameters:
      name - The name of the column
      Returns:
      The DataDescriptor column with the specified name, or null if not found
    • getRead

      public List<String> 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:
      getRead in interface DataDescriptor
      Returns:
      A list of role names that have read access to the DataDescriptor
    • setRead

      public D setRead(List<String> read)
      Sets the specified roles to have read access to the DataDescriptor.
      Specified by:
      setRead in interface DataDescriptor
      Parameters:
      read - A list of role names, that will have read access. The "*" character can be used as a wildcard.
      Returns:
      The DataDescriptor
    • getWrite

      public List<String> 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:
      getWrite in interface DataDescriptor
      Returns:
      A list of role names that have write access to the DataDescriptor
    • setWrite

      public D setWrite(List<String> write)
      Sets the specified roles to have write access to the DataDescriptor.
      Specified by:
      setWrite in interface DataDescriptor
      Parameters:
      write - A list of role names, that will have write access. The "*" character can be used as a wildcard.
      Returns:
      The DataDescriptor
    • getAccess

      public AccessType getAccess()
      Gets the DataDescriptor access type
      Specified by:
      getAccess in interface DataDescriptor
      Returns:
      The DataDescriptor access type
    • setAccess

      public D setAccess(AccessType access)
      Sets the DataDescriptor access type
      Specified by:
      setAccess in interface DataDescriptor
      Parameters:
      access - The DataDescriptor access type. The parameter values can be found in the AccessType enum.
      Returns:
      The DataDescriptor
    • getPrimaryKeyNames

      public List<String> getPrimaryKeyNames()
      Gets a list, containing the names of the columns, which contain the primary keys.
      Specified by:
      getPrimaryKeyNames in interface DataDescriptor
      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

      public String 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:
      getPrimaryKeyName in interface DataDescriptor
      Returns:
      The name of the column, which contains the primary keys. If the DataDescriptor has no primary key, it will return with null If the DataDescriptor contains multiple primary key columns, it will return with the name of the first column.
    • copy

      public D copy()
      Creates a copy of the DataDescriptor
      Specified by:
      copy in interface DataDescriptor
      Returns:
      A new DataDescriptor, that is a perfect copy of the DataDescriptor
    • getDefaultFilterCriteria

      public Criteria getDefaultFilterCriteria()
      Gets the default filter criteria assigned to the DataDescriptor
      Specified by:
      getDefaultFilterCriteria in interface DataDescriptor
      Returns:
      The default filter criteria assigned to the DataDescriptor or null, if none was assigned
    • setDefaultFilterCriteria

      public D setDefaultFilterCriteria(Criteria criteria)
      Sets the default filter criteria, that will be used by the DataDescriptor
      Specified by:
      setDefaultFilterCriteria in interface DataDescriptor
      Parameters:
      criteria - The default filter criteria. If null, 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:
      isFilterable in interface DataDescriptor
      Returns:
      If true, the user can filter the DataDescriptor, otherwise false
    • sortColumn

      protected D sortColumn()
      Returns:
      The DataDescriptor
    • addParam

      public D addParam(String name, Object value)
      Adds a parameter to the DataDescriptor.
      Specified by:
      addParam in interface DataDescriptor
      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

      public D setParam(Parameters params)
      Sets the DataDescriptor parameters. If this method is used, the previous parameter settings will be lost.
      Specified by:
      setParam in interface DataDescriptor
      Parameters:
      params - The DataDescriptor parameters.
      Returns:
      The DataDescriptor
    • getParam

      public <C> C getParam(String name)
      Gets the DataDescriptor parameter vale, specified by the parameter name.
      Specified by:
      getParam in interface DataDescriptor
      Parameters:
      name - The name of the parameter.
      Returns:
      The value of the specified parameter, or null if not found.
    • find

      public List<Record> find() throws FindException, DataAccessException
      Queries the DataDescriptor data synchronously.
      Specified by:
      find in interface DataDescriptor
      Returns:
      A list containing every record in the DataDescriptor
      Throws:
      FindException - Occurs if an error was encountered during the query
      DataAccessException - Occurs if the access rights are not correctly set for the query
    • find

      public List<Record> find(Client client) throws FindException, DataAccessException
      Queries the DataDescriptor data synchronously.
      Specified by:
      find in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, 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 query
      DataAccessException - Occurs if the user in the specified client has no access to read the data.
    • find

      public List<Record> find(Criteria criteria) throws FindException, DataAccessException
      Queries the DataDescriptor data synchronously, that meet the specified criteria
      Specified by:
      find in interface DataDescriptor
      Parameters:
      criteria - The criteria used during the query. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, the query will happen without checking for access rights.
      criteria - The criteria used during the query. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, the query will happen without checking for access rights.
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, no criteria will be used, every record will be queried.
      order - The ordering that will be applied to the query results. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, the query will happen without checking for access rights.
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, no criteria will be used, every record will be queried.
      order - The ordering that will be applied to the query results. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, no criteria will be used, every record will be queried.
      orders - The orderings that will be applied to the query results. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, the query will happen without checking for access rights.
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, no criteria will be used, every record will be queried.
      orders - The orderings that will be applied to the query results. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, no criteria will be used, every record will be queried.
      orders - The list orders that will be applied to the query results. If null, 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 query
      DataAccessException - 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:
      find in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, the query will happen without checking for access rights.
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used during the query. If null, no criteria will be used, every record will be queried.
      orders - The list orders that will be applied to the query results. If null, 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 query
      DataAccessException - 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 If null is specified, does not use a transaction (it takes place outside of a transaction).
      client - Client instance initiating the query If null is specified, user access to the data is not checked.
      startRow - The index of the first row
      endRow - The index of the last row
      criteria - Criteria instance used as a filter criterion If null is specified, the query fetches all records from the database without filtering.
      orders - A list containing Order objects used to the order the query results If null or an empty list is passed, the query results are not ordered.
      Returns:
      A list of Record instances returned by the query
      Throws:
      FindException - Occurs if an error was encountered during the query
      DataAccessException - Occurs if the user in the specified client has no access to read the data
    • fetchData

      public void fetchData(Criteria criteria, Client client, DataDescriptorCallback callback)
      Fetches data from the DataDescriptor asynchronously.
      Specified by:
      fetchData in interface DataDescriptor
      Parameters:
      criteria - The criteria used for the query. If specified as null, every data will be queried.
      client - The Client instance, on which the query was started. If null, the data will be queried without checking for access rights
      callback - The callback implementation
      Throws:
      IllegalArgumentException - If the specified callback is null
    • 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:
      fetchData in interface DataDescriptor
      Parameters:
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used for the query. If specified as null, every data will be queried.
      client - The Client instance, on which the query was started. If null, the data will be queried without checking for access rights
      callback - The callback implementation
      Throws:
      IllegalArgumentException - If the specified callback is null
    • 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:
      fetchData in interface DataDescriptor
      Parameters:
      criteria - The criteria used for the query. If specified as null, every data will be queried.
      order - The ordering instruction used for the query. If specified as null, no ordering will be applied.
      client - The Client instance, on which the query was started. If null, the data will be queried without checking for access rights
      callback - The callback implementation
      Throws:
      IllegalArgumentException - If the specified callback is null
    • 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:
      fetchData in interface DataDescriptor
      Parameters:
      criteria - The criteria used for the query. If specified as null, every data will be queried.
      orders - The ordering instructions used for the query. If specified as null, no ordering will be applied.
      client - The Client instance, on which the query was started. If null, the data will be queried without checking for access rights
      callback - The callback implementation
      Throws:
      IllegalArgumentException - If the specified callback is null
    • 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:
      fetchData in interface DataDescriptor
      Parameters:
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used for the query. If specified as null, every data will be queried.
      order - The ordering instruction used for the query. If specified as null, no ordering will be applied.
      client - The Client instance, on which the query was started. If null, the data will be queried without checking for access rights
      callback - The callback implementation
      Throws:
      IllegalArgumentException - If the specified callback is null
    • 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:
      fetchData in interface DataDescriptor
      Parameters:
      startRow - The first row of the query, which will appear in the returned list
      endRow - The last row of the query, which will appear in the returned list
      criteria - The criteria used for the query. If specified as null, every data will be queried.
      orders - The ordering instructions used for the query. If specified as null, no ordering will be applied.
      client - The Client instance, on which the query was started. If null, the data will be queried without checking for access rights
      callback - The callback implementation
      Throws:
      IllegalArgumentException - If the specified callback is null
    • countData

      public long countData(Client client) throws RowCountException, DataAccessException
      Counts data in the DataDescriptor
      Specified by:
      countData in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, 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:
      countData in interface DataDescriptor
      Parameters:
      criteria - The criteria used for the query. If specified as null, every data will be queried.
      client - The Client instance, on which the query was started. If null, 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 If null is specified, does not use a transaction (it takes place outside of a transaction).
      client - Client instance initiating the query If null is specified, user access to the data is not checked.
      criteria - Criteria instance used as a filter criterion If null is 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

      public List<Record> save(Record record) throws SaveException, DataAccessException
      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:
      save in interface DataDescriptor
      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 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(Record record, Client client) throws SaveException, DataAccessException
      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:
      save in interface DataDescriptor
      Parameters:
      record - The record that will be saved to the DataDescriptor
      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(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:
      save in interface DataDescriptor
      Parameters:
      record - The record that will be saved to the DataDescriptor
      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 as null, 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:
      save in interface DataDescriptor
      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:
      save in interface DataDescriptor
      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 as null, 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 void save(Record record, Client client, DataDescriptorCallback callback)
      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:
      save in interface DataDescriptor
      Parameters:
      record - The record that will be saved to the DataDescriptor
      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(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:
      save in interface DataDescriptor
      Parameters:
      record - The record that will be saved to the DataDescriptor
      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
      transaction - The object representing the database transaction, on which the save is to be executed. If specified as null, the save will happen outside the transaction.
    • save

      public void save(List<Record> records, Client client, DataDescriptorCallback callback)
      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:
      save in interface DataDescriptor
      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:
      save in interface DataDescriptor
      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
      transaction - The object representing the database transaction, on which the save is to be executed. If specified as null, 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 If null is specified, does not use a transaction (it takes place outside of a transaction).
      client - Client instance initiating the query If null is 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

      public List<Record> remove(Record record) throws RemoveException, DataAccessException
      Removes a record from the DataDescriptor
      Specified by:
      remove in interface DataDescriptor
      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 process
      DataAccessException - 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:
      remove in interface DataDescriptor
      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 as null, the removal will be executed without checking for access.
      Returns:
      The removed record
      Throws:
      RemoveException - Occurs if an error was encountered during the removal process
      DataAccessException - 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:
      remove in interface DataDescriptor
      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 as null, 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 as null, the removal will happen outside the transaction.
      Returns:
      The removed record
      Throws:
      RemoveException - Occurs if an error was encountered during the removal process
      DataAccessException - 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:
      remove in interface DataDescriptor
      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 as null, the removal will be executed without checking for access.
      Returns:
      The removed record
      Throws:
      RemoveException - Occurs if an error was encountered during the removal process
      DataAccessException - 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:
      remove in interface DataDescriptor
      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 as null, 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 as null, the removal will happen outside of a transaction
      Returns:
      The removed record
      Throws:
      RemoveException - Occurs if an error was encountered during the removal process
      DataAccessException - Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
    • remove

      public void remove(Record record, Client client, DataDescriptorCallback callback)
      Removes a record asynchronously from the DataDescriptor
      Specified by:
      remove in interface DataDescriptor
      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 as null, 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:
      remove in interface DataDescriptor
      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 as null, the removal will be executed without checking for access.
      callback - The callback implementation
      transaction - The object representing the database transaction, in which the record removal will be executed. If specified as null, the removal will happen outside of a transaction
    • remove

      public void remove(List<Record> records, Client client, DataDescriptorCallback callback)
      Removes multiple records asynchronously from the DataDescriptor
      Specified by:
      remove in interface DataDescriptor
      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 as null, 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:
      remove in interface DataDescriptor
      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 as null, the removal will be executed without checking for access.
      callback - The callback implementation
      transaction - The object representing the database transaction, in which the record removal will be executed. If specified as null, 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 If null is specified, does not use a transaction (it takes place outside of a transaction).
      client - Client instance initiating the query If null is 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 process
      DataAccessException - Occurs if the user on the specified client has no access to write the data of the DataDescriptor.
    • findById

      public Record findById(Object id) throws FindException, DataAccessException
      Gets a DataDescriptor record, using the specified ID.
      Specified by:
      findById in interface DataDescriptor
      Parameters:
      id - The unique record ID
      Returns:
      The record with the specified ID
      Throws:
      FindException - Occurs if an error was encountered during the query
      DataAccessException - Occurs if the user in the specified client has no access to query the data.
    • findById

      public Record findById(Client client, Object id) throws FindException, DataAccessException
      Gets a DataDescriptor record, using the specified ID.
      Specified by:
      findById in interface DataDescriptor
      Parameters:
      client - The client that started the query. If null, 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 query
      DataAccessException - 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 If null is specified, does not use a transaction (it takes place outside of a transaction).
      client - Client instance initiating the query If null is specified, user access to the data is not checked.
      id - Record ID
      Throws:
      FindException - Occurs if an error was encountered during the query
      DataAccessException - Occurs if the user in the specified client has no access to query the data.
    • openTransaction

      public abstract T openTransaction()
      Initiates a transaction with the DataDescriptor type.
      Specified by:
      openTransaction in interface DataDescriptor
      Returns:
      Transaction object