use of org.obeonetwork.dsl.database.dbevolution.DBDiff in project InformationSystem by ObeoNetwork.
the class UtilServices method getOrderedChanges.
public List<DBDiff> getOrderedChanges(Comparison comparison) {
// Collect all changes
List<DBDiff> changes = new ArrayList<DBDiff>();
TreeIterator<EObject> it = comparison.eAllContents();
while (it.hasNext()) {
EObject next = it.next();
if (next instanceof DBDiff) {
changes.add((DBDiff) next);
}
}
orderChanges(changes);
return changes;
}
use of org.obeonetwork.dsl.database.dbevolution.DBDiff in project InformationSystem by ObeoNetwork.
the class DBDiffItemProvider method getText.
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
DifferenceKind labelValue = ((DBDiff) object).getKind();
String label = labelValue == null ? null : labelValue.toString();
return label == null || label.length() == 0 ? getString("_UI_DBDiff_type") : getString("_UI_DBDiff_type") + " " + label;
}
use of org.obeonetwork.dsl.database.dbevolution.DBDiff in project InformationSystem by ObeoNetwork.
the class UtilServices method getSubDiffs.
public List<DBDiff> getSubDiffs(Diff diff) {
List<Diff> subDiffs = getDiffContentService().getSubDiffs(diff);
List<DBDiff> changes = new ArrayList<DBDiff>();
for (Diff subDiff : subDiffs) {
if (subDiff instanceof DBDiff) {
changes.add((DBDiff) subDiff);
}
}
orderChanges(changes);
return changes;
}
use of org.obeonetwork.dsl.database.dbevolution.DBDiff 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