Package chemaxon.jchem.db
Class RegenerationChecker
java.lang.Object
chemaxon.jchem.db.RegenerationChecker
Class for checking if regeneration is necessary.
- Since:
- JChem 5.1.3
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic chemaxon.jchem.version.TableVersion
deduceTableVersion
(String tableName, DatabaseProperties dp) Deduce a table's version from its properties and current regeneration conditions.static chemaxon.jchem.version.TableVersion
deduceTableVersion
(String tableName, DatabaseProperties dp, int regenerationType) Deduce a table's version from its properties and current regeneration conditions.getColumnsToRegenerate
(ConnectionHandler conh, String tableName, int regenerationType) Return the columns should be regenerated in a table depending on a regeneration type.static int
getRegenerationTypeForTable
(DatabaseProperties dp, String tableName) Get which kind of regeneration is needed for a structure table.getTablesToRegenerate
(ConnectionHandler conh, int regenerationType) Give back the tables that need a type of regeneration.getTablesToRegenerate
(ConnectionHandler conh, int regenerationType, ProgressWriter pw) Give back the tables that need a type of regeneration.static int
isRegenerationNeeded
(String tableName, DatabaseProperties dp) Check whether any regeneration type is needed for a table.static int
isRegenerationNeeded
(String tableName, DatabaseProperties dp, int regenerationType) Check whether regeneration is needed for a table.static int
isRegenerationNeeded
(String tableName, DatabaseProperties dp, Document xml, int regenerationType) Check whether regeneration is needed for a table or not.static int
isRegenerationNeededExact
(String tableName, DatabaseProperties dp, Document xml, int regenerationType) Check whether a regeneration type is needed for a table or not.
-
Field Details
-
TAG_CONDITION
- See Also:
-
TAG_PROPERTY
- See Also:
-
TAG_PROPERTY_NAME
- See Also:
-
TAG_PROPERTY_VALUE
- See Also:
-
TAG_FULL
- See Also:
-
TAG_CT
- See Also:
-
TAG_NOCT
- See Also:
-
TAG_MD
- See Also:
-
ATTR_OPERATION
- See Also:
-
OPER_EQUALS
- See Also:
-
OPER_NOT_EQUALS
- See Also:
-
GET_TABLE_COLUMN_DATA_SQL
- See Also:
-
-
Constructor Details
-
RegenerationChecker
public RegenerationChecker()
-
-
Method Details
-
isRegenerationNeeded
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 inRegenerationConstants
.- 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 inRegenerationConstants
.- 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 inRegenerationConstants
.- 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 tabledp
- 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 tabledp
- Database Properties object.regenerationType
- Regeneration type defined inRegenerationConstants
.- 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 inRegenerationConstants
.- 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 inRegenerationConstants
.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 inRegenerationConstants
.- Returns:
- List of table field names.
- Throws:
SQLException
- if an sql error encountered
-