Class ComboTableData


  • public class ComboTableData
    extends Object
    Author:
    Fernando Iriazabal This class builds the queries for populating the different kind of combos in the application.
    • Constructor Detail

      • ComboTableData

        public ComboTableData​(ConnectionProvider _conn,
                              String _referenceType,
                              String _name,
                              String _objectReference,
                              String _validation,
                              String _orgList,
                              String _clientList,
                              int _index)
                       throws Exception
        Constructor
        Parameters:
        _conn - Object with the database connection methods.
        _referenceType - String with the type of reference.
        _name - String with the Object name.
        _objectReference - String with id to the reference value.
        _validation - String with the id to the validation.
        _orgList - String with the list of granted organizations.
        _clientList - String with the list of granted clients.
        _index - String with the id of the default value for the combo.
        Throws:
        Exception
      • ComboTableData

        public ComboTableData​(VariablesSecureApp _vars,
                              ConnectionProvider _conn,
                              String _referenceType,
                              String _name,
                              String _objectReference,
                              String _validation,
                              String _orgList,
                              String _clientList,
                              int _index)
                       throws Exception
        Constructor
        Parameters:
        _vars - Object with the session methods.
        _conn - Object with the database connection methods.
        _referenceType - String with the type of reference.
        _name - String with the Object name.
        _objectReference - String with id to the reference value.
        _validation - String with the id to the validation.
        _orgList - String with the list of granted organizations.
        _clientList - String with the list of granted clients.
        _index - String with the id of the default value for the combo.
        Throws:
        Exception
      • ComboTableData

        public ComboTableData()
    • Method Detail

      • getVars

        public VariablesSecureApp getVars()
        Getter for the session object.
        Returns:
        Session object.
      • getPool

        public ConnectionProvider getPool()
        Getter for the database handler object.
        Returns:
        Database handler object.
      • getObjectName

        public String getObjectName()
        Getter for the object name.
        Returns:
        String with the object name.
      • getObjectReference

        public String getObjectReference()
        Getter for the object reference id.
        Returns:
        String with the object reference id.
      • getOrgList

        public String getOrgList()
        Getter for the granted organizations list.
        Returns:
        String with the granted organizations list.
      • getClientList

        public String getClientList()
        Getter for the granted clients list.
        Returns:
        String with the granted clients list.
      • addSelectField

        public void addSelectField​(String _field,
                                   String _alias)
        Adds new field to the select section of the query.
        Parameters:
        _field - String with the field.
        _alias - String with the alias for this field.
      • addFromField

        public void addFromField​(String _field,
                                 String _alias)
        Adds new field to the from section of the query.
        Parameters:
        _field - String with the field.
        _alias - String with the alias for the field.
      • addWhereField

        public void addWhereField​(String _field,
                                  String _type)
        Adds new field to the where section of the query.
        Parameters:
        _field - String with the field.
        _type - String for group fields.
      • addOrderByField

        public void addOrderByField​(String _field)
        Adds new field to the order by section of the query.
        Parameters:
        _field - String with the field.
      • addFromParameter

        public void addFromParameter​(String _parameter,
                                     String _fieldName)
        Adds a new parameter to the from section of the query.
        Parameters:
        _parameter - String with the parameter.
        _fieldName - String with the name od the field.
      • addWhereParameter

        public void addWhereParameter​(String _parameter,
                                      String _fieldName,
                                      String _type)
        Adds a new parameter to the where section of the query.
        Parameters:
        _parameter - String with the parameter.
        _fieldName - String with the name of the field.
        _type - String with a group name.
      • setParameter

        public void setParameter​(String name,
                                 String value)
                          throws Exception
        Setter for the parameters value.
        Parameters:
        name - The name of the field defined for the parameter.
        value - The value for this parameter.
        Throws:
        Exception
      • parseValidation

        public void parseValidation()
                             throws Exception
        Parse the validation string searching the @ elements and replacing them with the correct values, adding the needed parameters.
        Throws:
        Exception
      • parseContext

        public String parseContext​(String context,
                                   String type)
        Auxiliar method to replace the variable sections of the clauses.
        Parameters:
        context - String with the variable.
        type - String with the type of the clause (WHERE, ORDER...)
        Returns:
        String with the text replaced.
      • identifier

        public void identifier​(String tableName,
                               FieldProvider field)
                        throws Exception
        Support method for the generateSQL method, to build the query.
        Parameters:
        tableName - String with the name of the table.
        field - String with the name of the field.
        Throws:
        Exception
      • select

        public FieldProvider[] select​(boolean includeActual)
                               throws Exception
        Executes the query in the database and returns the data.
        Parameters:
        includeActual - Boolean that indicates if the actual selected value must be included in the result, even if it doesn´t exists in the new query.
        Returns:
        Array of FieldProvider with the data.
        Throws:
        Exception
      • fillParameters

        public void fillParameters​(FieldProvider data,
                                   String window,
                                   String actual_value)
                            throws javax.servlet.ServletException
        Fill the parameters of the sql with the session values or FieldProvider values. Used in the combo fields.
        Parameters:
        data - optional FieldProvider which can be used to get the needed parameter values from. If the FieldProvider has a filed named after a parameter, then its value will be used if the value could not be already obtained from the request parameters.
        window - Window id.
        actual_value - actual value for the combo.
        Throws:
        javax.servlet.ServletException
      • canBeCached

        public boolean canBeCached()
      • isAllowedCrossOrgReference

        public boolean isAllowedCrossOrgReference()
        Returns whether the columns this combo is for allows cross organization references