Class RegenerationChecker


  • @PublicAPI
    public class RegenerationChecker
    extends Object
    Class for checking if regeneration is necessary.
    Since:
    JChem 5.1.3
    • Constructor Detail

      • RegenerationChecker

        public RegenerationChecker()
    • Method Detail

      • isRegenerationNeeded

        public static int isRegenerationNeeded​(String tableName,
                                               DatabaseProperties dp)
                                        throws SQLException
        Check whether any regeneration type is needed for a table. Uses default rules.
        Parameters:
        tableName - Name of the table to be checked.
        dp - DatabaseProperties object.
        Returns:
        If table version is newer older or match the JChem version.
        Throws:
        SQLException - if an sql error encountered
      • isRegenerationNeeded

        public static int isRegenerationNeeded​(String tableName,
                                               DatabaseProperties dp,
                                               int regenerationType)
                                        throws SQLException
        Check whether regeneration is needed for a table. Uses default rules.
        Parameters:
        tableName - Name of the table to be checked.
        dp - DatabaseProperties object.
        regenerationType - Regeneration type defined in RegenerationConstants.
        Returns:
        If table version is newer older or match the JChem version.
        Throws:
        SQLException - if an sql error encountered
      • isRegenerationNeeded

        public static int isRegenerationNeeded​(String tableName,
                                               DatabaseProperties dp,
                                               Document xml,
                                               int regenerationType)
                                        throws SQLException
        Check whether regeneration is needed for a table or not. Uses a custom xml document which defines the regeneration rules.
        Parameters:
        tableName - Name of the table to be checked.
        dp - DatabaseProperties object.
        xml - Xml Document object.
        regenerationType - Regeneration type defined in RegenerationConstants.
        Returns:
        If table version is newer older or match the JChem version.
        Throws:
        SQLException - if an sql error encountered
      • isRegenerationNeededExact

        public static int isRegenerationNeededExact​(String tableName,
                                                    DatabaseProperties dp,
                                                    Document xml,
                                                    int regenerationType)
                                             throws SQLException
        Check whether a regeneration type is needed for a table or not. Searches for one specific tag in the xml and does not calculate with dependencies between regeneration types, e.g. CT regeneration + Without CT regeneration = Full regeneration
        Parameters:
        tableName - Name of the table to be checked.
        dp - DatabaseProperties object.
        xml - Xml Document object.
        regenerationType - Regeneration type defined in RegenerationConstants.
        Returns:
        If table version is newer older or match the JChem version.
        Throws:
        SQLException - if an sql error encountered
      • deduceTableVersion

        public static chemaxon.jchem.version.TableVersion deduceTableVersion​(String tableName,
                                                                             DatabaseProperties dp)
                                                                      throws SQLException
        Deduce a table's version from its properties and current regeneration conditions.
        Parameters:
        tableName - Name of the structure table
        dp - Database Properties object.
        Returns:
        The table version.
        Throws:
        SQLException - if an sql error encountered
      • deduceTableVersion

        public static chemaxon.jchem.version.TableVersion deduceTableVersion​(String tableName,
                                                                             DatabaseProperties dp,
                                                                             int regenerationType)
                                                                      throws SQLException
        Deduce a table's version from its properties and current regeneration conditions.
        Parameters:
        tableName - Name of the structure table
        dp - Database Properties object.
        regenerationType - Regeneration type defined in RegenerationConstants.
        Returns:
        The table version.
        Throws:
        SQLException - if an sql error encountered
      • getTablesToRegenerate

        public static List<String> getTablesToRegenerate​(ConnectionHandler conh,
                                                         int regenerationType)
                                                  throws SQLException
        Give back the tables that need a type of regeneration.
        Parameters:
        conh - Connection handler.
        regenerationType - Regeneration type defined in RegenerationConstants.
        Returns:
        List of table names that need to be regenerated.
        Throws:
        SQLException - if an sql error encountered
      • getTablesToRegenerate

        public static List<String> getTablesToRegenerate​(ConnectionHandler conh,
                                                         int regenerationType,
                                                         ProgressWriter pw)
                                                  throws SQLException
        Give back the tables that need a type of regeneration.
        Parameters:
        conh - Connection handler.
        regenerationType - Regeneration type defined in RegenerationConstants.
        pw - Progress writer.
        Returns:
        List of table names that need to be regenerated.
        Throws:
        SQLException - if an sql error encountered
      • getRegenerationTypeForTable

        public static int getRegenerationTypeForTable​(DatabaseProperties dp,
                                                      String tableName)
                                               throws SQLException
        Get which kind of regeneration is needed for a structure table.
        Parameters:
        dp - DatabaseProperties object.
        tableName - Name of the table.
        Returns:
        Regeneration type defined in RegenerationConstants.
        Throws:
        SQLException - if an sql error encountered
      • getColumnsToRegenerate

        public static List<String> getColumnsToRegenerate​(ConnectionHandler conh,
                                                          String tableName,
                                                          int regenerationType)
                                                   throws SQLException
        Return the columns should be regenerated in a table depending on a regeneration type.
        Parameters:
        conh - Connection handler.
        tableName - Name of the table.
        regenerationType - Regeneration type defined in RegenerationConstants.
        Returns:
        List of table field names.
        Throws:
        SQLException - if an sql error encountered