columnPairsInDb.removeAll(columnPairsTemp);
sourceColumnNames.removeAll(columnPairsNameSource);
for (String columnName : sourceColumnNames) {
ColumnPair columnPair = new ColumnPair();
columnPair.setSourceColumn(new Column(columnName));
columnPair.setDataMediaPairId(dataMediaPairId);
columnPairs.add(columnPair);
}
} else if (targetMedia.getSource().getType().isMysql() || targetMedia.getSource().getType().isOracle()) {
for (ColumnPair columnPair : columnPairsInDb) {
int i = 0;
for (String sourceColumnName : sourceColumnNames) {
if (StringUtils.isEquals(columnPair.getSourceColumn().getName(), sourceColumnName)
&& StringUtils.isEquals(columnPair.getTargetColumn().getName(), targetColumnNames.get(i))) {
columnPairsTemp.add(columnPair);
columnPairsNameSource.add(sourceColumnName);
columnPairsNameTarget.add(targetColumnNames.get(i));
}
i++;
}
}
// 要从数据库中删除这些columnPair
columnPairsInDb.removeAll(columnPairsTemp);
sourceColumnNames.removeAll(columnPairsNameSource);
targetColumnNames.removeAll(columnPairsNameTarget);
int i = 0;
for (String columnName : sourceColumnNames) {
ColumnPair columnPair = new ColumnPair();
columnPair.setSourceColumn(new Column(columnName));
columnPair.setTargetColumn(new Column(targetColumnNames.get(i)));
columnPair.setDataMediaPairId(dataMediaPairId);
columnPairs.add(columnPair);
i++;
}
}