use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.
the class RemoveIndexItemProvider method getText.
/**
* This returns the label text for the adapted class. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public String getText(Object object) {
RemoveIndex removeIndex = (RemoveIndex) object;
Index index = (Index) removeIndex.getIndex();
AdapterFactoryItemDelegator delegator = new AdapterFactoryItemDelegator(getRootAdapterFactory());
final String parentLabel = delegator.getText(index);
return getString("_UI_RemoveIndex_type", new Object[] { parentLabel, new DiffContentService().getSubDiffs(removeIndex, removeIndex.getMatch().getComparison()).size() });
}
use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.
the class AlterTableItemProvider method getText.
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String getText(Object object) {
final AlterTable alterTable = (AlterTable) object;
final Table table = alterTable.getTable();
AdapterFactoryItemDelegator delegator = new AdapterFactoryItemDelegator(getRootAdapterFactory());
final String parentLabel = delegator.getText(table);
return getString("_UI_AlterTable_type", new Object[] { parentLabel, new DiffContentService().getSubDiffs(alterTable, alterTable.getMatch().getComparison()).size() });
}
use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.
the class AlterViewItemProvider method getText.
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String getText(Object object) {
final AlterView alterView = (AlterView) object;
final View view = alterView.getView();
AdapterFactoryItemDelegator delegator = new AdapterFactoryItemDelegator(getRootAdapterFactory());
final String parentLabel = delegator.getText(view);
return getString("_UI_AlterView_type", new Object[] { parentLabel, new DiffContentService().getSubDiffs(alterView, alterView.getMatch().getComparison()).size() });
}
use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.
the class AbtractTest method diff.
protected Comparison diff(TableContainer left, TableContainer right) throws Exception {
Comparison comparison = DatabaseCompareService.compare(left, right);
assertNotNull(comparison);
// DatabaseChangeSet databaseChangeSet = null;
// if (comparison instanceof DatabaseChangeSet) {
// databaseChangeSet = (DatabaseChangeSet) comparison;
// }
// assertNotNull(databaseChangeSet);
DiffContentService DiffContentService = new DiffContentService();
System.out.println("---- Print ChangeSet -----");
for (Diff element : comparison.getDifferences()) {
System.out.println("\t" + element.eClass().getName());
List<Diff> subDiffs = DiffContentService.getSubDiffs(element, comparison);
if (!subDiffs.isEmpty()) {
for (Diff e : subDiffs) {
System.out.println("\t\t" + e.eClass().getName() + "(" + e + ")");
}
}
}
return comparison;
}
use of org.obeonetwork.dsl.database.compare.extensions.services.DiffContentService in project InformationSystem by ObeoNetwork.
the class DatabasePostProcessor method postComparison.
@Override
public void postComparison(final Comparison comparison, Monitor monitor) {
// Create DBDiffs
new DatabaseDiffExtension().visit(comparison);
// Delete all empty DBDiffs
final DiffContentService service = new DiffContentService();
Collection<Diff> toDelete = Collections2.filter(comparison.getDifferences(), new Predicate<Diff>() {
public boolean apply(Diff input) {
return input instanceof DBDiff && service.getSubDiffs(input, comparison).isEmpty() && input.getRefinedBy().isEmpty();
}
});
for (Diff diff : toDelete) {
// It could be optimized doing diff.eContainer().eContents().delete(diff) since no object references it.
EcoreUtil.delete(diff);
}
}
Aggregations