Search in sources :

Example 1 with IMetadataManagmentService

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;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataManagmentService(org.talend.core.service.IMetadataManagmentService)

Aggregations

IMetadataTable (org.talend.core.model.metadata.IMetadataTable)1 IMetadataManagmentService (org.talend.core.service.IMetadataManagmentService)1