From 144190fc4bce0239522df7dc15478c4eea28340b Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 27 Jun 2023 23:53:41 +0200 Subject: [PATCH] [DOC] add some comment in migration --- .../archidata/migration/MigrationEngine.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/org/kar/archidata/migration/MigrationEngine.java b/src/org/kar/archidata/migration/MigrationEngine.java index 78ad34f..569c8f4 100644 --- a/src/org/kar/archidata/migration/MigrationEngine.java +++ b/src/org/kar/archidata/migration/MigrationEngine.java @@ -6,8 +6,6 @@ import java.util.ArrayList; import java.util.List; import org.kar.archidata.SqlWrapper; -import org.kar.archidata.annotation.SQLComment; -import org.kar.archidata.annotation.SQLLimitSize; import org.kar.archidata.db.DBConfig; import org.kar.archidata.db.DBEntry; import org.slf4j.Logger; @@ -21,23 +19,38 @@ public class MigrationEngine { // initialization of the migration if the DB is not present... private MigrationInterface init; + /** + * Migration engine constructor (empty). + */ public MigrationEngine() { this(new ArrayList(), null); } + /** + * Migration engine constructor (specific mode). + * @param datas All the migration ordered. + * @param init Initialization migration model. + */ public MigrationEngine( List datas, MigrationInterface init) { this.datas = datas; this.init = init; } - + /** + * Add a Migration in the list + * @param migration Migration to add. + */ public void add(MigrationInterface migration) { datas.add(migration); } + /** + * Set first initialization class + * @param migration migration class for first init. + */ public void setInit(MigrationInterface migration) { init = migration; } /** * Get the current version/migration name - * @return String represent the last migration. If null then no migration has been done. + * @return Model represent the last migration. If null then no migration has been done. */ public MigrationModel getCurrentVersion() { if (!SqlWrapper.isTableExist("KAR_migration")) { @@ -64,7 +77,12 @@ public class MigrationEngine { } return null; } - + /** + * Process the automatic migration of the system + * @param config SQL connection for the migration + * @throws InterruptedException user interrupt the migration + * @throws IOException Error if access on the DB + */ public void migrate(DBConfig config) throws InterruptedException, IOException { LOGGER.info("Execute migration ... [BEGIN]");