diff --git a/modevo-script/src/main/java/giis/modevo/migration/script/Script.java b/modevo-script/src/main/java/giis/modevo/migration/script/Script.java index 3ae014d..b219855 100644 --- a/modevo-script/src/main/java/giis/modevo/migration/script/Script.java +++ b/modevo-script/src/main/java/giis/modevo/migration/script/Script.java @@ -14,7 +14,7 @@ import giis.modevo.model.schema.Schema; import giis.modevo.model.schema.Table; import giis.modevo.model.schemaevolution.CriteriaSplit; -import giis.modevo.model.schemaevolution.JoinColumn; +import giis.modevo.model.schemaevolution.MergeColumn; import giis.modevo.model.schemaevolution.SchemaChange; import giis.modevo.model.schemaevolution.SchemaEvolution; import giis.modevo.model.schemaevolution.SplitColumn; @@ -83,7 +83,7 @@ private Script migrationJoinColumn(Schema schema, SchemaEvolution se, MigrationT log.info("Join Column Script. Target table: %s", mt.getName()); Script script = new Script (); for (SchemaChange sc : se.getChanges()) { - if (sc instanceof JoinColumn spc) { + if (sc instanceof MergeColumn spc) { List sourceColumns = spc.getSourceColumns(); Column newColumn = spc.getC(); Table t = schema.getTable(mt.getName()); diff --git a/modevo-transform/dat/bmk/testCustomV8JoinColumn-dataMigration.xmi b/modevo-transform/dat/bmk/testCustomV8JoinColumn-dataMigration.xmi index 1e1f7a3..ead1a0c 100644 --- a/modevo-transform/dat/bmk/testCustomV8JoinColumn-dataMigration.xmi +++ b/modevo-transform/dat/bmk/testCustomV8JoinColumn-dataMigration.xmi @@ -1,5 +1,5 @@ - + diff --git a/modevo-transform/dat/inp/testCustomV4JoinTable-schemaChange.xmi b/modevo-transform/dat/inp/testCustomV4JoinTable-schemaChange.xmi index 7bcf713..899679e 100644 --- a/modevo-transform/dat/inp/testCustomV4JoinTable-schemaChange.xmi +++ b/modevo-transform/dat/inp/testCustomV4JoinTable-schemaChange.xmi @@ -1,4 +1,4 @@ - + diff --git a/modevo-transform/dat/inp/testCustomV5JoinTableKeyEntityInTargetTable-schemaChange.xmi b/modevo-transform/dat/inp/testCustomV5JoinTableKeyEntityInTargetTable-schemaChange.xmi index 5ab54eb..bf6e16a 100644 --- a/modevo-transform/dat/inp/testCustomV5JoinTableKeyEntityInTargetTable-schemaChange.xmi +++ b/modevo-transform/dat/inp/testCustomV5JoinTableKeyEntityInTargetTable-schemaChange.xmi @@ -1,4 +1,4 @@ - + diff --git a/modevo-transform/dat/inp/testCustomV8JoinColumn-schemaChange.xmi b/modevo-transform/dat/inp/testCustomV8JoinColumn-schemaChange.xmi index f393184..f938215 100644 --- a/modevo-transform/dat/inp/testCustomV8JoinColumn-schemaChange.xmi +++ b/modevo-transform/dat/inp/testCustomV8JoinColumn-schemaChange.xmi @@ -1,6 +1,6 @@ - sourceColumns; private String criteria; //criteria to join the column - public JoinColumn() { + public MergeColumn() { } - public JoinColumn(Column c, Table t, String criteria) { + public MergeColumn(Column c, Table t, String criteria) { super(c, t); setSourceColumns(new ArrayList<>()); this.setCriteria(criteria); @@ -44,7 +44,7 @@ protected List changesSchemaModel (NodeList list, Node node) { } Column c = columnFromModelToObject(elementColumnSource, source); String criteriaString = elementCopy.getAttribute("criteria"); - JoinColumn jt = new JoinColumn(c, source, criteriaString); + MergeColumn jt = new MergeColumn(c, source, criteriaString); String[] columnsIdArray = idsSourceColumns.split(" "); for (String id : columnsIdArray) { Element column = getElementById(list, id); diff --git a/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/JoinTable.java b/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/MergeTable.java similarity index 82% rename from modevo-transform/src/main/java/giis/modevo/model/schemaevolution/JoinTable.java rename to modevo-transform/src/main/java/giis/modevo/model/schemaevolution/MergeTable.java index 90f7c3b..0ce1053 100644 --- a/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/JoinTable.java +++ b/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/MergeTable.java @@ -14,15 +14,15 @@ * Subclass of SchemaChange to define two tables to be joined. */ @Getter @Setter -public class JoinTable extends SchemaChange { +public class MergeTable extends SchemaChange { private Table originalTable; private Table newTable; - public JoinTable() { + public MergeTable() { } - public JoinTable(Table originalTable, Table newTable) { + public MergeTable(Table originalTable, Table newTable) { super(originalTable); this.setOriginalTable(originalTable); this.setNewTable(newTable); @@ -36,7 +36,7 @@ protected List changesSchemaModel (Node node) { String target = elementSplit.getAttribute("tableTarget"); Table tableSource = new Table(source); Table tableTarget = new Table(target); - JoinTable jt = new JoinTable(tableSource, tableTarget); + MergeTable jt = new MergeTable(tableSource, tableTarget); changes.add(jt); return changes; } diff --git a/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/SchemaEvolution.java b/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/SchemaEvolution.java index ac6de9d..043deda 100644 --- a/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/SchemaEvolution.java +++ b/modevo-transform/src/main/java/giis/modevo/model/schemaevolution/SchemaEvolution.java @@ -80,18 +80,18 @@ public SchemaEvolution readSchemaEvolutionModel(String pathSchemaEvolutionModel) } else if (nameElement.equalsIgnoreCase("SplitColumn")) { log.info ("New Split Column schema modification"); se.getChanges().addAll(new SplitColumn().changesSchemaModel(list, node)); - } else if (nameElement.equalsIgnoreCase("JoinTable")) { + } else if (nameElement.equalsIgnoreCase("MergeTable")) { log.info ("New Join Table schema modification"); - se.getChanges().addAll(new JoinTable().changesSchemaModel(node)); + se.getChanges().addAll(new MergeTable().changesSchemaModel(node)); } else if (nameElement.equalsIgnoreCase("CopyTable")) { log.info ("New Copy Table schema modification"); se.getChanges().addAll(new CopyTable().changesSchemaModel(list, node)); } else if (nameElement.equalsIgnoreCase("SplitTable")) { log.info ("New Split Table schema modification"); se.getChanges().addAll(new SplitTable().changesSchemaModel(list, node)); - } else if (nameElement.equalsIgnoreCase("JoinColumn")) { + } else if (nameElement.equalsIgnoreCase("MergeColumn")) { log.info ("New Join Column schema modification"); - se.getChanges().addAll(new JoinColumn().changesSchemaModel(list, node)); + se.getChanges().addAll(new MergeColumn().changesSchemaModel(list, node)); } else if (nameElement.equalsIgnoreCase("RemovePK")) { log.info ("New Remove PK schema modification"); se.getChanges().addAll(new RemovePK().changesSchemaModel(node)); diff --git a/modevo-transform/src/main/java/giis/modevo/transformations/MainTransformations.java b/modevo-transform/src/main/java/giis/modevo/transformations/MainTransformations.java index 9694693..40eea09 100644 --- a/modevo-transform/src/main/java/giis/modevo/transformations/MainTransformations.java +++ b/modevo-transform/src/main/java/giis/modevo/transformations/MainTransformations.java @@ -145,11 +145,11 @@ public void launchTransformations(IProgressMonitor monitor) { launcher.addLibrary("f", getLibraryAsStream("SchemaTable")); launcher.addLibrary("g", getLibraryAsStream("NewColumn")); launcher.addLibrary("h", getLibraryAsStream("NewTable")); - launcher.addLibrary("i", getLibraryAsStream("JoinTable")); + launcher.addLibrary("i", getLibraryAsStream("MergeTable")); launcher.addLibrary("j", getLibraryAsStream("SplitColumn")); launcher.addLibrary("k", getLibraryAsStream("SplitTable")); launcher.addLibrary("l", getLibraryAsStream("CopyTable")); - launcher.addLibrary("m", getLibraryAsStream("JoinColumn")); + launcher.addLibrary("m", getLibraryAsStream("MergeColumn")); launcher.addLibrary("n", getLibraryAsStream("RemovePK")); } catch (IOException e) { diff --git a/modevo-transform/src/main/java/giis/modevo/transformations/atl/JoinColumn.atl b/modevo-transform/src/main/java/giis/modevo/transformations/atl/MergeColumn.atl similarity index 64% rename from modevo-transform/src/main/java/giis/modevo/transformations/atl/JoinColumn.atl rename to modevo-transform/src/main/java/giis/modevo/transformations/atl/MergeColumn.atl index a241623..a794176 100644 --- a/modevo-transform/src/main/java/giis/modevo/transformations/atl/JoinColumn.atl +++ b/modevo-transform/src/main/java/giis/modevo/transformations/atl/MergeColumn.atl @@ -1,21 +1,21 @@ -module JoinColumn; +module MergeColumn; create OUT: DataMigration from LM:Schema, CM:ConceptualModel, CH:SchemaEvolution; -rule JoinColumn { +rule MergeColumn { from - j: SchemaEvolution!JoinColumn + j: SchemaEvolution!MergeColumn to add: DataMigration!MigrationTable( name<- j.table, - joincol <- thisModule.JoinColumnMigCol(j) + joincol <- thisModule.MergeColumnMigCol(j) ) } ---Lazy rule that creates a Migration Column class particularly specialized for a Join column schema modification -lazy rule JoinColumnMigCol { +lazy rule MergeColumnMigCol { from - j: SchemaEvolution!JoinColumn + j: SchemaEvolution!MergeColumn to - add: DataMigration!JoinColumn ( + add: DataMigration!MergeColumn ( ColTarget <- j.targetColumn.name, ColSource <- thisModule.getNamesColumn (j.sourceColumns) ) diff --git a/modevo-transform/src/main/java/giis/modevo/transformations/atl/JoinTable.atl b/modevo-transform/src/main/java/giis/modevo/transformations/atl/MergeTable.atl similarity index 83% rename from modevo-transform/src/main/java/giis/modevo/transformations/atl/JoinTable.atl rename to modevo-transform/src/main/java/giis/modevo/transformations/atl/MergeTable.atl index 5d82780..b51979c 100644 --- a/modevo-transform/src/main/java/giis/modevo/transformations/atl/JoinTable.atl +++ b/modevo-transform/src/main/java/giis/modevo/transformations/atl/MergeTable.atl @@ -1,10 +1,10 @@ -module JoinTable; +module MergeTable; create OUT: DataMigration from LM:Schema, CM:ConceptualModel, CH:SchemaEvolution; ---Rule for joining two tables -rule joinTable { +rule mergeTable { from - j: SchemaEvolution!JoinTable + j: SchemaEvolution!MergeTable using{ tableTarget: Schema!Table = Schema!Table.allInstancesFrom('LM') --Main table to get the data is the previous version ->any (t | t.name = j.tableTarget); @@ -18,34 +18,34 @@ rule joinTable { to d: DataMigration!MigrationTable( name<- j.tableTarget, - migcol <- columnsInOnlySourceTable -> collect (c | thisModule.columnMigColJoin(c, columnsInBothTablesTarget, tableTarget, j)) + migcol <- columnsInOnlySourceTable -> collect (c | thisModule.columnMigColMerge(c, columnsInBothTablesTarget, tableTarget, j)) ) } ---Details migration for a single column that has been added to a new table -lazy rule columnMigColJoin { +lazy rule columnMigColMerge { from column: Schema!Column, colPotentialKey: Sequence (Schema!Column), tableTarget: Schema!Table, - j: SchemaEvolution!JoinTable + j: SchemaEvolution!MergeTable using { keyColumnToColumn : Sequence (Schema!Column) = thisModule.typeKey (colPotentialKey, thisModule.extractEntityByName (column.nameEntity), tableTarget); } to add: DataMigration!MigrationCol ( --for each new column - MigrateTo <- thisModule.columnToJoinTable (keyColumnToColumn, column, j), + MigrateTo <- thisModule.columnToMergeTable (keyColumnToColumn, column, j), MigrateFrom <- thisModule.columnFrom (keyColumnToColumn, column) ) } ---Details the migration to a target column. This is rule is triggered when there is a new column added to an existing table -lazy rule columnToJoinTable { +lazy rule columnToMergeTable { from keysColumnFrom: Sequence (Schema!Column), r: Schema!Column, - j: SchemaEvolution!JoinTable + j: SchemaEvolution!MergeTable to MigrateFrom: DataMigration!Target ( Data<- r.name, diff --git a/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/DataMigration.ecore b/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/DataMigration.ecore index ae51708..29258b3 100644 --- a/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/DataMigration.ecore +++ b/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/DataMigration.ecore @@ -5,11 +5,11 @@ - + - + - + diff --git a/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/SchemaEvolution.ecore b/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/SchemaEvolution.ecore index bcf71ba..7a6cbb5 100644 --- a/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/SchemaEvolution.ecore +++ b/modevo-transform/src/main/java/giis/modevo/transformations/atl/Metamodels/SchemaEvolution.ecore @@ -50,7 +50,7 @@ - + @@ -64,7 +64,7 @@ - +