Class DABase

java.lang.Object
overit.geocall.da.DABase
All Implemented Interfaces:
Serializable, DataAttributesHolder, EDMConfigurableBean, overit.geocall.marks.FieldExposer, overit.geocall.marks.NameExposer, DBFieldMapper, DBObjectMapper, Identified, Tool
Direct Known Subclasses:
overit.geocallapp.replicator.basic.base.DataSource.DABaseReplicator, DADashboard, DAMessages, DAOUserPassword, DAUsers, DAXWFMAAvvisi, DAXWFMAAvvisiAttivita, DAXWFMAAvvisiCataloghi, DAXWFMAAvvisiRighe, DAXWFMAAvvisiTesto, DAXWFMAProgressiviAvvisi, DAXWFMRNotifTypeOrderType, DAXWFMTAutomiRighe, DAXWFMTGruppoCatalogo, DAXWFMTParametriAutomiAvvisi, DAXWFMTStatoAvvisoSAP, DAXWFMTTipoCatalogo

public abstract class DABase extends Object implements DBFieldMapper, DBObjectMapper, Identified, overit.geocall.marks.FieldExposer, overit.geocall.marks.NameExposer, Serializable, Tool, EDMConfigurableBean
Abstract class to extend when you want to create an object that accesses a table of the database. To use the class you need to extend it by implementing the methods that gives the fundamental informations of the table that you want to map.
This class implements some basic functions such the selection of one or all the table records (see executeQuery()) or the deletion, insertion or updating of a record (see executeCommand()).
You can add specific custom queries and commands by implementing the methods giveQueries() and giveCommands().
It is possible to save a DBView on which insertions, deletions and modifications have been made using the save() method.
It is also possible to define one DBObjectMap or a DBFieldMap to change the behavior of standard queries implementing the two methods giveDBObjectMap() and giveDBFieldMap().
All methods requires that a query id or command id is passed as well as one connection already open (or the name of a pool from which to extract a new one). If we pass a pool name, the methods extract a connection and in the end of the execution try to release it giving a commit command; if an error occurs it comes is performed a rollback and then the connection is released to the pool.
If the connection is not explicitly passed, the commit method is never made and the transactions must be managed from the caller.
In any case, any exception generated is thrown outside.
See Also:
  • Field Details

    • SELECT_FILTER

      public static final int SELECT_FILTER
      Standard query: SELECT * FROM TABLE WHERE ... = ?
      See Also:
    • SELECT_NONE

      public static final int SELECT_NONE
      Standard empty query: SELECT * FROM TABLE WHERE 1 = 0
      See Also:
    • SELECT_PK

      public static final int SELECT_PK
      Standard query: SELECT * FROM TABLE WHERE PRIMARY_KEY = ?
      See Also:
    • DELETE_PK

      public static final int DELETE_PK
      Standard command: delete a record using the primary key field
      See Also:
    • DELETE_FILTER

      public static final int DELETE_FILTER
      Standard command: delete a record using the filter passed as parameter
      See Also:
    • UPDATE_PK

      public static final int UPDATE_PK
      Standard command: update a record using the primary key
      See Also:
    • UPDATE_FILTER

      public static final int UPDATE_FILTER
      Standard command: update a record using the filter passed as parameter
      See Also:
    • INSERT

      public static final int INSERT
      Standard command: insert a new record
      See Also:
    • UPSERT

      public static final int UPSERT
      Standard experimental command: UPSERT implementation (try to make an update, if fails do an insert)
      See Also:
    • INSATE

      public static final int INSATE
      Standard experimental command: INSATE implementation (try to make an insert, if fails do an update)
      See Also:
    • SAVE_DBVIEW

      public static final int SAVE_DBVIEW
      See Also:
    • REPLACE_DBVIEW

      public static final int REPLACE_DBVIEW
      See Also:
    • DA_BASE_FILTER_PREFIX

      public static final String DA_BASE_FILTER_PREFIX
      See Also:
  • Constructor Details

    • DABase

      protected DABase()
      Creates a new DABase instance.
  • Method Details

    • getTeacher

      public Teacher getTeacher()
      Returns the Teacher used for the translations by the DA
      Returns:
      The Teacher instance associated to the DA
    • giveMinLevel

      protected int giveMinLevel()
      Defines the minumum level of behavior.
      With value 0 (used in kernel versions <= 6.1) the delete commands receive the values (unnecessarily) while the custom commands did not (wrongly) receive the filters; with value 1 (used in kernel versions > 6.1) the behavior is regularized, ie delete commands do not receive values, insert commands do not receive filters and all others receive both.
      Returns:
      The minimum level, 0
    • giveTableName

      public abstract String giveTableName()
      Returns the name of the table on which the specific DA acts. It must be implemented making it return a string that represents the name of the table on which you want to access and operate.
      Returns:
      The name of the table on which the specific DA acts
    • givePoolName

      public abstract String givePoolName()
      Returns the name of the pool from which the specific DA extracts the connections when they are not explicitly passed to methods. It must be implemented making it return a string that represents the name of the pool.
      Returns:
      The name of the pool from which the specific DA extracts the connections. It must return a not-null value
    • giveIsService

      public boolean giveIsService()
      Allows customization of service mode for the Connection extraction.
      Returns:
      false for ordinary Connection extraction, true for ServicePool extraction
    • giveStar

      public String giveStar()
      Defines the field list for all the select queries.
      Returns:
      By default returns the star character (*), that means that we load all the table fields. It can be extended and make it return a subset or a superset (calculated fields) using fetch(givePool(),giveTableName()) .
    • givePrimaryKeys

      public abstract String[] givePrimaryKeys()
      Must be implemented and returns the array that contains the primary keys of the specific table on which the DA acts.
      Returns:
      Array that contains the name of the fields that are primary keys of the specific table
    • giveSequenceField

      public abstract String giveSequenceField()
      Must be implemented and returns a string that represent the name of the field used as sequence for the insert commands on the table.
      Returns:
      The name of the sequence field or null if there isn't a defined sequence
    • giveOrderCols

      public abstract String[] giveOrderCols()
      Returns the array that contains the names of the columns on which we made the sorting of the result.
      Returns:
      Array that contains the name of the fields of the specific table
    • giveFactoryField

      public abstract String giveFactoryField()
      Returns the field of the table in which is stored the "factory id" value
      Returns:
      The field containing the "factory id" value
    • giveBranchField

      public abstract String giveBranchField()
      Returns the field of the table in which is stored the "branch id" value
      Returns:
      The name of the table field in which we store the "branch id" value; it must retrun null if we don't want to store this information
    • giveQueries

      protected abstract DBView giveQueries(int i, PooledConnection conn, DBStatement stmt, HashGetter filter, int maxrows, int skiprows) throws SQLException
      Implements new specific queries that are different from the standard ones.
      For all the queries implemented with this method we must set, in the DBStatement, the SQL (setSql()), the parameters (available as filters and settable using set()) and any map (setDBObjectMap(), setDBFieldMap()) to use on the DBStatement.
      The execution is done when we call one of the query() methods, so we can do here only the statement setup.
      It is fundamental that the method return null if the query id is not recognized.
      Parameters:
      i - The id of the query
      conn - Connection from which we have extracted the DBStatement; it can be used to extract other DBStatement
      stmt - DBStatement used to set the SQL code and the parameters
      filter - Parameters to set in the DBStatement
      maxrows - Maximum rows number extracted with the query
      skiprows - Number of initial lines that you do not want to be returned. Even these lines, although skipped, are counted in the maxrows parameter.
      Returns:
      If the query id is valid we must return the DBStatement passed as parameter; if the is is not valid, or we don't want to add specific queries to the standard ones we must return null
      Throws:
      SQLException - If there is an error in the SQL SQLException is thrown
    • giveCommands

      protected abstract int giveCommands(int i, PooledConnection conn, DBStatement stmt, HashGetter filter, HashGetter values) throws SQLException
      Implements new specific commands that are different from the standard ones.
      For all the commands implemented with this method we must set, in the DBStatement, the SQL (setSql()), (setDBObjectMap(), setDBFieldMap()) to use on the DBStatement.
      The execution is done when we call one of the command() methods, so we can do here only the statement setup.
      It is fundamental that the method return null if the command id is not recognized.
      Parameters:
      i - The id of the command
      conn - Connection from which we have extracted the DBStatement; it can be used to extract other DBStatement
      stmt - DBStatement used to set the SQL code and the parameters
      filter - Values used as filters to set for the update commands
      values - Values to set as parameters in the DBStatement
      Returns:
      If the command id is valid we must return the DBStatement passed as parameter; if the id is not valid, or we don't want to add specific commands to the standard ones we must return null
      Throws:
      SQLException - If there is an error in the SQL SQLException is thrown
    • giveDBObjectMap

      public abstract DBObjectMap giveDBObjectMap()
      Must returns a DBObjectMap if you want to implement an object mapping mechanism for queries and standard commands. If you do not want to define any mapping just make sure that the method returns null.
      Returns:
      the DBObjectMapper that defines the object mapping, or null
    • giveDBFieldMap

      public abstract DBFieldMap giveDBFieldMap()
      Must returns a DBFieldMap if you want to implement an object mapping mechanism for queries and standard commands. If you do not want to define any mapping just make sure that the method returns null.
      Returns:
      the DBFieldMapper that defines the object mapping, or null
    • giveIsDistinct

      public boolean giveIsDistinct()
      Returns true if this DABase should produce a SELECT DISTINCT query; false if it should produce a SELECT (not DISTINCT) query.
      Returns:
      true if this DABase should produce a SELECT DISTINCT query; false if it should produce a SELECT (not DISTINCT) query.
    • preInsert

      protected void preInsert(HashGetter values, PooledConnection conn) throws DAValidateException, SQLException
      Called before every insert command. We can overload it to implements specific operations. The standard method set the LOGIN and DATASTAMP fields and eventually the values for the factory, branch and sequence fields.
      Parameters:
      values - Map that contains the fields that we want to insert
      conn - Connection with which we act
      Throws:
      DAValidateException - If there is a validation error the DAValidateException is thrown
      SQLException - If there is an error in the SQL SQLException is thrown
    • postInsert

      protected void postInsert(HashGetter values, PooledConnection conn, DBStatement insertDbs) throws SQLException
      Called after every insert command. We can overload it to implements specific operations. The standard method eventually increment the sequence
      Parameters:
      values - Map that contains the fields that we have inserted
      conn - Connection with which we act
      insertDbs - Statement on which we have done the insert
      Throws:
      SQLException - If there is an error in the SQL SQLException is thrown
    • preUpdate

      protected void preUpdate(HashGetter filter, HashGetter values, PooledConnection conn) throws DAValidateException, SQLException
      Called before every update command. We can overload it to implements specific operations. The standard method set the LOGIN and DATASTAMP fields and eventually the values for the factory, branch and sequence fields.
      Parameters:
      filter - Map that contains the filter used to select the rows to update
      values - Map with the values that will be used to the update
      conn - Connection with which we act
      Throws:
      DAValidateException - If there is a validation error the DAValidateException is thrown
      SQLException - If there is an SQL error the SQLException is thrown
    • postUpdate

      protected void postUpdate(HashGetter filter, HashGetter values, PooledConnection conn)
      Called after every update command. We can overload it to implements specific operations The standard method do nothing.
      Parameters:
      filter - Map that contains the filter used to select the rows to update
      values - Map with the values that are used to the update
      conn - Connection with which we act
    • preDelete

      protected void preDelete(HashGetter filter, PooledConnection conn) throws DAValidateException, SQLException
      Called before every delete command. We can overload it to implements specific operations. The standard method eventually set the values for the factory, branch and sequence fields.
      Parameters:
      filter - Map that contains the filter used to select the rows to delete
      conn - Connection with which we act
      Throws:
      DAValidateException - If there is a validation error the DAValidateException is thrown
      SQLException - If there is an SQL error the SQLException is thrown
    • postDelete

      protected void postDelete(HashGetter filter, PooledConnection conn)
      Called after every delete command. We can overload it to implements specific operations The standard method do nothing
      Parameters:
      filter - Map that contains the filter used to select the rows to delete
      conn - Connection with which we act
    • preQuery

      protected void preQuery(HashGetter filter, PooledConnection conn) throws DAValidateException, SQLException
      Called before every query. We can overload it to implements specific operations The standard method eventually set the values for the factory and the branch fields.
      Parameters:
      filter - Map that contains the filter used as parameters for the query
      conn - Connection with which we act
      Throws:
      DAValidateException - If there is a validation error the DAValidateException is thrown
      SQLException - If there is an error in the SQL SQLException is thrown
    • getIdentity

      public Identity getIdentity()
      Retrieves an Identity object used to store the informations about the user currently logged in the application.
      Specified by:
      getIdentity in interface Identified
      Returns:
      The object that contains the informations about the user currently logged in the application
    • setIdentity

      public void setIdentity(Identity identity)
      Sets a Identity object used to store the informations about the user currently logged in the application.
      Specified by:
      setIdentity in interface Identified
      Parameters:
      identity - The object to set
    • haveDBFieldMap

      public boolean haveDBFieldMap()
      Detects whether a DBFieldMap object exists or not.
      Specified by:
      haveDBFieldMap in interface DBFieldMapper
      Returns:
      true if there is a specific DBFieldMap object, false otherwise
    • setDBObjectMap

      @Deprecated public void setDBObjectMap(DBObjectMap objectmap)
      Deprecated.
      Don't use this method, use giveDBObjectMap() instead.
      Description copied from interface: DBObjectMapper
      Sets the DBObjectMap contained in the instance
      Specified by:
      setDBObjectMap in interface DBObjectMapper
      Parameters:
      objectmap - The map of objects used in this instance
    • haveDBObjectMap

      public boolean haveDBObjectMap()
      Detects whether a DBObjectMap object exists or not
      Specified by:
      haveDBObjectMap in interface DBObjectMapper
      Returns:
      true if there is a specific DBFieldMap object different from null, false otherwise
    • setDBFieldMap

      @Deprecated public void setDBFieldMap(DBFieldMap fieldmap)
      Deprecated.
      Don't use this method, use giveDBObjectMap() instead.
      Description copied from interface: DBFieldMapper
      Sets the DBFieldMap object
      Specified by:
      setDBFieldMap in interface DBFieldMapper
      Parameters:
      fieldmap - The map used for the transformations of fields names
    • getDBObjectMap

      public DBObjectMap getDBObjectMap()
      Returns the DBObjectMap of the instance
      Specified by:
      getDBObjectMap in interface DBObjectMapper
      Returns:
      The map used in the instance
    • getDBFieldMap

      public DBFieldMap getDBFieldMap()
      Returns the DBFieldMap used by the statements to do the data readings and writings
      Specified by:
      getDBFieldMap in interface DBFieldMapper
      Returns:
      The map used by the statemets
    • setReadOnlyCols

      public DBView setReadOnlyCols(DBView dbv, String[] columns)
      Allows you to specify which ones are the read-only columns of a DBView and should be used when you want to save a DBView that has been created using a custom query that use a join on multiple tables. The read-only columns are not saved by the save() method.
      Parameters:
      dbv - the DBView for which you want to set the read-only columns
      columns - Arrays of strings with colums names
      Returns:
      The DBView which the desired columns are set as read-only
    • getReadOnlyCols

      public String[] getReadOnlyCols(DBView dbv)
      Given a DBView return an array of strings that contains the names of the read-only columns of the DBView
      Parameters:
      dbv - The DBView for which you want to know the read-only columns
      Returns:
      Array containing the names of the read-only columns. If there aren't read-only columns il will return null
    • removeReadOnlyCols

      public DBView removeReadOnlyCols(DBView dbv)
      Resets the definition of the read-only columns for the DBView
      Parameters:
      dbv - The DBView for which you want to reset the definition of the read-only columns
      Returns:
      DBView where all the columns are no longer read-only
    • query

      public DBView query(int queryid, HashGetter values, int maxrows)
      Executes a query. The query is specified by a unique numeric id; it can be one of the predefined ids (like SELECT_FILTER, SELECT_NONE or SELECT_PK) or one specific defined by the giveQueries() method
      Parameters:
      queryid - Numeric id that identifies the specific query
      values - Map that contains the values that will be associated to the parameters of the query (it can be null)
      maxrows - Maximum numer of rows to extract (0 if we want to extract ALL the rows)
      Returns:
      A DBView that contains the data extracted by the query
    • query

      public DBView query(int queryid, HashGetter values, int maxrows, int skiprows)
      Executes a query. The query is specified by a unique numeric id; it can be one of the predefined ids (like SELECT_FILTER, SELECT_NONE or SELECT_PK) or one specific defined by the giveQueries() method
      Parameters:
      queryid - Numeric id that identifies the specific query
      values - Map that contains the values that will be associated to the parameters of the query (it can be null)
      maxrows - Maximum numer of rows to extract (0 if we want to extract ALL the rows)
      skiprows - Number of initial lines that you do not want to be returned. Even these lines, although skipped, are counted in the maxrows parameter.
      Returns:
      A DBView that contains the data extracted by the query
    • query

      public DBView query(int queryid, HashGetter values, int maxrows, PooledConnection conn)
      Executes a query. The query is specified by a unique numeric id; it can be one of the predefined ids (like SELECT_FILTER, SELECT_NONE or SELECT_PK) or one specific defined by the giveQueries() method
      Parameters:
      queryid - Numeric id that identifies the specific query
      values - Map that contains the values that will be associated to the parameters of the query (it can be null)
      maxrows - Maximum numer of rows to extract (0 if we want to extract ALL the rows)
      conn - The connection which we use to do the query
      Returns:
      A DBView that contains the data extracted by the query
    • query

      public DBView query(int queryid, HashGetter values, int maxrows, int skiprows, PooledConnection conn)
      Executes a query. The query is specified by a unique numeric id; it can be one of the predefined ids (like SELECT_FILTER, SELECT_NONE or SELECT_PK) or one specific defined by the giveQueries() method
      Parameters:
      queryid - Numeric id that identifies the specific query
      values - Map that contains the values that will be associated to the parameters of the query (it can be null)
      maxrows - Maximum numer of rows to extract (0 if we want to extract ALL the rows)
      skiprows - Number of initial lines that you do not want to be returned. Even these lines, although skipped, are counted in the maxrows parameter.
      conn - The connection which we use to do the query
      Returns:
      A DBView that contains the data extracted by the query
    • query

      public DBView query(int queryid, HashGetter values, int maxrows, int skiprows, PooledConnection conn, DBStatementObserver observer)
      Executes a query. The query is specified by a unique numeric id; it can be one of the predefined ids (like SELECT_FILTER, SELECT_NONE or SELECT_PK) or one specific defined by the giveQueries() method
      Parameters:
      queryid - Numeric id that identifies the specific query
      values - Map that contains the values that will be associated to the parameters of the query (it can be null)
      maxrows - Maximum numer of rows to extract (0 if we want to extract ALL the rows)
      skiprows - Number of initial lines that you do not want to be returned. Even these lines, although skipped, are counted in the maxrows parameter.
      conn - The connection which we use to do the query; the connection must already have been extracted from a pool.
      observer - The DBStatementObserver that will receive the creation and release of the DBStatement
      Returns:
      A DBView that contains the data extracted by the query
    • command

      public int command(int commandId, HashGetter filter, HashGetter values) throws DAValidateException, DAException
      Executes a command. The command is specified by a unique numeric id; it can be one of the predefined ids (like DELETE_PK, UPDATE_PK and so on) or one specific defined by the giveCommands() method
      Parameters:
      commandId - Numeric id that identifies the specific command
      filter - Map that contains the parmeters used to find the record on which we want to execute the command. If the command don't ness a filter we can use null
      values - Map that contains the values that we want to apply to the selected records on which we want to execute the command. If the command don't need values, we can use null
      Returns:
      An integer that indicates the number of record on which the command have act. Before the returning the method make a commit and release the connection to the pool
      Throws:
      DAValidateException - If there are error in the pre-validation phase, a DAValidateException is thrown and the connection is closed
      DAException - If there is a (blocking) data-access error, a DAException is thrown
    • command

      public int command(int iCommandId, HashGetter filter, HashGetter values, PooledConnection conn) throws DAValidateException, DAException
      Executes a command. The command is specified by a unique numeric id; it can be one of the predefined ids (like DELETE_PK, UPDATE_PK and so on) or one specific defined by the giveCommands() method
      Parameters:
      iCommandId - Numeric id that identifies the specific command
      filter - Map that contains the parmeters used to find the record on which we want to execute the command. If the command don't ness a filter we can use null
      values - Map that contains the values that we want to apply to the selected records on which we want to execute the command. If the command don't need values, we can use null
      conn - The connection which we use to do the command
      Returns:
      An integer that indicates the number of record on which the command have act. Before the returning the method make a commit and release the connection to the pool
      Throws:
      DAValidateException - DAValidateException If there are error in the pre-validation phase, a DAValidateException is thrown and the connection is closed
      DAException - If there is a (blocking) data-access error, a DAException is thrown
    • command

      public int command(int commandId, HashGetter filter, HashGetter values, PooledConnection conn, DBStatementObserver observer) throws DAValidateException, DAException
      Executes a command. The command is specified by a unique numeric id; it can be one of the predefined ids (like DELETE_PK, UPDATE_PK and so on) or one specific defined by the giveCommands() method
      Parameters:
      commandId - Numeric id that identifies the specific command
      filter - Map that contains the parmeters used to find the record on which we want to execute the command. If the command don't ness a filter we can use null
      values - Map that contains the values that we want to apply to the selected records on which we want to execute the command. If the command don't need values, we can use null
      conn - The connection which we use to do the command
      observer - The DBStatementObserver that will receive the creation and release of the DBStatement
      Returns:
      An integer that indicates the number of record on which the command have act. Before the returning the method make a commit and release the connection to the pool
      Throws:
      DAValidateException - DAValidateException If there are error in the pre-validation phase, a DAValidateException is thrown and the connection is closed
      DAException - If there is a (blocking) data-access error, a DAException is thrown
    • save

      public boolean save(DBView dbv) throws DAValidateException, DAException
      Takes a DBView as parameter and performs on the database all the operation (insert, delete, update) that have been done on the DBView itself. At the end the method do a commit and makes the changes effective.
      Parameters:
      dbv - DBView that you want to save on the database
      Returns:
      true if the save is succesful, false otherwise
      Throws:
      DAValidateException - If there are errors in the pre-validation phase an exception is raised to the caller and the connection extracted from the pool is closed
      DAException - If there is a (blocking) data-access error, a DAException is thrown
    • save

      public boolean save(DBView dbv, PooledConnection conn) throws DAValidateException, DAException
      Takes a DBView as parameter and performs on the database all the operation (insert, delete, update) that have been done on the DBView itself. At the end the method don't do a commit so the changes are not effective.
      Parameters:
      dbv - DBView that you want to save on the database
      conn - Connection which is used to make the operations. The connections must be already extracted form the pool
      Returns:
      true if the save is succesful, false otherwise
      Throws:
      DAValidateException - If there are errors in the pre-validation phase an exception is raised to the caller
      DAException - If there is a (blocking) data-access error, a DAException is thrown
    • replace

      public boolean replace(DBView dbv, String[] keys) throws DAValidateException, DAException
      Saves the information contained in a DBView by performing an insert of all the DBView records after deleting those previously present in DB. At the end the method do a commit and makes the changes effective.
      Parameters:
      dbv - DBView that you want to save on the database
      keys - Array of strings that represents the keys used to delete the database records before the insert of the new ones
      Returns:
      true if the save is successful, false otherwise
      Throws:
      DAValidateException - If there are errors in the pre-validation phase an exception is raised to the caller and the connection extracted from the pool is closed
      DAException - If there is a (blocking) data-access error, a DAException is thrown
    • replace

      public boolean replace(DBView dbv, PooledConnection conn, String[] keys) throws DAValidateException, DAException
      Saves the information contained in a DBView by performing an insert of all the DBView records after deleting those previously present in DB. At the end the method do a commit and makes the changes effective.
      Parameters:
      dbv - DBView that you want to save on the database
      conn - Connection which is used to make the operations. The connections must be already extracted form the pool
      keys - Array of strings that represents the keys used to delete the database records before the insert of the new ones
      Returns:
      true if the save is successful, false otherwise
      Throws:
      DAValidateException - If there are errors in the pre-validation phase an exception is raised to the caller and the connection extracted from the pool is closed
      DAException - If there is a (blocking) data-access error, a DAException is thrown
    • getDBFields

      public DBFields getDBFields()
      Makes a fetch on the table associated to the specific DA, to retrieve the DBFields, an ordered Field collection access by name
      Returns:
      The DBFields of the table
    • getFieldMap

      @Deprecated public HashGetter getFieldMap()
      Deprecated.
      Use getDBFields() instead, that makes a fetch on the table
      Returns:
      Use getDBFields() instead, that makes a fetch on the table
    • getAutoIncrementVal

      protected Long getAutoIncrementVal(DBStatement insertDbs, PooledConnection conn) throws SQLException
      Retrieves the new id according to the specific DB. on other DBs we retrieve it with some query on the connection (mysql). If the value must be preset using a sequence (on oracle and postgres) the method will return null.
      Parameters:
      insertDbs - The statement used to retrieve the new id
      conn - The connection used to retrieve the new id
      Returns:
      The new id (null if the value must be preset using a sequence)
      Throws:
      SQLException - If there is an error in the SQL SQLException is thrown
    • getSequenceNextVal

      protected Long getSequenceNextVal(PooledConnection conn) throws SQLException
      Retrieves the new sequence value according to the specific DB.
      Parameters:
      conn - The connection used to retrieve the new value
      Returns:
      The new sequence value
      Throws:
      SQLException - If there is an error in the SQL SQLException is thrown
    • useConnection

      public PooledConnection useConnection(String poolName, int cmdId)
      Extracts a connection from the pool
      Parameters:
      poolName - Name of the pool from which we extract the connection
      cmdId - Numeric id of the command
      Returns:
      The connection extracted from the pool
    • release

      public void release(PooledConnection conn)
      Releases a connection and returns it to the pool from which it has been extracted
      Parameters:
      conn - The connection that must be released
    • getQueryId

      public static int getQueryId(String id, int def, DABase da)
      Returns the id of the query passed as parameter
      Parameters:
      id - The name of the query
      def - The default id
      da - The specific DA
      Returns:
      The id of the query passed as parameters
    • getQueryId

      public static int getQueryId(String id, DABase da)
      Returns the id of the query passed as parameter
      Parameters:
      id - he name of the query
      da - The specific DA
      Returns:
      The id of the query passed as parameters
    • getDataAttributes

      public List<DataAttribute> getDataAttributes()
      Description copied from interface: DataAttributesHolder
      Returns a List<DataAttribute> about the EDM data attributes.
      Specified by:
      getDataAttributes in interface DataAttributesHolder
      Returns:
      a List<DataAttribute> about the EDM data attributes.
    • setDataAttributes

      public void setDataAttributes(List<DataAttribute> dataAttributes)
      Description copied from interface: DataAttributesHolder
      Sets the provided dataAttributes.
      Specified by:
      setDataAttributes in interface DataAttributesHolder
      Parameters:
      dataAttributes - List<DataAttribute> about the EDM data attributes to be set.
    • markAsDecorated

      public void markAsDecorated()
      Description copied from interface: EDMConfigurableBean
      Mark this EDMConfigurableBean as already decorated with EDM configuration.
      Specified by:
      markAsDecorated in interface EDMConfigurableBean
    • hasNotBeenDecorated

      public boolean hasNotBeenDecorated()
      Description copied from interface: EDMConfigurableBean
      Returns true in case this EDMConfigurableBean has not been already decorated with EDM configuration; false otherwise.
      Specified by:
      hasNotBeenDecorated in interface EDMConfigurableBean
      Returns:
      true in case this EDMConfigurableBean has not been already decorated with EDM configuration; false otherwise.