Class SchemaVersionsManager
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.schema.SchemaVersionsManager
-
public class SchemaVersionsManager extends java.lang.ObjectAccess layer for WHOLE_SCHEMA_VERSION data
-
-
Constructor Summary
Constructors Constructor Description SchemaVersionsManager(IDatabaseTranslator translator, IConnectionProvider connectionPool, ITransactionProvider transactionProvider, java.lang.String schemaName, int latestCodeVersion)Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetVersionForSchema()Get the installed version for the schemabooleanisSchemaOld()Returns true if the current schema version recorded in WHOLE_SCHEMA_VERSION is older the last version in FhirSchemaVersion and therefore needs to be updatedbooleanisSchemaVersionMatch()Returns true if the current schema version recorded in WHOLE_SCHEMA_VERSION exactly matches the last version in FhirSchemaVersionvoidupdateSchemaVersion()Find the latest FhirSchemaVersion and use it to update the WHOLE_SCHEMA_VERSION tablevoidupdateSchemaVersionId(int versionId)Record the version information for the given schemaName in the WHOLESCHEMA_VERSION table, creating a new record if required
-
-
-
Constructor Detail
-
SchemaVersionsManager
public SchemaVersionsManager(IDatabaseTranslator translator, IConnectionProvider connectionPool, ITransactionProvider transactionProvider, java.lang.String schemaName, int latestCodeVersion)
Public constructor- Parameters:
translator-connectionPool-transactionProvider-schemaName-latestCodeVersion-
-
-
Method Detail
-
getVersionForSchema
public int getVersionForSchema()
Get the installed version for the schema- Returns:
- the schema version, or -1 if no schema build has completed yet
-
updateSchemaVersionId
public void updateSchemaVersionId(int versionId)
Record the version information for the given schemaName in the WHOLESCHEMA_VERSION table, creating a new record if required- Parameters:
schemaName-versionId-
-
updateSchemaVersion
public void updateSchemaVersion()
Find the latest FhirSchemaVersion and use it to update the WHOLE_SCHEMA_VERSION table
-
isSchemaOld
public boolean isSchemaOld()
Returns true if the current schema version recorded in WHOLE_SCHEMA_VERSION is older the last version in FhirSchemaVersion and therefore needs to be updated- Returns:
-
isSchemaVersionMatch
public boolean isSchemaVersionMatch()
Returns true if the current schema version recorded in WHOLE_SCHEMA_VERSION exactly matches the last version in FhirSchemaVersion- Returns:
-
-