use of org.talend.core.service.IMetadataManagmentService in project tdi-studio-se by Talend.
the class GenericUpdateManager method updateSingleSchema.
public static boolean updateSingleSchema(ConnectionItem connItem, final MetadataTable newTable, final IMetadataTable oldMetadataTable, Map<String, String> oldTableMap) {
if (connItem == null) {
return false;
}
Map<String, String> schemaRenamedMap = getSchemaRenamedMap(connItem, oldTableMap);
boolean update = !schemaRenamedMap.isEmpty();
if (!update) {
if (newTable != null && oldMetadataTable != null && oldTableMap.containsKey(newTable.getId())) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMetadataManagmentService.class)) {
IMetadataManagmentService service = (IMetadataManagmentService) GlobalServiceRegister.getDefault().getService(IMetadataManagmentService.class);
IMetadataTable newMetadataTable = service.convertMetadataTable(newTable);
update = !oldMetadataTable.sameMetadataAs(newMetadataTable, IMetadataColumn.OPTIONS_NONE);
isAddColumn = isAddColumn(newMetadataTable, oldMetadataTable);
}
}
}
if (update) {
return updateSchema(newTable, connItem, schemaRenamedMap, true, false);
}
return false;
}
Aggregations