Class DAUsers

java.lang.Object
overit.geocall.da.DABase
overit.geocall.basic.bl.user.da.DAUsers
All Implemented Interfaces:
Serializable, DataAttributesHolder, EDMConfigurableBean, overit.geocall.marks.FieldExposer, overit.geocall.marks.NameExposer, DBFieldMapper, DBObjectMapper, Identified, Tool

public class DAUsers extends DABase
See Also:
  • Field Details

  • Constructor Details

    • DAUsers

      public DAUsers()
  • Method Details

    • giveDBFieldMap

      public DBFieldMap giveDBFieldMap()
      Description copied from class: DABase
      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.
      Specified by:
      giveDBFieldMap in class DABase
      Returns:
      the DBFieldMapper that defines the object mapping, or null
    • giveDBObjectMap

      public DBObjectMap giveDBObjectMap()
      Description copied from class: DABase
      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.
      Specified by:
      giveDBObjectMap in class DABase
      Returns:
      the DBObjectMapper that defines the object mapping, or null
    • giveOrderCols

      public String[] giveOrderCols()
      Description copied from class: DABase
      Returns the array that contains the names of the columns on which we made the sorting of the result.
      Specified by:
      giveOrderCols in class DABase
      Returns:
      Array that contains the name of the fields of the specific table
    • givePoolName

      public String givePoolName()
      Description copied from class: DABase
      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.
      Specified by:
      givePoolName in class DABase
      Returns:
      The name of the pool from which the specific DA extracts the connections. It must return a not-null value
    • givePrimaryKeys

      public String[] givePrimaryKeys()
      Description copied from class: DABase
      Must be implemented and returns the array that contains the primary keys of the specific table on which the DA acts.
      Specified by:
      givePrimaryKeys in class DABase
      Returns:
      Array that contains the name of the fields that are primary keys of the specific table
    • giveSequenceField

      public String giveSequenceField()
      Description copied from class: DABase
      Must be implemented and returns a string that represent the name of the field used as sequence for the insert commands on the table.
      Specified by:
      giveSequenceField in class DABase
      Returns:
      The name of the sequence field or null if there isn't a defined sequence
    • giveTableName

      public String giveTableName()
      Description copied from class: DABase
      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.
      Specified by:
      giveTableName in class DABase
      Returns:
      The name of the table on which the specific DA acts
    • giveBranchField

      public String giveBranchField()
      Description copied from class: DABase
      Returns the field of the table in which is stored the "branch id" value
      Specified by:
      giveBranchField in class DABase
      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
    • giveFactoryField

      public String giveFactoryField()
      Description copied from class: DABase
      Returns the field of the table in which is stored the "factory id" value
      Specified by:
      giveFactoryField in class DABase
      Returns:
      The field containing the "factory id" value
    • preInsert

      protected void preInsert(HashGetter oFields, PooledConnection conn) throws DAValidateException, SQLException
      Description copied from class: DABase
      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.
      Overrides:
      preInsert in class DABase
      Parameters:
      oFields - 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
    • preUpdate

      protected void preUpdate(HashGetter filter, HashGetter values, PooledConnection conn) throws DAValidateException, SQLException
      Description copied from class: DABase
      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.
      Overrides:
      preUpdate in class DABase
      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
    • giveQueries

      protected DBView giveQueries(int i, PooledConnection conn, DBStatement stmt, HashGetter oParams, int maxrows, int skiprows) throws SQLException
      Description copied from class: DABase
      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.
      Specified by:
      giveQueries in class DABase
      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
      oParams - 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 int giveCommands(int i, PooledConnection conn, DBStatement stmt, HashGetter oKeys, HashGetter oParams) throws SQLException
      Description copied from class: DABase
      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.
      Specified by:
      giveCommands in class DABase
      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
      oKeys - Values used as filters to set for the update commands
      oParams - 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
    • command

      public int command(int commandId, HashGetter filter, HashGetter values, PooledConnection conn, DBStatementObserver observer) throws DAValidateException, DAException
      Description copied from class: DABase
      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
      Overrides:
      command in class DABase
      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